#clojure log - Jun 28 2013

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

18:14 dobry-den: Is there a Clojure surrogate for (.getBytes "hello")

18:15 ah, (byte-array (map byte "hello"))

18:15 technomancy: what's wrong with .getBytes?

18:21 dobry-den: nothing

18:22 magnars: Idiomatic way of doing this? Map a function over a seq, but instead of returning a seq of results, return a map of the original values -> results ?

18:23 technomancy: magnars: (into {} (map (juxt identity f) s))

18:23 or reduce

18:23 juxt is cooler though

18:23 clojurebot: juxt?

18:23 clojurebot: juxt is a little hard to grok but it's the best thing ever

18:23 magnars: that is cool. thanks! :)

18:24 technomancy: oh... (zipmap s (map f s)) is shorter

18:24 egghead: but then you don't get to use juxt

18:24 hyPiRion: technomancy: don't be silly, the juxt version must surely be more efficient.

18:25 magnars: the juxt version was too awesome to pass over

18:25 technomancy: hyPiRion: more effective at being cool

18:25 magnars: ^^ think I'll have to make a juxt for dash.el

18:25 hyPiRion: technomancy: yeah, I was not talking about any specific measure of efficient

18:25 technomancy: magnars: yes please! =D

18:26 seangrove: Hey guys, I think I may be onto something with my "greater hair theory" https://dl.dropboxusercontent.com/u/412963/greater_hair_theory.png

18:26 The evidence is really starting to stack up

18:27 magnars: :D

18:27 seangrove: We thought it was the beard, turns out we were wrong

18:27 technomancy: nice

18:32 dnolen_: haha

18:37 hyPiRion: I'm not sure whether the "greater hair theory" or the "facial hair theory" is correct, so I'm trying to get into both.

18:37 better be safe than sorry

18:40 gt`: hi what is the quickest way to connect to ms sql database if i am using clojure on ubuntu

18:50 technomancy: any heroku users want to test out uberjar-based deploys before I merge it to mainline?

18:51 dobry-den: ,(map int (seq (String. (byte-array [(byte -1)]))))

18:51 clojurebot: (65533)

18:52 seangrove: hyPiRion: quite a wise approach, I'd say

18:52 dobry-den: How come it's 65533?

18:53 hiredman: characters are not bytes

18:54 dobry-den: rigiht, but why not 2^16?

18:55 hiredman: why should it be that?

18:56 dobry-den: oh, 65533 is a special "replacement character"

18:59 phildiaz: Hey, everyone. I come from Ruby programming for the web, and I'm just starting with Clojure. I seem to be having a problem that I suspect is really newb-ish, but I can't figure it out for the life of me.

19:01 I started my first lien project, and when I run my REPL server, everything works fine. I can use defn for methods and get normal resutls.

19:01 hiredman: functions

19:01 defn defines functions

19:02 dobry-den: technically they are methods in java behind the scenes aren't they

19:03 phildiaz: Ah, yes. Thank you, I need to get my head into functional programming zone.

19:03 technomancy: dobry-den: each function becomes its own class

19:03 dobry-den: ah

19:04 sorry phildiaz. tried to get you a clutch technical-victory.

19:04 technomancy: iirc each arity is compiled into its own method

19:04 phildiaz: Haha, no problem.

19:05 The issue I'm having is switching namespaces. If I do "(in-ns 'first-try.core)" and attempt to run any sort of function, even "(+ 1 1)", I get a CompilerException.

19:06 technomancy: phildiaz: in-ns only works for namespaces that already exist; try using ns for new namespaces

19:06 hiredman: in-ns just changes what namespaces forms will be compiled in, it doesn't load any code

19:06 if you have an existing namespace you'll want to require it

19:07 technomancy: (doto 'my.ns require in-ns) works too

19:07 hiredman: if you in-ns in to a not previously defined namespace you get an empty namespace

19:08 dobry-den: phildiaz: are you just trying to load your first-try.core code so you can test it in the repl?

19:09 phildiaz: Yes, I tried technomancy's suggestion, and it worked out. Thank you so much!

19:09 dobry-den: what editor/ide are you using?

19:10 phildiaz: Sublime Text 2. I installed the REPL package.

19:12 dobry-den: phildiaz: cool. see if there's a hotkey or something you can press that automatically loads your current file namespace into the repl for you.

19:14 phildiaz: Will do. Thank you all so much. I'm really excited to get started with this stuff. Like I said, I've been using Ruby for web stuff, and Clojure looks like a giant step up in development methodology.

19:15 Also, I'm a huge AngularJS fan, and this piqued my interest: http://keminglabs.com/blog/angular-cljs-mobile-weather-app/

19:26 dobry-den: phildiaz: cool, i came from Ruby as well.

19:27 Sinatra is clunky and awkward after working with Compojure and company.

19:27 trinary: same, except I haven't really dug too far into clojure yet, too busy writing weird stuff in javascript. Need to swap to cljs. :)

19:28 dobry-den: Ruby of course is clunky as well. consider the clojure versions of animals.map(&:name) and animals.map { |a| a.name.upcase }

19:29 (map name animals), (map (comp upcase name) animals)

19:32 holo: anyone is able to use new relic deploying to heroku with an uberjar? for the life of me, I can't make this work

19:37 technomancy: holo: currently that can only be done by checking in the newrelic agent jar unfortunately

19:37 I can add that before it gets merged though

19:37 holo: the behaviour we discussed previously is now on the uberjar-name branch of the buildpack if you want to try it out

19:38 holo: technomancy, what do you mean by checking in the newrelic agent?

19:38 technomancy: holo: git add =(

19:41 holo: technomancy, oh.. I did add the .jar agent, and "pointed" to it in the environment JVM_OPTS. which behaviour? I don't remember

19:41 technomancy: holo: I mean checking for :uberjar-name instead of looking for lein in the procfile

19:41 (from a few days ago)

19:43 holo: technomancy, hehe sure, I thought it was related to new relic. yes, I'm using that behaviour already, even though there is no need since I'm not using lein in Procfile

19:44 technomancy: cool

19:44 yeah, sorry, the java-agent stuff still needs a bit more work in the buildpack

19:48 holo: technomancy, hey that's great, at least I know it's useless to spend more time with this stuff for the time being. thanks. where will you publish when it's solved in the buildpack?

19:48 ok, just follow the buildpack commits, forgot about that one :)

19:52 technomancy, a correction. I'm using :uberjar-name, which is the reason why I also don't need lein invocation anymore, because the naming is static

19:54 technomancy: holo: it will show up on the heroku changelog once it's merged as default behaviour, but keeping an eye on the github repo is your best bet until then

19:54 happy to answer questions on irc too of course =)

20:01 holo: you're great. thanks. I try always not to abuse much of it. I imagine how busy you are

20:02 dnolen_: my god, I love it! http://gist.github.com/swannodette/5888989

20:14 technomancy: holo: to tell the truth, I can't really think of a good way to support this nicely

20:14 Sorella: Better than Microsoft, as far as consoles go

20:15 Hm, wrong channel.

20:18 technomancy: the whole point of uberjar is "collapse the project and its dependencies down into one file"

20:18 which doesn't work with java-agents at all; it has to be a separate file

20:18 holo: i see

20:18 technomancy: so you either have to shoehorn it into the uberjar task or provide an additional task to copy the agent jars into target/ or something

20:25 yogthos: technomancy: can we do another quick purge on clojars at some point? :)

20:26 technomancy: yogthos: yeah, for users of pre-2.2 lein?

20:26 it's not a problem on the latest, right?

20:26 yogthos: technomancy: oh I haven't checked :)

20:26 technomancy: if it's not then I wouldn't bother

20:27 technomancy: ok, cool

20:27 yogthos: technomancy: incentive for people to upgrade :)

20:27 you did the magic to parse the versions out after all? :)

20:27 technomancy: yogthos: there's another magic way to specify "latest" without triggering that stupid aether bug

20:28 yogthos: oooh

20:28 that is very awesome!

20:28 technomancy: you're probably the only person who is that excited about it, but yes; it's a good improvement =)

20:29 yogthos: lol I like to push out builds often :)

20:56 dnolen_: I don't even ... https://gist.github.com/swannodette/5888989

21:55 g06|in: why doesn't 'ctrl y' inside a 'lein repl' paste from clipboard? instead it pushes the REPL to background

22:10 mmarczyk: dnolen_: ping

22:10 dnolen_: mmarczyk: pong!

23:24 technomancy: g06|in: that's a known bug; there's a thread on the clojure mailing list about it

23:24 g06|in: technomancy: thanks!

23:25 technomancy: I also can't seem to access clojuredocs via lein repl -- that a bug too?

23:26 technomancy: g06|in: that's intentional; the clojuredocs client was causing a lot of dependency conflicts

23:26 you can add it back in yourself, but I think we haven't documented that right yet

23:26 g06|in: ok

23:27 technomancy: I was trying to learn clojure and the first thing I came across was the setup with lein and it mentioned a couple of examples including the one using clojure-docs; that's why I asked

23:27 technomancy: ah, yeah bummer

23:27 it was a little-used feature that caused lots of headaches

23:27 but we should document how to re-enable it

23:28 g06|in: technomancy: thanks!

23:41 bbloom: dnolen_: so what did you find out about large functions in JS… no big deal?

23:59 derek_c: Does Leiningen support all maven repos?

Logging service provided by n01se.net