#clojure log - Aug 23 2012

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

0:00 akhudek: I'm no expert on it, but from what I understand, the default generate handler accepted any form input parameter when doing updates.

0:01 davejacobs: that wasn't a problem with the routes though, it was a problem with which attributes were assignable to a model based on query parameters

0:01 akhudek: ah, ok

0:04 davejacobs: all right, thanks for the advice guys. i'm gonna see if i can hack away at this

0:04 michaelr`: good morning clojourianz!

0:06 eggsby: hi michaelr`

0:10 holo: i have "web: lein2 with-profile $APP_ENV run" in Procfile, but logs in heroku show `lein with-profile prod run`. isn't that weird to be running a different command?

0:10 hi

0:12 oh, i got it, probably it's guessing since it can't find "lein2"

0:43 emezeske: Apparently people named Daniel like to contribute to lein-cljsbuild

0:43 Of the 12 contributors, 4 of them are Daniels

0:44 mk: perhaps it's easy for them to see themselves contributing

0:44 emezeske: "All the other Daniels are doing it, I should too"

0:51 gtuckerkellogg: i want to switch to nrepl, but even though an nrepl server starts, C-x C-e doesn't seem to evaluate

1:05 I'm trying to get the latest nrepl, nrepl.el, and lein working together

1:05 if I evaluate something like (println "hello") i get nothing in the *nrepl* buffer

1:06 but if I evaluate (def foo 1), the var is defined properly

1:14 cemerick?

1:14 clojurebot: cemerick: Yeah, MacKay's book is great too.

1:14 gtuckerkellogg: heh

1:14 emezeske: technomancy: ping

1:15 cemerick: gtuckerkellogg: I'm smoked, going to bed. If you're still stuck tomorrow, ping me…although I know nearly nothing about nrepl.el FWIW. :-)

1:16 gtuckerkellogg: ok, thanks

1:16 maybe technomancy never sleeps

1:20 ahh, found the answer in the google group for nrepl.el

1:21 * gtuckerkellogg note to self: RTFM

1:21 brehaut: gtuckerkellogg: for those of us who have not RTFM, what was it?

1:22 gtuckerkellogg: well, only the existence of the google group for nrepl.el is noted on the github site :)

1:22 but in that group, there is an animated discussion in the last day of the same behavior I observed

1:22 and the answer is that nrepl.el *swallows* output from nrepl evaluations in the buffer

1:23 which seems to most people (including me) like the wrong thing to do

1:23 and is inconsistent with the default behavior of slime

1:24 * gtuckerkellogg goes to check to see if the issue has been posted yet in github

1:40 muhoo: it has

1:40 rbxbx: jsabeaudry and fwiw they're serving JSON, which while originally JavaScript Object Notation the agreed upon API doesn't necessarily have anything to do with JavaScript these days.

1:41 blah. clumsily worded words but you get my general point.

1:56 muhoo: gtuckerkellogg: did you get nrepl.el squared away?

1:58 gtuckerkellogg: muhoo, i found out that it does something surprising: it swallows the ouput from any evaluation in the buffer

1:58 so if I have (println "hello world") and C-x C-e eval, the *nrepl* buffer shows nothing

1:58 this is very different from slime, of course

1:59 and not so useful when developing code that actually uses stdout or stderr

2:00 I submitted an issue on github to have it changed. From the google groups discussion, most people seem to agree

2:06 muhoo: yes

2:07 is it nrepl that is swallowing stdout?

2:07 or nrepl.el?

2:08 gtuckerkellogg: wait, i just tried (println "fubar") in nrepl.el, and it worked

2:08 nREPL 0.1.4-preview

2:09 gtuckerkellogg: muhoo, were you using nrepl-jack-in?

2:10 muhoo: no

2:10 gtuckerkellogg: that's where it happens

2:10 muhoo: i'm running "lein trampoline repl :headless", and then connecting via the network

2:10 gtuckerkellogg: hmmm

2:11 muhoo: using lein 2.0 master though

2:11 gtuckerkellogg: i'm just running nrepl-jac-in-from emacs

2:11 nrepl-jack-in, that is

2:11 muhoo: maybe try "lein repl :headless" (no trampoline), and then in emacs "M-x nrepl"

2:11 gtuckerkellogg: It's documented in the group discussion here: https://groups.google.com/forum/#!topic/nrepl-el/3GDsRkX1IDE

2:12 * gtuckerkellogg goes to try that

2:13 gtuckerkellogg: that still doesn't capture the output

2:13 maybe you are using an earlier version of nrepl.el

2:13 he mentioned he had it sent to the *nrepl* buffer at one point, but changed it

2:14 muhoo: i'm on the latest git master of nrepl as of like yesterday

2:14 gtuckerkellogg: oh, let me be clear: it captures if the (println "foo") is done in the *nrepl* buffer itself!

2:14 muhoo: nrepl.el, i mean

2:14 gtuckerkellogg: but if I C-x C-e in another buffer that's connected to the nrepl, it doesn't capture it

2:15 muhoo: i did this: https://www.refheap.com/paste/4571

2:15 which was what i'd expect

2:15 oh, i don't C-x C-e, that'd explain that

2:16 gtuckerkellogg: From Tim himself in the google group discusison: "Presently nrepl.el swallows stdout output from evaluations in a clojure buffer. "

2:16 muhoo: oh. well, that sucks.

2:16 gtuckerkellogg: i agree

2:16 he's open to changing it, though, so I submitted an issue on github

2:16 muhoo: i saw a commit that pops up for stdin

2:17 i found nrepl.el super easy to hack on.

2:17 gtuckerkellogg: muhoo, doing what you did in the refheap works fine for me.

2:17 it's in the *nrepl* buffer itself

2:17 muhoo: ok, good, that makes sense.

2:17 gtuckerkellogg: it's evaluating and sending to the nrepl buffer that swallows the output of evaluation

2:18 which still make sense, but it's the wrong thing to do :)

2:18 muhoo: gtuckerkellogg: fire up yer elisp chops and fix it :-)

2:18 gtuckerkellogg: i'm confident tim is faster than me :)

2:18 but I might head down that road

2:19 muhoo: i'd recommend it. it's surprisinngly fun to be able to actually understand and modiffy a block of elisp

2:19 gtuckerkellogg: yes

2:19 i contributed the most minor little thing to org2blog once, and I was so f'ing proud of myself :)

2:20 muhoo: the nice thing about nrepl.el is it was written by clojure hackers, so it's simple and readable.

2:20 gtuckerkellogg: heh

3:11 ro_st: if i want to use my own lein project as a dependency in another lein project, does it have to exist as a jar somewhere for me to be able to use it in checkouts?

3:12 i have it symlinked in checkouts but lein deps is failing when trying to resolve a jar

3:13 jasonjckn: ro_st: shouldn't need to make jar, just the symlink should be sufficient

3:13 try #leiningen

3:13 xeqi: ro_st: yes; lein needs to be able to run without checkouts

3:13 ro_st: ok. i did a lein install from the subproject

3:14 does my checkout folder structure have to match the project name, eg, for (defproject orgname/projectname …), do i need checkouts/orgname/projectname ?

3:14 xeqi: I don't think so

3:15 jasonjckn: checkouts/sym-link

3:15 you can name it anything afaik

3:16 ro_st: excellent, thanks guys. testing

3:17 doing the whole refactor model code out to a common project thing

3:17 xeqi: ro_st: the thing to watch out for with checkouts is if you change the dependencies

3:18 then you need to do a lein install again

3:18 ro_st: change the deps in the subproject itself?

3:18 that makes sense

3:18 i vaguely recall something about cloudbees being the way to privately host jars for use with lein/maven?

3:19 cos i know jenkins is going to need some sane way to do all this

3:19 xeqi: there are a few ways

3:20 https://github.com/technomancy/s3-wagon-private

3:20 or running http://www.sonatype.org/nexus/

3:20 ro_st: awesome, thanks xeqi!

3:20 xeqi: there are other servers, but thats the common one

3:22 ro_st: we have a java veteran joining us in september. i think i'll let him figure this part out :-)

3:25 magopian: what would be the simplest, most idiomatic way to count the number of occurences of an element in a sequence?

3:26 i can see two solutions already: partition-by identity (and grab the key of the "occurence value")

3:26 or count the filtered seq

3:27 xeqi: (doc frequencies)

3:27 clojurebot: "([coll]); Returns a map from distinct items in coll to the number of times they appear."

3:28 magopian: mmm, that would give something roughly around the same as partition-by identity i guess

3:28 thanks xeqi

3:29 it's not "partition-by" that i meant, but "group-by" obviously ;)

3:29 but frequencies looks much better, thanks a lot xeqi ;)

3:36 ro_st: anyone using checkouts and cljsbuild's crossovers? :-(

3:36 oh, :extra-classpath-dirs worked -phew-

3:38 samrat: how do I convert a string into a stream, so that I can use it with clojure.data.codec.base64?

3:39 ro_st: samrat: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/util/io.clj#L26

3:44 samrat: ro_st: apparently, base64 doesn't work with java.io.ByteArrayInputStream

3:44 btw, what is ^String?

3:45 ro_st: a type annotation so that the runtime doesn't have to use reflection to determine on what type to dispatch

3:46 samrat: ro_st: ah, okay. but any idea how to convert a string to base64?

3:47 ro_st: https://github.com/remvee/clj-base64

3:47 i used this fantastic web app where you type what you're looking for and it gives you links to other webpages with answers

3:47 you might have heard of it -grin-

3:48 samrat: ro_st: i was suggested clojure.codec and I kinda got lost in trying to make it work

3:49 ro_st: to be honest, i have no idea. never had to do it. can't think that you're the first

3:49 samrat: thanks, anyway. I'll check out clj-base64

3:50 ro_st: good luck. let us know what you find!

3:51 ejackson: ro_st: LMGTFY !

3:52 ro_st: yup. was too lazy to actually use it -grin-

3:53 djcoin: :D

3:53 "fantastic web app"

3:54 hyPiRion: $search Clojure base64

3:54 lpetit: Hello there

3:54 hyPiRion: aight, it's not enabled.

3:56 djcoin: HelloO

3:57 ejackson: bonjour Frenchie !

4:12 lpetit: ejackson: hello, CCW refugee :-p

4:25 magopian: man, i'm proud of my solution to 4clojure's problem 94 (game of life), not using indexes of any kind ;)

4:26 took me ages to come up with though, and my brain hurts now

4:26 clgv: lpetit: I saw you being active on the issues. next beta release today?

4:27 lpetit: good morning,btw ;)

4:27 lpetit: clgv: after the holidays, my plate is quite full, so I'm not sure

4:27 good morning :)

4:27 clgv: are there some outstanding things you're waiting for ?

4:28 clgv: lpetit: not really. just wanted to interpret the activity ;)

4:28 lpetit: clgv: yeah, the activity means I'm back :)

4:28 clgv: lpetit: ah wel the leiningen/hooks problem annoys me a bit ;)

4:28 lpetit: clgv: will give it a try

4:28 miaoski: Hi.

4:28 lpetit: not no, but in a few hours

4:28 miaoski: hi

4:29 clgv: lpetit: I wish I could tell CCW to just ignore it, since CCW doesnt build my uberjars anyway ;)

4:30 lpetit: but can't do it with profiles since lein2-preview8 had also a bug regardin hooks and profiles...

4:30 lpetit: clgv: are the bugs in preview8 corrected and released ?

4:30 it's becoming annoying, this moving target :)

4:31 clgv: lpetit: dont remmeber the changelog. btw: does CCW's leiningen plugin already support using leiningen's local installation?

4:31 lpetit: clgv: what do you mean ?

4:32 clgv: lpetit: I remember that there was a thought to not only package leiningen as lib dependency for CCW but use what is installed on the system

4:33 lpetit: clgv: well, no, leiningen-core is currently still packaged. May not change soon.

4:37 clgv: lpetit: ok, just wanted to know. someone ask during the last days...

4:37 *assked

4:37 *asked

4:38 tomoj: magopian: you mean you don't use vector get with and index?

4:38 s/and/an/

4:38 clgv: lpetiti: what is your current development focus: CCW features or support for more leiningen features?

4:43 lpetit: clgv: leiningen = bug correction + slight improvements of the existing features (better error reporting, missing import wizard, etc.). And the bunch of work on the editor: adding what is missing (right now: better code completion support, and then better auto-indenting, selection indentation, file indentation). Also, Chas has been working on improving nrepl recently, so I'll have to integrate the changes. Only then will I do a second ro

4:43 on leiningen: I'll have to figure a way to allow people to allow people to discover and launch tasks from within CCW (goal: they should not have a distinct local installation of leiningen2 except for exceptional occasions/situations)

4:43 clgv: ah, for leinigen, a specific feature might be developed first as an exception: correct handling of :repl / :nrepl properties of project.clj, so that they are used instead of the current mechanism (if found)

4:48 LOL: working extensively from live interaction with the REPL, I fix & test a bug without even having (still) saved the file, and then I'm really surprised to not be able to stage the changes via git guy :)

4:52 clgv: lpetit: ok. interesting. with regard to repl the :injections attribute is interesting e.g. to automaticall require/use certain namespaces by default when starting a repl

4:53 lpetit: clgv: yeah, :injections too

4:53 clgv: it's just the equivalent of the -e flag of clojure.main, right?

4:53 clgv: I have some debugging stuff that I would like to be injected in every repl via the :dev profile

4:53 lpetit: uh, I never checked it's implementation

4:54 lpetit: ok, I'll check later, no rush

4:54 clgv: lpetit: from the comments in the sample.project.clj, I would guess that it might be actually implemented in eval-in-project

4:55 lpetit: clgv: hmm, okay

4:55 clgv: lpetit: but if you would let leiningen start up the nrepl server you should have that automatically. I dont know if thats an option...

4:56 lpetit: clgv: right

4:56 clgv: are you using the beta version?

4:56 of ccw

4:56 clgv: not here at work

4:56 lpetit: and @ home

4:56 ?

4:56 clgv: I have an old one @home

4:57 lpetit: okay

4:57 clgv: gotta update it ^^

4:57 lpetit: sure, the last I pushed just before going into holidays is a winner, really :)

4:57 cemerick said he can't live without it :)

4:57 clgv: because of better autocompletion?

4:58 lpetit: clgv: yes.

4:58 clgv: uh, gotta try it

4:59 lpetit: clgv: AFAIK, nobody went back from the beta to the stable while in holidays (~3 weeks)

5:00 ejackson: autocompletion !

5:03 lpetit: ejackson: autocompletion, yea. I used clojure-complete as a basis, and tweaked it quite a bit: decomplecting (ha! the new buzz word !) it (separating rendering from filtering from sorting). And I implemented CCW specific sorting / filtering functions, trying to do something close to what TextMate / SublimeText offer (match letters in sequence, but anywhere inside a matching completion candidate)

5:03 ejackson: also, does not only offer suggestions based on the dynamic repl context, but from symbols / keywords found in the editor, as well.

5:04 ejackson: symbols / files : if you try to complete a symbol, it will also suggest symbols based on keywords (e.g. you have the keyword :dependencies, if you type dep then dependencies will be suggested)

5:05 ejackson: lpetit: brilliant !!

5:05 lpetit: ejackson, clgv: and it does keyword completion based on the keywords found in the file

5:05 so yeah, this beta has a lot of potential in it

5:05 nkkarthik: lpetit: since we are at it... may I know what you guys think of https://github.com/ninjudd/clojure-complete/issues/12

5:07 clgv: lpetit: sounds like a definite update this evening ;)

5:08 nkkarthik: sounds good

5:08 ejackson: i'm gonna develop in CCW today. Retraining my emacs-fingers is hard :)

5:10 lpetit: nkkarthik: the interop story (completing class names, etc.), is still a WIP in CCw. Once done, completion for classes should work like this (compare with the examples you provided): type "Fra" and you'll get "javax.swing.JFrame" (notice I did as a newby users not knowing I must prepend a J in front of Frame). No need for wildcards.

5:10 nkkarthik: clgv: cool, thanks :) I am not sure if others need it... I kinda found it easy for my stuff

5:12 lpetit: nkkarthik: I'll give you an honest answer: having the ability to type "Win*Ad" for "WindowAdapter" does not appeal to me. The wildcard is powerful, but it's a double edged sword. And it's still one character more than "WinAd" (granted, "WinAd" will return more noise than "Win*Ad" in theory, and probably still a little in practice)

5:13 michaelr`: humhum

5:13 magopian: tomoj: nope ;) i partition the board in 3x3 cells, and count the neighbours ;)

5:14 nkkarthik: ,ccw

5:14 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ccw in this context, compiling:(NO_SOURCE_PATH:0)>

5:14 ejackson: lepetit: how do I get the beta ? 0.9.0-STABLE is all I see in the "Add new software" thingie

5:14 michaelr`: i wonder whether has anyone built a generic admin interface in clojure, for editing database tables etc?

5:14 lpetit: ejackson: maybe by reading the emails I send to you more carefully ? :-p

5:15 ejackson: http://ccw.cgrand.net/updatesite-betas/ . Different "channel"

5:15 ejackson: aha !

5:15 more carefulness needed :P

5:16 nkkarthik: lpetit: yeah I totally agree... just WinAd is more easy than Win*Ad

5:16 * ejackson blushes

5:16 mindbender1: when doing nrepl-jack-in in emacs, nrepl-init-repl-buffer is called with nil and an error is thrown, any one had this experience? Here is a gist: https://gist.github.com/3434519

5:16 nkkarthik: lpetit: I do have to agree I did just a 15 min hack there

5:17 mindbender1: I'm on emacs-snapshot

5:18 alfborge: I'm usinc http.async.client to get a web page. The page does not specify encoding, so the *default-encoding* is used. This is a ^dynamic ^private var. Is there a way for me to override this?

5:18 brunchpoems: mindbender1: maybe your profiles.clj is wrong?

5:19 (I'm not really sure what I'm talking about, but I had a problem earlier that was caused by that)

5:19 mindbender1: brunchpoems: do you mean if it's based on lein1?

5:19 brunchpoems: no, nrepl requires lein 2.x I believe

5:19 mindbender1: my project is lein2

5:19 alfborge: Nevermind, got it.

5:19 brunchpoems: oh, nevermind, ignore me sorry

5:20 I didn't have to add anything to profiles.clj to get nrepl to work, :/

5:20 nkkarthik: lpetit: so ccw will be merged to clojure-complete or the other way?

5:21 mindbender1: brunchpoems: what specifically did you do to get it to work it just might work for me too

5:21 brunchpoems: mindbender1: I was actually confused between two different problems I had earlier today, the profiles.clj thing was for swank-clojure :(

5:21 nrepl worked out of the box for me after I installed it through the emacs package manager

5:21 lpetit: nkkarthik: ccw has currently a forked version of clojure-complete. When things stabilize, I'll work with clojure-complete maintainers to find opportunities to reinject generic parts of the ccw port into clojure-complete

5:22 nkkarthik: lpetit: I mean will I be able to use ccw without eclipse?... sorry haven't looked at it... will look at it this weekend

5:22 mindbender1: brunchpoems: ok np.. thanks for caring anyway

5:22 brunchpoems: mindbender1: no problem, I'll do some googling to see if I can see anything related to your error message

5:22 mindbender1: brunchpoems: thanks.. I'd appreciate any kind of help

5:23 lpetit: nkkarthik: no, ccw is a lot of things, very vertical. It can't work without eclipse. But most headless parts have been developed in a library manner (paredit.clj, clojure-complete additions, etc.)

5:23 nkkarthik: lpetit: oh ok so when it's done it will be merged into clojure-complete... got that

5:24 brunchpoems: mindbender1: did you install through emacs package manager as well

5:24 *?

5:24 clojurebot: * is just for when you are lazy and sloppy

5:24 mindbender1: brunchpoems: yeah I did

5:25 M-x package-install [RET] nrepl [RET]

5:25 brunchpoems: right, yeah

5:25 nkkarthik: lpetit: ah ok, I will try to look at the clojure-complete part of ccw and if I can use it

5:26 lpetit: nkkarthik: right now it's too early, things are not stabilized, it's even hard to find (I put it as a secondary namespace inside an existing file :) )

5:26 ejackson: lpetit: hey, that autocompletion is groovy !

5:27 lpetit: ejackson: thanks man :)

5:27 nkkarthik: lpetit: so kind of you :D

5:27 naeg: is clojure really that much slower than java? http://shootout.alioth.debian.org/u32q/compare.php?lang=clojure

5:27 mindbender1: lpetit: does ccw work well on eclipse juno?

5:27 nkkarthik: lpetit: just kidding... my problem is I am not in good terms with eclispe

5:28 brunchpoems: mindbender1: are you doing nrepl-jack-in from a clj file?

5:28 clgv: naeg: well you have to look at the implementation that is used there before concluding anything from the charts and numbers

5:29 mindbender1: brunchpoems: yes

5:29 nkkarthik: lpetit: and yeah I understand things are in infancy... thank you for the info

5:29 lpetit: mindbender1: yes

5:29 mindbender1: lpetit: ok.. thanks will try it out

5:30 naeg: clgv: well it says "fastest" on both sides, and java is about 3-8 times faster (depending on the problem)

5:30 lpetit: nkkarthik: I have vague plans (when musing under the shower) to do something else than just "within and for" Eclipse, but that's just musing. When I have time for that, it will then probably best spent extracting more libraries from CCW for use for others.

5:31 clgv: naeg: I mean it depends strongly on the implementation. you can optimize your code for a givenproblem. the question is if it was done for that implementation

5:32 naeg: clgv: but in general - can one say that java is faster than clojure?

5:33 or, either "a bit faster", "much faster", ...

5:33 clgv: naeg: another problem is that all those benchmark problems have a pretty short duration. so clojures compile time is included in the time as well

5:33 nkkarthik: lpetit: yeah that would be great... or someone else can also take that burden for you, I suppose

5:33 lpetit: naeg: there's no point arguing that java is (and probably will, at least for a long time) be at least "a bit faster" than Clojure on the JVM

5:34 naeg: the point being, does that matter for your application or not.

5:34 noidi: naeg, I'd guess that your first Java version is very likely to be faster than your first Clojure version

5:35 naeg: it doesn't matter for me actually, just talking to a prof.

5:35 noidi: but then again, the latter is very likely to be much more maintainable

5:35 naeg: so, performance might be an issue when using Clojure instead of Java - but Clojure can be farely optimized

5:35 noidi: and as the adage goes, it's much easier to make clean code perform well than to clean up an optimized mess

5:36 lpetit: noidi: very true

5:36 naeg: try to reach grand on the topic of clojure & perf. He has good "from the trenches" stories to tell about (parsley, enlive, etc.)

5:36 ejackson: noidi: write only code its own punishment

5:37 * ejackson is looking at Larry Wall

5:37 noidi: naeg, dnolen (david nolen) is another person who regularly helps people optimize their code on the mailing list

5:38 * nkkarthik remembers the joke 'Java is "Write Once Run Away"'

5:38 noidi: and he seems to always get the seemingly dog-slow code to run at nearly the speed of optimized Java :)

5:39 naeg: noidi: I'm actually far away from optimizing code. I just wanted to show my prof. Clojure and ask him what he thinks about it. His only concerns was performance, but other than that he said it's interesting

5:39 mindbender1: I suspect there's a bug in nrepl.el

5:41 specifically the duo of (switch-to-buffer-other-window (generate-new-buffer-name "*nrepl*"))) returns nil in my emacs

5:42 which causes it to throw an error further down

5:43 * nkkarthik is amused to know that there are professors obsessed with performance over code beauty

5:46 brunchpoems: none of my professors so far have been very good at the code beauty aspect of programming

5:49 nkkarthik: brunchpoems: oh I am sorry to hear that... but then we have clojure bookshelf, don't we :)

5:49 lpetit: nkkarthik: well, performance, if taught about algorithms and their asymptotic complexity, is an important topic. Performance of the constant factors, on the other hand, is less important and should indeed not drive too much attention

5:50 mindbender1: nkkarthik: what do you mean exactly by code beauty

5:51 I think beauty is a vague word

5:52 nkkarthik: lpetit: yeah so true

5:54 lpetit: I meant there's nothing to be obsessed about it... regarding... "his only concern is performance"

5:54 mindbender1: wow... did I start something here :)

5:55 mindbender1: Well..maybe. Depends on you..this is a public forum

5:57 nkkarthik: mindbender1: yes, sir, it is a vague word

5:58 mindbender1: you should hear the other guy... he said... "lisp is good for your soul"... now what kinda word is soul :)

6:00 mindbender1: nkkarthik: well vagueness has been a source of confusion.. like Rich Hickey says words eventually come to mean whatever you want it to mean

6:00 moreover lisp was not good for my soul when I was learning it

6:01 especially caused by people whom I suspect felt that lisp was beautiful then went ahead and complected everything

6:04 nkkarthik: ha ha ha... yeah things tend to go wrong

6:04 * nkkarthik makes a note to use 'complect' from now on

6:05 mindbender1: nkkarthik: Also note that simplicity to me and to Rich Hickey is more important that beauty in this case

6:05 nkkarthik: well, I am sorry to have complected the discussion by using a vague word

6:06 mindbender1: nkkarthik: no you didn't

6:06 I'm happy you brought up that word

6:07 * nkkarthik is thinking whether simple is a vague word... or was that easy

6:08 nkkarthik: simplicity is part of, if I dare use the word again, beauty :)

6:08 mindbender1: nkkarthik: on infoq Rich Hickey's SimpleMadeEasy will set you straight

6:11 nkkarthik: mindbender1: oh will get right on it, thank you

6:14 michaelr`: hmm

6:14 so is there anything out there to scaffold crud interfaces for clojure?

6:22 tmartiro: hello all

6:23 does anyone know library for facebook graph api?

6:23 nkkarthik: lpetit: you have a very valid point there... performance should be concerned about the nature of algorithm... rather than nature of programming language... I never participated in a language war before... was tempted to but mindbender1 set me straight :)

6:23 michaelr`: tmartiro: https://github.com/maxweber/clj-facebook-graph

6:24 tmartiro: michaelr`, thanks a lot

6:24 Sgeo: How easy/difficult/annoying would it be to write a a library that Java users would experience as idiomatic in Clojure?

6:24 michaelr`: tmartiro: i'm using it, though it has problems. check the patches submitted

6:24 tmartiro: michaelr`, ok

6:24 Sgeo: Because I know maps are used in Clojure to store data frequently, and wouldn't Java people make a class? So the Clojure way loses some of Java's static typing, afaict.

6:24 michaelr`: tmartiro: seems that nobody maintains it the moment so the patches are not merged

6:32 josteink: hey guys. any tips on a reasonably simple ircbot/irc framework written in clojure?

6:50 michaelr`: so is there anything out there to scaffold crud interfaces for clojure?

6:56 clgv: josteink: check the source of clojurebot and lazybot

6:58 josteink: clgv: so far clojurebot seems... finicky

6:58 was first one I checked

6:58 doing a basic "lein deps" fails on lots of dependencies

6:59 have to fiddle with mixed repos. and documentation is a bit meh

6:59 but getting better results with lazybot now

7:11 clgv: josteink: lazybot is probably more interesting

7:58 naeg: I want to map a function which prints something out over a range of numbers, but with a (println) between each of them. I'm using -> for this, but I don't think that's really correct. simplified version: http://cljbin.com/paste/50361a45e4b0e7c03fb276ea

7:58 instead of (print %) there is my function which does something more exciting with those numbers, but also printing something out at the end

8:00 jsabeaudry: naeg, (map #(println (yourfun %)) (range 5)) ?

8:01 * naeg *facepalm*

8:01 naeg: thanks jsabeaudry

8:02 jsabeaudry: will still return a sequence of nils however, i'm not sure exaclt y what you want

8:02 nkkarthik: naeg: if you don't want the mapped values you can do

8:02 (map (comp println yourfunc) (range x))

8:02 if you also want the mapped values you can do

8:03 (map (comp second (juxt println yourfunc)) (range x))

8:04 the first one just prints values and returns nils

8:04 nz-_: ,(doc comp)

8:04 nkkarthik: the second one prints as well as returns the values

8:04 clojurebot: "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."

8:04 jsabeaudry: (map #(doto (yourfun %) (println)) (range 5))

8:05 nz-_: ,(doc partial)

8:05 clojurebot: "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."

8:05 naeg: the thingy with comp dooesn't work for me?

8:05 ,(map #(comp println (print %)) (range 5))

8:05 clojurebot: (01234#<core$comp$fn__2453 clojure.core$comp$fn__2453@6664e769> #<core$comp$fn__2453 clojure.core$comp$fn__2453@6a94d303> #<core$comp$fn__2453 clojure.core$comp$fn__2453@50a9a09f> #<core$comp$fn__2453 clojure.core$comp$fn__2453@30705018> #<core$comp$fn__2453 clojure.core$comp$fn__2453@1d9a7080>)

8:05 nkkarthik: naeg: there is no # with comp

8:05 naeg: ,(map (comp println (print %)) (range 5))

8:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0)>

8:06 nkkarthik: naeg: comp takes functions

8:06 ,(map (comp println #(print %)) (range 5))

8:06 clojurebot: (0nil

8:06 1nil

8:06 2nil

8:06 3nil

8:06 4nil

8:06 nil nil nil nil nil)

8:06 naeg: oh, but I still have the nils, so it's no real difference to (map #(println (yourfun %)) (range 5)) ?

8:07 nkkarthik: naeg: yes

8:07 if you want the values as well as print you can do

8:08 ,(map (comp second (juxt println double) (range 4)))

8:08 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core$map>

8:08 nkkarthik: ,(map (comp second (juxt println double)) (range 4))

8:08 clojurebot: (0

8:08 1

8:08 2

8:08 3

8:08 0.0 1.0 2.0 3.0)

8:09 nkkarthik: now we both print the doubles as well as return them

8:10 naeg: thanks all

8:10 nkkarthik: of course there are other ways too... :)

8:12 Fossi: oh, can you get the bot banned for spamming with println?

8:13 no, you can't

8:15 talios: hum_ph!

8:15 hum_ph: heyo

8:16 right... time for >140 characters verbosity :)

8:16 hyPiRion: Fossi: The bot stops after some time.

8:16 talios: so… order dependant builds huh… someone was asking about that on the dev list the other day as well

8:17 i'm a bit behind in email so that might have been you actually :) hah

8:17 hum_ph: nah - haven't gone that far yet - still just getting to the point of "that's odd"

8:17 I'm implementing clojure scripting support for liferay... it comes in two parts - a startup hook to register the script executor, and the executor iteself

8:17 talios: nice :)

8:18 hum_ph: both are :gen-class - and there's a 1-way dependency from the register-er to the executor

8:18 for conciseness - let's just cool them "hook" and "executor"

8:19 the hook references the executor so it can create it, pass the thread classloader in (don't ask), and then register it within liferay

8:19 the executor is self contained

8:19 talios: so it works if the ns's are listed in the correct order? From memory I have them in a set currently, so order isn't guaranteed

8:19 hum_ph: yeah

8:19 ClojureScriptingExecutor.clj and ClojureScriptingExecutorRegistrationAction.clj works

8:20 but - if i happen to change it so they're the other way round - kaboom

8:20 cemerick: talios: hallo

8:20 talios: hola cemerick

8:21 it'd be great if the clojure compiler worked out the order for us, but since its just a reader/eval that doesn't really work.

8:21 cemerick: you're gonna be screweeed tomorrow morning :-)

8:21 talios: if I use a List, or something that guarantees the order that should work...

8:21 cemerick - taking the day off, driving for 5 hours to the parents place for a friends 40th

8:21 hum_ph: that's the reason i gave the mutually dependent scenario

8:21 cemerick: talios: anyway, an odd thing: it seems that unqualified usages of `resolve` cannot be used in tests run through c-m-p…?

8:21 talios: so sleep in :)

8:22 cemerick - hrm, first I've heard of that one

8:23 cemerick: OK, I'll see if I can replicate in a simpler project. I was pushing when I ran into it, and just patched around it in the test.

8:24 * talios sadly hasn't actualy done any clojure in many many a month - cowork using it quite a bit with storm tho

8:24 talios: wb

8:24 hum_ph_: meh... laptop crashes

8:25 so - from my POV, it's all fine, because I happen to have things in the "right" order...

8:26 but it feels a bit sub-par to need to name files alphabetically in the order i need them compiled

8:27 hum_ph: and the cyclic dependency example makes that workaround unfeasible as well

8:27 talios: mmm, the only way around that would be to right something that parses the discovered .clj files, and sorts based require/imports

8:28 hum_ph: or encourage people to come up with creative names ;)

8:29 talios: 1_hook.clj 2_controller.clj ? :)

8:30 hum_ph: and hope to god we don't need 1.5_middleware.clj

8:32 talios: any idea what leiningen does in this scenario?

8:32 hum_ph: nope - haven't tried it

8:32 cemerick: what's the issue?

8:33 hum_ph: dependency resolution of AOP compiled (:gen-class)es

8:33 cemerick: ah

8:34 hum_ph: listed alphabetically which matches expected compilation order -- all good

8:34 cemerick: Should try to keep your AOT stuff quarantined, much like infectious disease.

8:34 hum_ph: yup

8:34 talios: you dynamic language lover you :)

8:35 hum_ph: this is integrating with liferay code - so needs a) named java classes for implementation; b) extending abstract classes

8:35 but - it's the integration point - so everything behind that should be reasonably clean (or as clean as someone who's been writing clojure for a week can make it!)

8:38 cemerick: talios: if I can't load it into a REPL, then it can't be helping me very much :-)

8:39 talios: don't make me get all frege on your behind ;p it even now has a repl

8:42 hum_ph - is it possible to declare some interfaces in java, and use them from the clojure as a way around it? mm

8:43 thats rather iki tho

8:44 hum_ph: for one of the two, I could reimplement the abstract class that provides 80% of it in clojure and then use that...

8:45 the other one no: liferay actually uses an abstract class with 1 abstract method and nothing else in lieu of an interface

8:46 magopian: is there a way to use the solution from http://www.learningclojure.com/2010/11/levenshtein-distance-edit-distance.html to the problem 101 on 4clojure?

8:47 it seems not, as it needs forward declaration, (if using the solution from fatvat)

8:47 or a defn (which seems to be forbidden by 4clojure)

8:48 talios: hum_ph - mmm, is it possible to use deftype at all - rather than gen-class?

8:48 magopian: otherwise i'll give a try at the "imperative way" explained in the wikipedia page

8:49 hum_ph: for one of the classes - yeah

8:50 means a bit of repetition of existing abstract classes - but nothing so complex it'd be a pain to reproduce (or a waste to not use)

8:56 Sgeo: Is conj basically just a function that "adds" to the most efficient place to put a new element?

8:58 stuartsierra: Sgeo: yes

9:02 Sgeo: Why do binding forms such as let and lambda-lists use vectors?

9:03 antares_: Sgeo: for the bindings part to stand out visually

9:14 gerry1: hello

9:14 can't make nrepl work

9:15 i always get "couldn't bind to address " messages when "nrepl-jack-in"

9:17 error in process sentinel: Could not start nREPL server

9:17 i don't know what's wrong

9:19 last time, i tried swank, it got same error messages

9:20 any ideas?

9:23 chouser: "couldn't bind" -- I wonder if that means the port you're trying to use is already in use or something.

9:26 amalloy: nrepl picks a port at random, and tries again on failure i think. so maybe he just doesn't have a network card, eh?

9:27 gerry1: amalloy: why nrepl can't bind to an address

9:28 cemerick: The default is to use port 0, so an open port should be autoselected

9:28 gerry1: network card?

9:28 :)

9:30 how to view ports which were bind in linux?

9:30 antares_: gerry1: netstat -t tcp -anp

9:31 cemerick: oh, nrepl.el is just using `lein repl :headless` and grepping for the port number

9:31 gerry1: can you run `lein repl` successfully in your project?

9:32 robermann: FYI: if anyone is using DB Oracle, I've just updated the entry on http://en.wikibooks.org/w/index.php?title=Clojure_Programming/Examples/JDBC_Examples&stable=0#Oracle - the previous example was not working

9:33 gerry1: cemerick: i'm trying

9:34 not work,still get same error messages

9:34 Exception in thread "main" java.net.BindException: Cannot assign requested address

9:34 cemerick: odd

9:34 gerry1: can you paste your project.clj somewhere? And, what version of lein are you using?

9:35 gerry1: Leiningen 2.0.0-preview8 on Java 1.7.0_05-icedtea OpenJDK Client VM

9:36 cemerick: well, that's quite sane

9:39 gerry1: cemerick: i'm just test clojure,so my project.clj is simple

9:39 (defproject myproject "JUST_TEST"

9:39 :dependencies [[org.clojure/clojure "1.4.0"]]

9:39 :plugins [[lein-swank "1.4.4"]])

9:39 just it

9:40 i do'nt know what's wrong

9:40 cemerick: hrmph

9:41 gerry1: please `export DEBUG=true`, run `lein repl`, and paste the results in a pastebin somewhere

9:42 jkkramer: yikes, apparently nrepl.el sends code to nrepl in the same ns as your buffer, and doesn't namespace-qualify clojure.core fns

9:43 I have a fn named resolve (core's is excluded) - nrepl.el started behaving strangely

9:45 amalloy: jkkramer: https://github.com/kingtim/nrepl.el/blob/master/nrepl.el#L314 could use a patch, then!

9:45 gerry1: cemerick: http://pastebin.com/810SFD3J

9:45 jkkramer: amalloy: working on it now…

9:45 I actually only noticed it when I got really bizarre compilation errors (per https://github.com/kingtim/nrepl.el/blob/master/nrepl.el#L510)

9:46 amalloy: but since there are quite a few chunks of code around that use `format` to construct clojure code, it's probably better to write something that acts a lot like syntax-quote and works on lists instead of strings

9:47 (nrepl-send-string (clojure-backtick (if-let [pst+ (resolve 'clj-stacktrace.repl/pst)] ...)))

9:48 cemerick: nrepl.el should really be using a different session for the tooling stuff, as well

9:49 gah, nothing there

9:49 jkkramer: amalloy: I don't think my emacs lisp fu is strong enough for that

9:49 amalloy: i'm not interested in doing it either, but i think it's probably not a challenging elisp task, just a challenging task/algorithm in general

9:49 cemerick: gerry1: eh, I was hoping to see the command being used to start the server.

9:50 xeqi: could try adding :repl-options {:port 23233}

9:50 amalloy: you either need some way to know that pst+ shouldn't be qualified, or a list of every symbol in clojure.core that should, for starters

9:50 xeqi: or some other port that should be unused

9:51 cemerick: If that works but port 0 doesn't, that'll be doubly interesting.

9:52 hum_ph: I suspect I know the answer to this - but I'm going to ask anyway: is gen-class my only option for subclassing an abstract class (working with an ordinary external API)?

9:52 xumingmingv: a stupid question, in clojure why we have a concept named *multimethod* rather than *multifunction*?

9:53 amalloy: yes, hum_ph

9:53 well, i guess no. you can use proxy

9:53 depending on your needs

9:53 hum_ph: sorry - should also add that I need a no-arg constructor and a named class for external instantiation

9:55 gerry1: i'm trying port 2323

9:55 amalloy: personally i'd write that in java, hum_ph. should be possible with gen-class, but would be easier to just use a language that's designed to take this kind of reflection/bean abuse

9:56 gerry1: lein repl :connect 2323 not response

9:57 noidi: gen-class is quite a pain to deal with

9:58 at first I found it surprising that no-one's wrapped it in a nice DSL. Then I realized that there is one already and it's called Java :)

9:58 hum_ph: heh

10:02 gerry1: i'm do "lein repl :connect 2323 :headless, it seems not response,but i can do "alt-x nrepl" in emacs

10:02 xumingmingv: a stupid question, in clojure why we have a concept named *multimethod* rather than *multifunction*?

10:03 tbaldridge: xumingmingv: I think method here is not used in the OOP sense

10:04 it's not "multimethod" as much as it is "multiple method function"

10:04 estebann: xumingmingv: presumably because it is used for type based polymorphism

10:04 gerry1: repl still not work

10:04 tbaldridge: http://en.wikipedia.org/wiki/Multiple_dispatch

10:05 Yeah, it's basically a polymorphism construct that's much more flexible than the one offered by "normal" OOP languages

10:05 borkdude: not necessarily type based, any value based

10:05 xeqi: does "lein repl" work? I don't think passing both subcommands would

10:05 estebann: true

10:16 xumingmingv: thanks, tbaldridge estebann

10:18 amalloy: huh. is there no way to specify an :as alias in my :refer-clojure clause? i need to add a separate :require/:as for that?

10:22 ejackson: dnolen: what is a MVS ?

10:23 jkkramer: amalloy: a separate :require is what I do. I didn't even think to try :refer-clojure :as but it would make sense

10:23 amalloy: jkkramer: yeah, i checked the source and evidently a separate require is the only option, but it seems like almost every time you'd want an :as

10:37 acheng: is it true that bean only "mapizes" one level deep?

10:38 S11001001: acheng: yes

10:38 acheng: S11001001: is there a recursive version?

10:38 S11001001: acheng: where would you stop?

10:38 acheng: hm. java.data...

10:39 don't stop til you get enough

10:39 S11001001: can't write an algorithm for that

10:39 acheng: (that was a pop culture reference :)

10:40 S11001001: ,(bean 5)

10:40 clojurebot: {:class java.lang.Long}

10:40 S11001001: ,(bean Long)

10:40 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException>

10:40 TimMc: That's just a security restriction, I think.

10:40 S11001001: ,(count (bean Long))

10:40 clojurebot: 39

10:41 TimMc: Haha, what val caused the error?

10:41 amalloy: TimMc: most of them, probably

10:41 TimMc: ,(take 20 (bean Long)

10:41 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

10:41 amalloy: i know lazybot won't let you use java.lang.reflect

10:41 TimMc: I needn't do the binary search in public channel. Gimme a moment.

10:42 joegallo_: it works fine at a local repl (for me)

10:43 S11001001: ,(map (fn [[k v]] [k (try (pr-str v) (catch Throwable _ "ERROR"))]) (bean Long))

10:43 clojurebot: S11001001: Pardon?

10:43 acheng: looks like java.data will work for me

10:43 TimMc: ,(key (second (drop 5 (bean Long))))

10:43 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.reflect.InvocationTargetException>

10:43 TimMc: Uhh...

10:45 S11001001: acheng: also keep in mind that bean is lazy in map-building and extracting properties; if yours isn't, then it will trigger errors sometimes beaning values where built-in bean wouldn't

10:45 redinger: has anyone looked into using Jark with Clojure 1.5?

10:45 edw: Anyone know how to get sqlkorma to play nice with PostgreSQL over SSL i.e. Heroku's PostgreSQL servers?

10:45 TimMc: ,(count (bean Long))

10:45 clojurebot: 39

10:45 TimMc: ,(count (drop 5 (bean Long)))

10:45 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.reflect.InvocationTargetException>

10:45 S11001001: TimMc: to force a pair it has to extract the value

10:46 TimMc: Yep, it's the beaning process. ##(counted? (bean Long))

10:46 lazybot: ⇒ true

10:46 acheng: S11001001: ok thanks. keep on with the force don't stop

11:01 rossputin: hey guys, I'd like to convert a param coming into a function into the correct type, if its passed in from one route its a string, from another route a num… at the moment I've got a load of (Long/valueOf x) code lying around… just looking to hear some better alternatives really

11:05 antares_: rossputin: can you paste an example?

11:09 rossputin: antares_: sure… Im doing stuff like : (q '[:find ?id :in $ ?fid :where [?id :user/someid ?fid]] (db conn) (Long/valueOf id))… I'm looking for a safer way that contends with different types coming in… sometimes string, sometimes numeric

11:09 antares_: rossputin: you can create a conversion protocol like here https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/conversion.clj

11:10 rossputin: although maybe I don't understand what problem you are solving by Long/valueOf. Are all outputs always strings? and you know nothing about the schema?

11:11 rossputin: antares_: the id param may be a string sometimes, or sometimes numeric, depending on how the API is used (from RESTful web service or web app)

11:13 antares_: just looking over the protocol example you referenced… looks pretty concise

11:14 antares_: rossputin: then a conversion protocol is just what you need

11:14 rossputin: antares_: thanks for the help.. was wondering when I'd get round to using protocols

11:15 antares_: rossputin: also see https://github.com/michaelklishin/welle/blob/master/src/clojure/clojurewerkz/welle/conversion.clj#L254, a slightly different case that uses multimethods

11:16 rossputin: antares_: are there performance characteristics of either in the RESTful web service under load scenario that would make me choose either one over the other ?

11:16 antares_: rossputin: protocols are more efficient, they are single dispatch

11:17 rossputin: antares_: thx

11:17 antares_: but they also dispatch on the type of the first argument, that's it

11:18 amalloy: a web service under load will have things that take way more cpu than the difference between dispatching with a multimethod vs a protocol

11:18 so i would answer no to that last question

11:18 rossputin: amalloy: good to know

11:18 thx guys

11:21 antares_: rossputin: yes, when in doubt, profile first (VisualVM is a good tool for starters)

11:21 rossputin: antares_: I'll lookit up

11:25 antares_: I've only ever done that kind of thing in terminal, so having some visual element will be nice

11:26 antares_: rossputin: http://visualvm.java.net. I great book on profiling JVM applications, mentions a lot of tools among other things: http://www.amazon.com/Java-Performance-Charlie-Hunt/dp/0137142528

11:27 *I would recommend

11:27 rossputin: Thx

11:30 AdamClements: Hi everyone. A pattern I seem to be repeating a fair amount is along the lines of (when (pred x) x), is there a more concise form of that in the core libs that I could use? Along the lines of (blah pred x). It's especially annoying if x is non-trivial and i have to put it in a let binding.

11:31 amalloy: AdamClements: no, but nothing stops you from defining that function yourself

11:33 jsabeaudry: AdamClements, have a look at if-let and when-let

11:35 amalloy: i don't think those are relevant to his problem

11:35 jsabeaudry: I might not be understanding the problem correctly

11:37 amalloy: he has (let [x (some big expr)] (when (pred x) x)), and he'd rather have (test-with pred (some big expr))

11:37 when-let doesn't help, because he needs to let x, and test pred

11:38 jsabeaudry: ah, ok!

11:40 I'd call it only-when

11:46 scriptor: (first (filter pred [x])) might work

11:48 AdamClements: amalloy, yeah so I could do (defn blah [pred x] (when (pred x) x)), but usually when I write little functions like that i find that ti's already in the core libraries!

11:49 tbaldridge: scriptor: on no, please don't do that..that'll be horribly slow

11:49 scriptor: tbaldridge: hah :)

11:49 AdamClements: jsabeaudry, when-let covers some situations I might use this in, that's true. Not all of them

11:49 jsabeaudry, only-when, good name, that was my other issue with defining it myself!

11:49 amalloy: agreed, AdamClements, this is something i'd expect to find in core, but it's not there

11:49 scriptor: doesn't one of the bots allow searching for type signatures?

11:50 amalloy: those don't exist in clojure, so no? lazybot lets you search for functions if you have an input and know what output you want

11:50 AdamClements: amalloy, especially given how it's idiomatic to return nil in so many situations

11:50 tbaldridge: clojurebot: can you search by type signature?

11:50 clojurebot: datatype is see datatypes

11:50 tbaldridge: hrm...guess not....

11:50 scriptor: ah, right, that's what I meant, not types

11:50 rod__: noob question: is there a non-lazy version of map? or do i just (doall (map ... )) thanks

11:52 metellus: rod__: dorun or doseq might do what you want

11:52 amalloy: $findfn 3 9 12

11:52 lazybot: [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int]

11:52 metellus: $findfn 2 2 4

11:52 lazybot: [clojure.core/unchecked-multiply clojure.core/+ clojure.core/* clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-multiply-int clojure.core/*' clojure.core/unchecked-add-int]

11:52 scriptor: $findfn odd? 3 3

11:52 lazybot: [clojure.core/max-key clojure.core/cond clojure.core/dosync clojure.core/sync clojure.core/char-escape-string clojure.core/*data-readers* clojure.core/with-loading-context clojure.core/default-data-readers clojure.core/*clojure-version* clojure.core/case clojure... https://www.refheap.com/paste/4582

11:52 rod__: metellus: thanks - i haven't been able to get doseq to return the new collection yet, but i'll try again.

11:54 tbaldridge: rod__: for that you want doall

11:54 just don't do something like (doall (range)) :-P

11:54 rod__: heh - ok!

11:54 i'll stick with doall then, cheers both

11:59 noidi: lpetit, thanks for keeping the counterclockwise "how to build" page up to date. I'm giving the instructions a go now :)

12:00 * lpetit crossing fingers

12:04 noidi: lpetit, minor issue: "you must clone 6 repos" is followed by 8 repos

12:05 lpetit: noidi: updated, thanks

12:09 noidi: lpetit, after following the instructions, I get the following errors: http://dl.dropbox.com/u/4653951/ccw_build_errors.png

12:09 have I skipped a step?

12:10 lpetit: noidi: create the classes/ folders for the complaining projects

12:10 noidi: ok

12:12 lpetit: noidi: added explicit instructions to do so, thanks for the feedback

12:12 noidi: lpetit, maybe those directories could be added to the git repos like this http://stackoverflow.com/a/932982

12:13 lpetit: noidi: unfortunately no because it can be destroyed by the IDE when doing project/clean

12:14 llasram: ~juxt

12:14 clojurebot: juxt is usually the right answer

12:15 noidi: lpetit, ok

12:16 lpetit: clojurebot: it is "just" an answer aha

12:16 clojurebot: Alles klar

12:16 lpetit: err "juxt" an answer

12:16 noidi: I added the directories and everything seems to build fine, thanks! :)

12:17 now what project do I need to run to see the built CCW in action?

12:19 amalloy: clojurebot: forget it |is| "just" an answer aha

12:19 clojurebot: I forgot that it is "just" an answer aha

12:20 lpetit: clgv: ping

12:20 clgv: lpetit: pong

12:21 lpetit: clgv: how can I reproduce Issue 409: Problem with Leiningen plugins and hooks ?

12:21 clgv: I know next to nothing about plugins and hooks.

12:21 oh wait

12:21 your plugin is targeting lein2, right, not lein1 ?

12:21 clgv: lpetit: yes

12:22 lpetit: clgv: would have been too easy :)

12:22 clgv: I need your help for coming up with a minimalistic reproducible scenario

12:23 clgv: lpetit: the main problem seems to be that the leiningen namespaces are not available

12:24 lpetit: I think the :plugin data works as expected, the exception was just confusing. so my plugin is there and tries to require/use leiningen namespaces which are not in the classpath-container, I guess

12:25 lpetit: clgv: while developing the plugin, or using it from a client project?

12:25 clgv: lpetit: while using it. but I check the former as well

12:26 lpetit: clgv: I think you should explicitly put a dependency on leiningen-core in your plugin's project.clj file. Do you do that?

12:26 clgv: lpetit: no, I do not. since I don't have to when workin with raw leiningen

12:26 lpetit: it provides those implicitly

12:27 lpetit: also I have no clojure dependency in there. since that is also provided by leiningen. so I can't eval the plugin namespaces in CCW at all

12:27 lpetit: clgv: I'm still not sure I totally grasp the problem

12:28 by veal, you mean "load" ?

12:29 clgv: ^^

12:30 clgv: lpetit: yes. actually after "lein2 new plugin myplugin" which is the default template for plugins there is no dependency jar in my classpath-container in CCW. but for raw leiningen that would be ok. since it is executed via ":eval-in-leiningen true" - so clojure and leiningen-core comes from the leiningen installation

12:30 lpetit: clgv: how is your plugin supposed to be used?

12:31 clgv: lpetit: currently it only adds a hook, which is supposed to change behavior when uberjar is built. so nothing that concerns CCW. but CCW gives me an error that it cant load those leiningen namespaces

12:32 lpetit: clgv: I still don't understand where and when in ccw do these errors occur

12:32 clgv: lpetit: so in that particular case, I would be happy if CCW just ignored :hooks

12:32 lpetit: after saving the project.clj or updating dependcies

12:32 or just openening the project

12:32 lpetit: clgv: I think I got it

12:33 clgv: could you find a plugin similar to yours on clojars with which I could reproduce the problem?

12:34 clgv: lpetit: I think you could take any plugin that provides a hook and then specify the hook namespace in the project.clj under :hooks

12:34 lpetit: clgv: do you have one in mind? Would really help me focus on problem solving

12:35 clgv: lpetit: hm I could built a dummy from my plugin. can I upload it with the issue?

12:35 lpetit: clgv: can you make it available on clojars?

12:41 clgv: lpetit: yes. just testing it

12:42 lpetit: clgv: gr8 !

12:43 clgv: lpetiti: it's up on clojars -> [lein-myhook "0.0.1"]

12:44 lpetit: clgv: thanks. can you update the ticket with this & instructions for reproducing the problem?

12:45 clgv: lpetit: last errand for you ;)

12:45 lpetit: :)

12:48 noidi: lpetit, Running any project as an Eclipse Application seems to start a new Eclipse with my compiled CCW. Does it matter which project I run?

12:49 clgv: lpetit: done. I think it's time to go home now ^^

12:50 lpetit: noidi: running any plugin project will use the same configured "Platform" and indeed every plugin project in your workspace will be available in this Platform

12:50 clgv: thaks

12:50 noidi: but usually I start it from ccw.core

12:50 which makes the most sense to me

12:51 noidi: OK, thanks!

13:00 lpetit, is it possible to package and install the latest git version of CCW into the development eclipse? or is it only possible to install from an update site?

13:00 * noidi = eclipse newbie

13:01 lpetit: noidi: meaning when you're happy with a change you did (as tested through the dev Eclipse runtime), and you want to install it yourself for your own eclipse?

13:02 noidi: lpetit, yes, exactly

13:03 lpetit: noidi: you create a project of kind Software Update Site. You open site.xml, you add ccw.feature, you click on "Build" => after the build, you reference your local update site directory from Help > install software … (adding a "local folder" and not an url)

13:03 must go now, good luck and see you later !

13:06 noidi: lpetit, thanks again :)

13:13 thorbjornDX: I'm looking at getting into clojure, and I picked up Clojure Programming (chas emerick et al.) are there any other good resources that I should look at early on?

13:14 bowles: http://www.4clojure.com/

13:14 4clojure is a nice repl in browser that guides you through clojure basics http://www.4clojure.com/

13:14 thorbjornDX: bowles: thanks, will check it out

13:15 bowles: Volkman has a pretty in-depth page I found very useful: http://java.ociweb.com/mark/clojure/article.html

13:17 scriptor: bowles, thorbjornDX: it's not exactly a repl

13:18 http://tryclj.com/ is more of a browser-based repl, 4clojure interprets clojure data but it doesn't involve a loop

13:19 thorbjornDX: 4clojure is more of a REP

13:20 scriptor: even the print part is iffy

13:20 thorbjornDX: scriptor: hah, true.

13:20 scriptor: RE-GREEN-OR-RED-CIRCLE

13:20 bowles: thanks for clarifying, I did like tyrclj

13:21 thorbjornDX: btw: is leiningen the defacto way to write and run clojure code? or should I just be doing java -jar

13:22 scriptor: thorbjornDX: lein, definitely

13:22 thorbjornDX: scriptor: sounds good. What's the best way to get lein onto my system? Is it distributed as a .jar?

13:22 scriptor: thorbjornDX: just a shell script, actually!

13:23 http://leiningen.org/

13:23 technomancy: thorbjornDX: it could be in your package manager, but it's easy to install by hand. just be sure to get 2.x

13:23 thorbjornDX: technomancy: I'm running in a weird non-root environment, so I've had to hack a lot of stuff.

13:23 scriptor: well, it has a self-install command which does the installation of all the rest, but you just need the shell script to get started

13:24 technomancy: yeah, manual install works fine without root

13:24 thorbjornDX: technomancy: how do I point it at my clojure.jar?

13:24 technomancy: environment variable?

13:24 scriptor: thorbjornDX: you don't need to

13:24 technomancy: thorbjornDX: don't do that; just declare your dependencies

13:24 thorbjornDX: run `lein tutorial`

13:25 thorbjornDX: scriptor: technomancy: Okay, I guess I always assumed that since my project.clj was clojure syntax, it required clojure.jar to run

13:25 scriptor: thorbjornDX: clojure is usually listed as one of the dependencies, the page I linked above has an example on the front page

13:26 so it automatically downloads clojure.jar and puts it in your project's classpath for you

13:26 thorbjornDX: scriptor: okay, that makes sense

13:27 scriptor: so lein will drop all of its requirements into ~/lib ?

13:28 technomancy: thorbjornDX: they'll be in ~/.m2/repository, but you shouldn't need to worry about where

13:28 just start hacking and it'll handle things for you, in general

13:28 thorbjornDX: technomancy: gotcha, I'll run through the tutorial now

13:28 thanks for you help

13:33 ah, this is dead simple (and blows python packaging out of the water)

13:33 technomancy: sweet

13:34 thorbjornDX: technomancy: now I just need to learn graph theory and I can make some progress

13:34 S11001001: virtualenv is pretty hilariously hacky

13:35 thorbjornDX: S11001001: I've been trying to just run out of supposed "clean" lib/site-packages, but it always ends up messy

13:35 S11001001: (using pip, which at least allows me to 'uninstall')

13:35 S11001001: I gave up and virtualenv for everything now

13:35 technomancy: a big part of learning clojure is unlearning all the BS and baggage you bring with you from past experience

13:37 stuartsierra: Never thought I'd see the day when Maven-based dependency resolution was viewed as "unlearning baggage."

13:40 scriptor: could have once said the same of jvm-based languages

13:40 stuartsierra: Kudos to technomancy are in order.

13:41 duck11231: (inc technomancy)

13:41 lazybot: ⇒ 36

13:41 technomancy: aw shucks you guys

13:43 nDuff: Hrm. No documentation for instant literals at http://clojure.org/reader -- where would that be?

13:45 duck11231: there's some stuff in the changelog. I saw that the other day, but it's not much

13:47 stuartsierra: nDuff: It's not well-documented outside of the source.

13:47 Contributions welcome.

13:51 TimMc: stuartsierra: How should doc contributions be made?

13:51 stuartsierra: dev.clojure.org

13:51 TimMc: Ah.

13:52 Just add and edit pages?

13:52 stuartsierra: yep

13:53 nvy: thank you bowles @ java.oci link

13:56 bowles: many of the resources mentioned here can be found at: http://learn-clojure.com/

13:58 noidi: lpetit, I made a tiny change to get my feet wet https://github.com/laurentpetit/ccw/pull/10

15:03 dansalmo: is this the best way to get the difference between these two strings as "extra"? (apply str ((split-at (count "same") "sameextra") 1))

15:07 noidi: &(.replaceFirst "someextra" "some" "")

15:07 lazybot: ⇒ "extra"

15:07 clj_newb_23823: is there a file in clojure that says "create file XYZ if it does not already exist"? I don't want to do a "check for xyz; then create" since between the check /create, the file might have bene created

15:08 is & a clojure macro or a lazybot tag?

15:08 &(+ 2 3)

15:08 lazybot: ⇒ 5

15:08 clj_newb_23823: & (println "Yo")

15:08 lazybot: ⇒ Yo nil

15:09 clj_newb_23823: is there a file in clojure that says "create file XYZ if it does not already exist"? I don't want to do a "check for xyz; then create" since between the check /create, the file might have bene created

15:09 S11001001: clj_newb_23823: opening a file for writing will create it if it doesn't exist

15:09 clj_newb_23823: &(println "Is there a way in Clojure to atomically say: [if file XYZ does not exist; create file XYZ]")

15:09 lazybot: ⇒ Is there a way in Clojure to atomically say: [if file XYZ does not exist; create file XYZ] nil

15:09 noidi: dansalmo, I find the .replaceFirst call slightly more readable, but note that the search pattern is a regular expression, not a plain string

15:09 clj_newb_23823: S110010001 and if the file already exists?

15:09 dansalmo: Thanks :nodi

15:09 S11001001: clj_newb_23823: if you open it in append mode, nothing

15:10 clj_newb_23823: urgh; so the hack is:

15:10 noidi: &(.replaceFirst "sameextra" (java.util.regex.Pattern/quote "same") "")

15:10 clj_newb_23823: open the file in append mode

15:10 lazybot: ⇒ "extra"

15:10 clj_newb_23823: check to see if here's already contents in it?

15:10 TimMc: Just open in append mode and start writing.

15:10 noidi: that Pattern/quote escapes all RE magic characters from the string

15:10 S11001001: clj_newb_23823: it's not a hack; it's been the standard way to do it for decades, and is there precisely to eliminate the race condition you mention

15:11 clj_newb_23823: http://docs.oracle.com/javase/6/docs/api/java/io/File.html#createNewFile%28%29

15:11 I thikn that's what I want

15:11 TimMc: clj_newb_23823: If the file is already there, you want to bail?

15:11 clj_newb_23823: yes

15:11 hmm; my bad for not making that clear in my question

15:12 TimMc: createNewFile seems legit, then -- as long as you are not using it for locking. :-)

15:13 clj_newb_23823: is Clojure's "spit" atomic wrt to the file system?

15:13 i.e. if two clojure threads spit to the same file, is it guarnteed that the contents on the FS will be exactly one of the two calls

15:13 or can it be some threaded/interleaved form of both?

15:13 S11001001: clj_newb_23823: latter

15:14 clj_newb_23823: as for createNewFile, remember that it is still possible for someone to open and write to your file after you've succeeded at createNewFile, unless your umasks/stickies are set to deny them

15:14 clj_newb_2398324: that's unfortunate

15:14 amalloy: gotta switch to an immutable filesystem just to be safe

15:15 clj_newb_2398324: hmm; yes, I need an immutable, persistent FS

15:15 nvy: hey, I just did M-x clojure-jack-in, and it does give me a clojure shell

15:15 clj_newb_2398324: I think it's called ZFS

15:15 nvy: how do I make it "execute" my lein project's code?

15:15 (-main) clearly doesn't work

15:16 technomancy: nvy: (doto 'my-main.ns require in-ns)

15:16 then (-main) will work

15:17 nvy: technomancy: will I have to do that every time I modify my clojure code?

15:17 technomancy: nvy: no, C-c C-k will load the current buffer from emacs

15:18 emezeske: clj_newb_2398324: I don't think you repeated your question enough

15:18 clj_newb_2398324: &(doseq [x (range 10)] (println "clj_newb's question"))

15:18 lazybot: ⇒ clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question nil

15:18 clj_newb_2398324: &(doseq [x (range 10)] (println "clj_newb's question\n"))

15:18 lazybot: ⇒ clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question clj_newb's question nil

15:19 clj_newb_2398324: this is probably good time for me to stop before I get kicked

15:19 emezeske: Well, that was enough to get you on my ignore list. *plonk*

15:19 S11001001: oh dear.

15:19 clj_newb_2398325: this nick too?

15:20 so I've rencely been using redis with clojure; and I really like the fact that I can just backup dump.rdb

15:20 is there any other datbases (something perferably document store-ish) that also supports such simple backup?

15:22 S11001001: zope

15:26 technomancy: couch is like that I believe

15:26 bobajett: noob question: I have file hello.clj with (defn hello [] (println "hello world")), how can I import this into my clojure REPL so I can execute (hello) in my REPL?

15:28 lynaghk: bobajett: you can use the 'load-file function

15:29 bobajett: otherwise, you'll have to look at the docs for whatever editor you're using. For instance, if you're using emacs+slime you can do C-c C-l.

15:30 stuartsierra: bobajett: Yes, `load-file` is the simplest way to load a file. Once you have a project with real namespaces you would likely use `require` instead.

15:31 bobajett: $ cat hello.clj

15:31 defn hello []

15:31 (println "hello world"))

15:31 clj_newb_2398325: you're missing a (defn

15:32 bobajett: copy and paste error there. but ('load-file "hello.clj") and then at the REPL user=> (hello) gives me a "Unable to resolve symbol" error

15:33 clj_newb_2398325: why ('load-file "hello.clj") rather than (load-file "hello.clj")

15:33 bobajett: oops

15:33 clj_newb_2398325: the correct way to do this is to 1: create a full transcript 2) past the transcript to a paste bin 3) post a url to the paste bin here in the channel

15:33 bobajett: awesome! thanks guys

15:34 that worked

15:35 S11001001: ,(doc +')

15:35 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +"

15:35 S11001001: funny how + documents the behavior of some other function instead :)

15:36 funny how I forget to put ' even when I'm talking explicitly about that, just like said docstring

15:36 ,(+')

15:36 clojurebot: 0

15:36 clj_newb_2398325: has anyone come up with a lazybot-clojurebot quine yet?

15:37 ,?

15:37 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ? in this context, compiling:(NO_SOURCE_PATH:0)>

15:38 clj_newb_2398325: ,(println "clj_newb is going to get kicked")

15:38 clojurebot: clj_newb is going to get kicked

15:38 metellus: &(+ 1 1)

15:38 lazybot: ⇒ 2

15:38 clj_newb_2398325: ah, the => from lazybot prevents the quine; doh

15:39 TimMc: S11001001: They changed the name, but forgot to change the docstring.

15:40 S11001001: ,(doc +)

15:40 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"

15:40 S11001001: TimMc: huh.

15:40 TimMc: ,(meta #'+')

15:40 clojurebot: {:ns #<Namespace clojure.core>, :name +', :file "clojure/core.clj", :line 908, :arglists ([] [x] [x y] [x y & more]), ...}

15:40 TimMc: ,(:added (meta #'+'))

15:40 clojurebot: "1.0"

15:40 S11001001: (use clj-time.travel)

15:42 TimMc: ,(:added (meta #'+)) ;; for completeness

15:42 clojurebot: "1.2"

15:42 S11001001: I guess that's fair

15:42 but wasn't it 1.3?

15:43 TimMc: Ha, I think so.

15:43 Clearly 1.3 is blaming 1.2.

15:44 S11001001: in the tradition of emacs, change :added to :removed, for antinews

15:44 scriptor: I don't know why I just checked the source for clj-time.travel

15:45 S11001001: https://www.gnu.org/software/emacs/manual/html_node/emacs/Antinews.html

15:45 TimMc: 1.2's reader doesn't even believe that symbol literals can end in '

15:45 S11001001: indeed

15:46 it makes for that neat (first [+' +]) trick

15:47 ,(first [+' magic])

15:47 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: magic in this context, compiling:(NO_SOURCE_PATH:0)>

15:47 S11001001: oh yeah

15:48 TimMc: Haha, I like that.

15:48 S11001001: ,(first [+' 'magic])

15:48 clojurebot: #<core$_PLUS__SINGLEQUOTE_ clojure.core$_PLUS__SINGLEQUOTE_@6aab998e>

15:48 TimMc: ,((first [+' +]) Long/MAX_VALUE 1)

15:48 clojurebot: 9223372036854775808N

15:48 TimMc: Should work in 1.2 as well, right?

15:49 S11001001: yes

15:53 bobbrahms: hey all: I want to add some clojure to my big java project, which is built using maven. But I want to be able to freely mix them, having clojure importing java, and having java import clojure generated classes, more or less with impunity. But when I build, either clojure or java gets built before the other guy and whichever one goes first complains about not being able to find the classes it's trying to import.

15:53 Now clojure gen-class seems good at making stubs.

15:54 Can I run the clojure maven build plugin in such a way that it can generate just the class stubs it finds in the clojure files, then do the java compile, then run the "real" clojure build again, overwriting the stubs with the actual classes?

15:55 stuartsierra: bobbrahms: no

15:55 Unless you compile the stubs and the java in separate sub-modules

15:56 But that's not going to do the over-writing you want.

15:57 bobbrahms: but is there any problem with an approach like I am describing?

15:57 stuartsierra: bobbrahms: loads

15:57 loads of problems, that is.

15:57 bobbrahms: what are some of the main things I'm missing?

15:58 stuartsierra: You cannot mix two languages without an integrated compiler.

15:58 bobbrahms: could I build a program to go through my clojure files, pulling out the namespace expressions with gen-class in them and then just compile those to stubs at an early stage of the build?

15:59 stuartsierra: I'm sure you could, but I doubt it would be less work than refactoring your design to avoid the cyclic dependencies.

15:59 bobbrahms: not really talking about cyclic dependencies here

16:00 stuartsierra: If your Java code calls Clojure code which calls the Java code, in the same project, that's a cyclic dependency.

16:00 bobbrahms: more like inter-dependencies

16:00 I'm not talking about clojure module a referring to java mod b, which refers to clojure module a

16:01 stuartsierra: It doesn't matter if it's the same module or different modules, there's no sane way to do it.

16:01 bobbrahms: I'm talking about clojure module a referring to some java module which might be in the same named package/namespace

16:02 in the (admittedly simple) experiments i've tried, it works if I do manually what I've been describing

16:03 is there some other problem with that workflow? at java compile time, if it sees the stub classes, the java compile is happy

16:03 stuartsierra: Like I said, you could probably make it work. But my strong recommendation is to refactor your design.

16:03 bobbrahms: Well, here's the thing

16:04 yes you can make a class, using clojure, that extends some java class, or implements some interface

16:05 S11001001: bobbrahms: if there's truly no cyclicality, you should be able to arrange a DAG of subprojects, alternating java and clojure

16:06 bobbrahms: but why should it be considered harmful or bad style to have, within a project, java and clojure source directories with modules of each being essentially fellow citizens?

16:07 I mean , yes what you say is true

16:07 you should be able to arrange it that way.

16:07 but it's so much more natural and easy if you could put things where they want to be.

16:07 stuartsierra: The problem is that neither the Clojure compiler nor the Java compiler are aware of each other. So they have to be run in some fixed order.

16:07 bobbrahms: yes.

16:08 stuartsierra: What you seem to want is a third "Clojure gen-class stub" compiler that doesn't exist.

16:08 bobbrahms: which is why I'm asking if there's any reason why I couldn't just pick up the ns declarations and use them to make stubs to make the java compile happy

16:08 stuartsierra: Nothing's going to stop you.

16:09 bobbrahms: right.. ok my question is this

16:09 when I rip out everything but the ns in my clojure module, it makes a stub that makes the java import happy.

16:10 are there problems with this approach i'm going to run into? Are there some things that are going to fail, apart from ns declarations that contain references to java-land imported stuff that doesn't exist yet?

16:10 nvy: so in nrepl I do C-C C-l within my bugger, it says then "namespace auha.core" loaded, how do you then run auha.core/-main ?

16:11 user> (auha.core/-main)

16:11 ClassNotFoundException auha.core java.net.URLClassLoader$1.run (URLClassLoader.java:217)

16:11 stuartsierra: bobbrahms: Probably. I can't enumerate them here. Again, you could probably make it work. But it's going to be complicated and something that no one else is doing.

16:12 bobbrahms: OK stuart. Thanks!

16:12 stuartsierra: You're welcome.

16:13 bobbrahms: if something specific comes to mind that would break this, I'd love to know about it. I'm pretty much a noob at clojure

16:15 duck11231: nvy: I would expect it to do this, but try requiring that ns first

16:16 nvy: duck11231: how would you do that?

16:16 duck11231: (require 'auha.core)

16:17 nDuff: bobbrahms: ...so, the usual approach is to just structure things such that the java can compile without the clojure

16:18 bobbrahms: ...for instance, you can reference fns through vars which return objects implementing interfaces accessible only from Java code, avoiding the need for your Java to know about anything generated from compiling the clojure

16:18 bobbrahms: sure but wouldn't it be cool if you can refer to your clojure classes from your java code?

16:19 nDuff: Not really?

16:19 Using gen-class typically means you're doing something wrong

16:19 so if you're doing things right, you can refer to your clojure fns, through vars, as-is.

16:19 (well, "something wrong" meaning "something necessary for interop purposes")

16:19 (but that you wouldn't do if you had enough control to avoid it)

16:19 bobbrahms: right

16:23 without gen-class, is there some way of using clojure to implement some interface, make an object and pass it around?

16:24 proxy?

16:24 clojurebot: proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.

16:24 nDuff: bobbrahms: gen-class isn't even the _preferred_ way to do that

16:24 reify is ideal

16:24 proxy if you can't use reify

16:24 bobbrahms: reify? cool

16:24 nDuff: gen-class if you can't use proxy

16:25 ...if it's only implementing an interface, not a class, reify will be fine.

16:25 amalloy: &(.close (reify java.io.Closeable (close [this] (println 5))))

16:25 lazybot: ⇒ 5 nil

16:27 nvy: ok duck11231, and how to reload that namespace? C-c C-k doesn't do the trick

16:28 bobbrahms: if I want to extend my java classes do I want to use gen-class?

16:28 duck11231: nvy: Not sure. I haven't fully made the switch to nrepl yet, but that was working when I tried it

16:28 S11001001: when I use gen-class, it feels so dirty that I have to make a separate library for the gen-class to keep it away from the nice code

16:28 bobbrahms: hahahaha awesome.

16:29 nvy: I have switched to the auha.core namespace already duck11231, could that be the reason? is there a way to come back to user> ?

16:29 stuartsierra: One thing you can do is define interfaces in Java and implement them in Clojure with reify/deftype/defrecord.

16:29 bobbrahms: is it difficult and/or wrong to create clojure based spring managed beans

16:29 nvy: just assuming that nrepl is similar enough

16:30 duck11231: I think C-c M-n is the new C-c M-p and there-s always (in-ns 'user)

16:31 S11001001: bobbrahms: it's going to cut you off from config by annotations

16:31 stuartsierra: Clojure supports annotations in gen-class and deftype, but the syntax is not documented except in unit tests.

16:32 (Actually, not sure about gen-class. Definitely deftype.)

16:32 nathanic: bobbrahms: http://www.deepbluelambda.org/programming/clojure/building-ejbs-with-clojure

16:32 not quite spring but in that general direction

16:32 duck11231: I think it's time I swap out my "auto connect to slime" command with an "auto connect to nrepl"

16:33 S11001001: stuartsierra: sounds troublesome

16:34 stuartsierra: It's certainly not worth the trouble of figuring it out, in my opinion. If you need annotations, just write Java.

16:34 S11001001: or scala, an open-source programming language designed with the cloud in mind :)

16:34 nvy: thanks duck, I'll try it

16:35 gfrederi`: anybody coming to see rhickey tonight?

16:35 bobbrahms: not sure I really care about config by annotation. But practically, this is a spring app.

16:37 wastrel: hi

16:40 scriptor: gfredericks: whereat?

16:43 bobbrahms: just to be clear: when you guys say that gen-class is to be used as a last resort after reify and proxy, does this disdain extend into the use of the :gen-class parameter of ns?

16:46 S11001001: bobbrahms: yep

16:46 bobbrahms: OK, cool. thanks

16:46 thorbjornDX: I'm trying to learn how recur works, In particular how it's used in last, any tips?

16:47 dnolen: bobbrahms: :gen-class in ns is standard if you're creating a main entry point for your app.

16:48 bobbrahms: for static functions is gen-class required?

16:48 S11001001: thorbjornDX: any experience in scheme?

16:49 thorbjornDX: S11001001: I poked through the homework for an intro to scheme course once

16:49 S11001001: idk if that counts as experience :P

16:49 technomancy: loop/recur is usually a sign that you're doing something really low-level

16:49 S11001001: thorbjornDX: did it cover named let, or (let lp (...)?

16:49 technomancy: you probably won't need it when you're getting started

16:49 thorbjornDX: S11001001: yes

16:50 technomancy: I'm doing an exercise that requires me to get the last element in a collection without last

16:50 S11001001: thorbjornDX: imagine that every loop and fn creates a named let called "recur", that you are only allowed to call when the compiler can turn it into a goto without semantic change

16:50 thorbjornDX: consider iterate instead :)

16:51 thorbjornDX: S11001001: okay, I'll check it out

16:51 S11001001: bobbrahms: is there a way to make static methods with gen-class, then?

16:57 thorbjornDX: S11001001: (iterate println [1 2 3 4 5]) tends to explode, does my function have to check for nil?

16:58 bobbrahms: S11001001: I was assuming. in the :methods parameter you can have #^{:static true}

16:59 S11001001: ,(take 10 (iterate rest [1 2 3 4 5]))

16:59 clojurebot: ([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5) ...)

16:59 brainproxy: at-at for scheduling? other recommendations?

17:00 S11001001: thorbjornDX: look what's in there thorbjornDX :)

17:00 bobbrahms: interesting. I wonder what it does.

17:00 thorbjornDX: S11001001: ah, very cool. Thanks for the example.

17:03 S11001001: bobbrahms: though #^ is deprecated in favor of ^

17:03 bobbrahms: which dates that example to pre-1.2

17:04 gfredericks: scriptor: chicago

17:38 thorbjornDX: S11001001: so now the last element of a list is a one element list containing the last element of the vector that I had before. Am I missing something?

17:39 ,(take (count [1 2 3 4 5]) (iterate rest [1 2 3 4 5])))

17:39 clojurebot: ([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5))

17:42 TimMc: &(take-while seq (iterate rest [1 2 3 4 5]))

17:42 lazybot: ⇒ ([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5))

17:49 konr: Is there any particularly good resource on clojurescript you guys recommend?

17:51 dnolen: konr: nothing besides what's available online at the moment - there's an O'Reilly book on the way.

17:51 S11001001: thorbjornDX: filter

17:51 then...

17:57 konr: dnolen: thanks!

17:57 This tutorial looks pretty cool: http://clojurescriptone.com/

17:59 technomancy: if you're running leiningen from git, please pull the latest master

17:59 I think we're ready to cut a preview9 release and want to make sure any issues are caught

18:00 dnolen: konr: it is! though very specific to CLJSOne

18:00 scottj: dnolen: who's writing the cljs book?

18:00 dnolen: http://shop.oreilly.com/product/0636920025139.do

18:01 Raynes: dnolen: When do you think you might have a chance to take a look at that cljs -> node issue I had? Someone posted a patch that he didn't seem confident about, but some feedback would probably be great.

18:02 dnolen: Raynes: maybe? sometime this weekend - I looked over it quickly. Seems like just reordering the deps right?

18:02 Raynes: dnolen: Yep.

18:03 Once again, I'd help out, but I'm still sorting out CA stuff. :(

18:03 dnolen: Raynes: does the patch work fro you?

18:03 Raynes: I didn't apply it. I have no idea how to set up cljs without cljsbuild.

18:03 I can give it a shot this weekend, I suppose.

18:05 tomoj: Raynes: what I do is just symlink /vendor/clojurescript to my clojurescript clone, then in /project.clj :source-paths ["vendor/clojurescript/src/clj" "vendor/clojurescript/src/cljs"]

18:05 dnolen: Raynes: you just need to set up checkouts

18:05 Raynes: Bleh.

18:06 emezeske: Raynes: The info on how to do that is in wiki form: https://github.com/emezeske/lein-cljsbuild/wiki/Using-a-Git-Checkout-of-the-ClojureScript-Compiler

18:06 Raynes: :)

18:06 Raynes: You aren't helping me get out of doing stuff.

18:07 dnolen: Raynes: no sirree

18:07 cemerick: Holy unrepeatable build, Batman.

18:07 emezeske: Heh, I can't do that, but I can try to make it easier when you have to :)

18:08 cemerick: Adding a project.clj to the cljs source tree and then symlinking the whole mess to be a checkout dep of your project would avoid the :source-paths faffery, right?

18:10 dnolen: cemerick: you tell us ;)

18:10 cemerick: dnolen: I can just barely rub two cljs sticks together at the moment. Be with you soon. :-)

18:11 On that note, it's screwy that I can grok the compiler and such, but the mechanics of things often escape me.

18:13 * nDuff boggles at the idea of Raynes not having a CA signed

18:14 Raynes: nDuff: I do, but it is under a different name.

18:14 nDuff: Ahhh.

18:14 Raynes: Don't ask.

18:16 osener: hi everyone! I just pushed the initial commit of a helm source for nrepl

18:16 would love to have some early feedback

18:16 https://github.com/osener/helm-nrepl/

18:17 (I actually don't know elisp, not sure if it is apparent...)

18:18 helm is a completion framework for Emacs btw

18:18 available actions are "insert symbol", "show documentation", "jump to definition"

18:18 cemerick: emezeske: BTW, do let me know what if anything I can do to make it so that lein-cljsbuild's REPL support can be significantly simplified. I'd hope it end up being a hook to add piggieback middleware and then delegate to leiningen.repl with some init expressions, etc.

18:18 osener: I plan to add a namespace browser in near future

18:20 emezeske: cemerick: Ooh, the middleware being something that writes out javascript to connect to the port 9000 server or whatever?

18:22 cemerick: emezeske: Not at present; right now, Piggieback just makes it so that a cljs REPL can be hoisted on top of Leiningen (or any other nREPL-based tool). So, you'd get the terminal and I/O stuff out of your hair immediately, and hopefully benefit from cljs code completion when that lands in reply and lein.

18:22 But, I'm all for making this stuff easier and minimizing the aggregate amount of code needed to do so. :-)

18:22 https://github.com/cemerick/piggieback if you haven't seen it

18:26 emezeske: cemerick: Ahh, I hadn't seen it, cool

18:26 thorbjornDX: S11001001: let me know if this is awful somehow: (fn lst [l] (first (first (filter #(= 1 (count %)) (take (count l) (iterate rest l))))))

18:27 emezeske: cemerick: I'll have to read up -- it's been a while since I gave much thought to repl stuff in cljsbuild. It is pretty bad right now.

18:28 S11001001: thorbjornDX: replace that filter #... with remove next, and the take is unnecessary

18:29 cemerick: emezeske: well, hopefully you can slash and burn a bunch of code in the process. Anyway, let me know what I can do to help along the way.

18:29 emezeske: cemerick: Sweet, thanks!

18:29 S11001001: thorbjornDX: there should be no calls to count left when you're done

18:30 thorbjornDX: S11001001: I'll give it a shot, thanks for the feedback

18:39 Cr8: psh, i reccommended a logging library the other day and now I need it and can't remember the name

18:39 technomancy: timbre?

18:39 Cr8: that was it

18:39 SegFaultAX|work2: Has anyone used Misaki?

19:02 mefesto: so i just switched from ubuntu to osx. i know nothing about osx and have been fumbling around all day. to get my clojure dev setup going i have installed xcode (cli tools), xquartz, and homebrew. through homebrew i installed emacs with the cocoa flag. is this a good option or is there a better one for me to try?

19:02 brehaut: wait, to get clojure installed‽

19:03 casion: mefesto: that's the best option in my experience

19:03 Cr8: hm

19:03 brehaut: http://emacsforosx.com

19:03 Cr8: getting a NullPointerException when lein tries to AOT compile my :main file

19:03 brehaut: and when you try to run lein self-install for the first time, the OS should prompt you to install java

19:03 mefesto: casion: great, glad to hear i haven't wasted all day :)

19:04 brehaut: already have java7 going and leiningen

19:04 brehaut: then emacsforosx should cover the rest for you

19:04 casion: mefesto: just install clojure mode, paredit, clojure

19:04 and you're about done

19:04 mefesto: brehaut: awesome, thanks for the reference

19:04 casion: yeah i have that plus nrepl going so i think im good

19:05 my main concern was homebrew + emacs with cocoa flag

19:05 casion: mefesto: I find the homebrew emacs more useful with the NS extensions

19:05 than emacsforosx

19:05 mefesto: casion: NS ext?

19:05 casion: mefesto: --cocoa

19:05 mefesto: ah i see

19:06 cored: hello everyone

19:06 I'm new to clojure

19:06 mefesto: i was hesitant to get this machine but after using it all day im pretty happy. only minor gripe is that i miss having a right side control key

19:06 cored: and getting some problems with a piece of code, let me show you

19:07 https://gist.github.com/3430574

19:07 that's the code

19:07 and this is the error

19:07 CompilerException java.lang.RuntimeException: No such namespace: clojure, compiling:(/home/homer/code/clojure/word.clj:2)

19:07 any suggestion?

19:07 mefesto: is it possible to remap the right side command and alt keys to mimic alt, ctrl respectively?

19:08 cored: is clearly that it doesn't find the clojure namespace but I thought that was part of the CLASSPATH is that exists in Clojure world

19:09 Cr8: mefesto: yes. Hit modifier keys in keyboard preferences: http://drop.crate.im/System_Preferences-20120823-160634.png

19:09 nDuff: cored: maybe you're thinking clojure.core?

19:09 nz-: Cr8: why are you using refer here?

19:09 mefesto: Cr8: thank you!

19:09 nz-: d

19:09 technomancy: cored: setting CLASSPATH is strongly discouraged

19:10 nz-: s/Cr8/cored/

19:10 mefesto: Cr8: oh this is system wide? i was hoping for something emacs only

19:11 cored: technomancy: I see

19:11 nz-: I'm following this series http://writingcoding.blogspot.com/2008/06/tokenization-part-4-organization.html

19:11 nz-: he use refer there, when talking about code organization

19:12 technomancy: wow, over four years old

19:12 cored: technomancy: the series?

19:12 well yes

19:12 but I thought that probably stuffs haven't change that much

19:12 :-)

19:12 Raynes: You've probably found the worst possible thing you could read.

19:12 brehaut: technomancy: blogs are always kept relevant!

19:12 technomancy: that's like from before the dawn of time in clojure years

19:12 Raynes: 4 years ago Clojure pretty much didn't exist, cored. Everything has changed.

19:13 cored: shits

19:13 Cr8: huh

19:13 i apparently can't AOT compile a ns that uses timbre :{

19:13 wmealing_: the logger ?

19:13 cored: I just wanted something like https://github.com/thoughtbot/trail-map/blob/master/trails/ruby.md

19:13 wmealing_: Cr8: man i was looking forward to using that..

19:13 cored: but for Clojure

19:14 brehaut: its not just from the dawn of clojure time, it predates technomancy's announcement on the ML that he had made everything better

19:14 Cr8: well i might be doing something exceedingly dumb

19:14 I haven't figured it out yet.

19:14 cored: something to follow up

19:15 Frozenlo`: "Error: problem requiring leiningen.js hook

19:15 Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/js__init.class or leiningen/js.clj on classpath:" What's this leiningen.js?

19:15 wmealing_: Cr8: if you do.. let me know because i am keen.

19:15 Raynes: technomancy: https://groups.google.com/d/msg/clojure/gBoCUXq37fM/841iHii--2IJ You were so cute back in 2008.

19:15 2009*

19:15 technomancy: Raynes: the chat logs from the day I joined this channel are a real blast too

19:16 Raynes: technomancy: Gib

19:16 technomancy: "what's this classpath thing? it smells like bullshit."

19:16 brehaut: haha

19:16 cored: so, guys what do you suggest for a beginner ?

19:17 grab a book and start from there?

19:17 mefesto: lol

19:17 technomancy: ~volkmann

19:17 clojurebot: volkmann is probably the best free introduction to the Clojure language: http://java.ociweb.com/mark/clojure/article.html

19:17 technomancy: ~beginner's guide

19:17 clojurebot: Cool story bro.

19:17 technomancy: ~brief beginner's guide

19:17 clojurebot: I don't understand.

19:17 Raynes: Clojure Programming would be a great place to start if you were willing to throw some green at learning Clojure.

19:18 cored: Raynes: what :-/

19:18 technomancy: if you want something free, try the volkmann tutorial or the brief beginner's guide

19:18 otherwise, clojurebook.com

19:18 Raynes: The volkmann article is ancient but the troll under the bridge keeps it up to date, it's pretty amazing.

19:18 cored: I will read everything

19:18 I find :-)

19:18 Raynes: Except blog posts.

19:18 cored: ok, except blog posts

19:18 Raynes: Seriously, ignore them all. Even if they're mine. Especially if they're mine.

19:18 cored: well if they are from this year I think that's ok, right Raynes ?

19:19 Raynes: Maybe.

19:19 cored: I was considering in getting, the joy of clojure, practical clojure and programming clojure

19:19 Raynes: Make sure you avoid stuff by brehaut.

19:19 brehaut: if a blog says its from 2012 its wrong, if its earlier, its wrong and out of date

19:19 (inc raynes)

19:19 lazybot: ⇒ 15

19:19 jkkramer: I learned a lot from watching the early clojure / rich hickey videos. not sure how dated they are now, though

19:19 Raynes: <3

19:19 cored: brehaut: :-)

19:19 Raynes: As dated as dated gets.

19:19 cored: brehaut: how can you anybody be up to date with Clojure?

19:20 Raynes: How can that sentence be reworded to make sense?

19:20 :p

19:20 cored: haha

19:20 how can anybody be up to date with Clojure, now a days

19:20 thorbjornDX: Raynes: is Clojure Programming (the book) any good?

19:20 Raynes: They can be Rich Hickey.

19:20 SegFaultAX|work2: thorbjornDX: It's very good, yes.

19:21 Raynes: thorbjornDX: It is the latest and greatest. I haven't read the whole thing personally, but I trust cemerick's ability to make awesome.

19:21 Frozenlock: cored: You could consider lurking here. I'm always amazed by the little gems that can be discovered. Just by checking other problems/solutions :)

19:21 SegFaultAX|work2: thorbjornDX: Alongside Joy of Clojure.

19:21 splunk: Programming Clojure is also really good

19:21 thorbjornDX: SegFaultAX|work2: Okay, I'm digging into chapter 1 of prog clojure, I'll have to check out the other one you suggested

19:21 cemerick: Raynes: blasphemer!

19:22 cored: Frozenlock: :-)

19:22 splunk: I'm waiting for a book that goes beyond just introducing the language

19:22 cored: I found this: http://learn-clojure.com/

19:22 Raynes: splunk: It's called The Joy of Clojure.

19:22 And it has been available for quite a while now.

19:22 Cr8: mm

19:22 its not timbre, its spyglass

19:22 SegFaultAX|work2: splunk: What are you looking for, specifically?

19:22 splunk: Raynes: eh...it didn't change my perspective as much as SICP for example

19:23 These are good questions. Thinking...

19:23 cored: also, this http://www.youtube.com/watch?v=Aoeav_T1ARU&list=PLAC43CFB134E85266&feature=plcp

19:23 SegFaultAX|work2: splunk: SICP is a completely different kind of book with a completely different goal.

19:23 cored: but those videos are from three years ago, so probably won't do me any good

19:23 shawnlewis: is there convention for naming locals that would collide with something that's already in the current namespace? For example in python I might name a local "file_" instead of "file"

19:24 technomancy: cored: the videos are generally more abstract, and thus a lot less likely to get out of date

19:24 cored: it's the "type this stuff in at the command line; use this IDE integration" stuff where everything breaks horribly

19:24 brehaut: not to mention people doing videos / presentations put more work into them than blog posts often get

19:24 cored: technomancy: I see, I found a presentation from Neal Ford I thought he was into Scala but now he is with Clojure, one of my personal heroes :-)

19:25 SegFaultAX|work2: Argh, Scala.

19:25 Raynes: $kill

19:25 lazybot: KILL IT WITH FIRE!

19:27 cored: hehe

19:27 well I saw him talking about it, don't know where but he was

19:27 but now he is talking about a plan for enterprise domination with Clojure, which is cool

19:30 ToxicFrog: ...wow, I had no idea Scala was so reviled here.

19:30 Raynes: technomancy: http://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants Says that leiningen uses ant.

19:30 ToxicFrog: It isn't.

19:30 technomancy: Raynes: hah; I hope not

19:31 Raynes: technomancy: No, it seriously does.

19:31 technomancy: Raynes: you mean http://en.wikipedia.org/wiki/Leiningen_(software) I think

19:31 Raynes: technomancy: Look under 'See also'

19:31 technomancy: oh, heh

19:31 you're right

19:31 cored: what do you guys think about the clojure katas?

19:31 technomancy: Raynes: that's dumb; it should just link to the disambiguation page at the top I think

19:32 from the talk page: "Awesome story... just awesome. I hope someone makes a defend the castle type game of this story."

19:55 davejacobs: did compojure get rid of magic variables?

20:00 SegFaultAX|work2: I'm looking for a function similar to group-by, except it simply paritions a collection into 2 lists: those true for the predicate, and those false for the predicate.

20:00 Does such a thing already exist?

20:03 shaungilchrist: not that I am aware of - but if you create it will you please call it dichotomize-by

20:03 * wmealing_ has an idea of how to do it in function.

20:04 wmealing_: would partition-by work ?

20:04 SegFaultAX|work2: shaungilchrist: Deal.

20:04 duck1123: davejacobs: I'm not sure what it's called, but I think there's a fn that gives access to the request

20:05 that may only be in noir, i don't use it

20:05 shaungilchrist: are clojurescript questions appropriate here?

20:05 nDuff: shaungilchrist: Yes.

20:05 shaungilchrist: I have latest lein and it no longer has a bootstrap task so the clojurescriptone instructions do not work

20:06 should I just get older version of lein or is there a newer way of accomplishing same thing?

20:06 nDuff: shaungilchrist: ...you've hit on part of why folks tend to keep "lein1" around, even if under a different command.

20:06 tmciver: SegFaultAX|work2: there used to be something like that in a contrib library but you could do something like ##((juxt (fn [x] (filter even? x)) (fn [x] (filter odd? x))) [1 2 3 4 5])

20:06 lazybot: ⇒ [(2 4) (1 3 5)]

20:07 technomancy: shaungilchrist: using clojurescript without cljsbuild is kind of a pain

20:08 shaungilchrist: yeah I just got lein 1.6 and bootstrap is running fine now

20:09 checking out lein-cljsbuild now though

20:09 tmciver: SegFaultAX|work2: amalloy's is even better: (def split-pred (juxt filter remove))

20:10 SegFaultAX|work2: Ah, it was called 'separate' in clojure.contrib

20:11 SegFaultAX|work2: tmciver: I'm not sure I understand (juxt filter remove)

20:11 technomancy: oh, you're in for a treat

20:11 juxt is the best

20:11 SegFaultAX|work2: technomancy: I understand juxt, I think.

20:12 But I don't understand that use of filter.

20:13 Oh wait, I understand.

20:13 tmciver: SegFaultAX|work2: you'd have to pass it your pred and your collection: ##((juxt filter remove) even? [1 2 3 4 5])

20:13 lazybot: ⇒ [(2 4) (1 3 5)]

20:13 SegFaultAX|work2: That's pretty cool.

20:14 ,((juxt filter remove))

20:14 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$filter>

20:17 SegFaultAX|work2: Juxt is really awesome.

20:17 davejacobs: duck1123: sorry, missed your msg

20:18 i think if you use compojure.handler/site over your app-routes, they are supposed to get the magic variables

20:18 however, that's not working out for me. (looks from the source code like it should)

20:18 the Internet-at-Large says that magic variables should be bound inside the defroutes macro by default...

20:24 rafik: Hello, I have what seems like a simple question but I can't figure it out. I need to get the values from a map in a specified order. So something like (get-values map [:a :b]). But I need the values return to be in that order. Any hints?

20:26 imeredith: rafik: usually maps are sorted because it helps with lookup time

20:26 (im not a clj person so i could be wrong with clojure)

20:27 tmciver: I don't think you can rely on any ordering with a normal clojure map.

20:27 tanzoniteblack: rafik: clojure maps are either based on a hash-map or a sorted-map

20:27 Frozenlo`: rafik: If you really just want to get them in a particular order: (map #(get MAP %) [:first-key :second-key :third-key...])

20:28 rafik: ah ok so get can take a vector of keys

20:28 jeremyheiler: ,(map (partial get {:a 1 :b 2}) [:a :b])

20:28 clojurebot: (1 2)

20:28 jeremyheiler: doh, Frozenlo beat me to it

20:28 rafik: oh nvm

20:28 tmciver: ,(map {:b 2 :c 3 :a 1} [:a :b :c])

20:28 clojurebot: (1 2 3)

20:29 jeremyheiler: oh yea, maps are functions too

20:29 Frozenlo`: Can't believe I forgot that.

20:29 rafik: tmciver: Oh wow, that's incredibly simple and makes complete sense

20:29 Thank you guys :)

20:30 jeremyheiler: Thank you!

20:31 SegFaultAX|work2: How can I improve my implementation of quicksort? https://www.refheap.com/paste/4597

20:32 wmealing_: shaungilchrist/Segfault: i was waiting for a compile. is this what you meant ? http://hastebin.com/pomorececi.coffee

20:32 SegFaultAX|work2:rather

20:32 rafik: Could someone actually quickly explain how that worked? How do you use map on a map like that. They are functions?

20:33 Frozenlock: rafik: Keys are functions of a map, and vice-versa.

20:33 jeremyheiler: ,({:a 1} :a)

20:33 clojurebot: 1

20:33 jeremyheiler: ,(:a {:a 1})

20:33 clojurebot: 1

20:33 jeremyheiler: (get {:a 1} :a)

20:33 tmciver: SegFaultAX|work2: I don't think you actually need that juxt separate, try split-with.

20:33 jeremyheiler: ,(get {:a 1} :a)

20:33 clojurebot: 1

20:34 Frozenlock: Magnificent, isn't it? :P

20:34 tmciver: ,(doc split-with)

20:34 clojurebot: "([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]"

20:34 jeremyheiler: yes yes

20:34 rafik: Frozenlock: Oh neat! Thanks for the help

20:35 SegFaultAX|work2: ,(split-with (partial < 10) (shuffle (range 20)))

20:35 clojurebot: [(18) (10 1 14 13 11 ...)]

20:35 tmciver: SegFaultAX|work2: hmm, no, that's not right. disregard me.

20:35 Frozenlock: I don't think I've used `get' a single time since I discovered this relation.

20:35 jeremyheiler: Frozenlock, I've had to use it when I'm stuck with string keys

20:35 Frozenlock: Well except just here.

20:35 SegFaultAX|work2: tmciver: I made that assumption, too. I realized I needed a partition function. Unfortunately none of the existing partitions match this use case.

20:36 tmciver: That's why I asked if this function already existed.

20:36 Frozenlock: jeremyheiler: I usually do ((keyword "a") {:a 1}) o_O

20:36 SegFaultAX|work2: (Didn't want to re-invent what might already be there by a different name)

20:36 tmciver: SegFaultAX|work2: but you're already re-inventing sort with that function. ;)

20:37 SegFaultAX|work2: tmciver: Don't tell anyone. :)

20:37 jeremyheiler: Frozenlock, I mean I would have to do (get {"a" 1} "a")

20:37 tmciver: Your secret is safe with me.

20:37 Frozenlock: Oh, string as a key!

20:37 Why the hell? :)

20:38 ,(name :so-easy-to-get-string-later)

20:38 clojurebot: "so-easy-to-get-string-later"

20:39 jeremyheiler: heh, it's not always worth translating the map of string keys to keyword keys.

20:40 Frozenlock: YES! Yes it is! ArrrAAARRR!

20:40 SegFaultAX|work2: Is there a function specifically to turn a list of char into a string? Eg (apply str (\f \o \o))?

20:40 jeremyheiler: lol

20:40 SegFaultAX|work2: Seems like a common enough usecase.

20:40 tmciver: SegFaultAX|work2: nope, that's it.

20:40 SegFaultAX|work2: Boo.

20:41 tmciver: at least, I don't think there is.

20:41 Frozenlock: (defn stringify [& rest] (apply str rest))

20:41 jeremyheiler: str using a StringBuilder, so it's cool

20:41 SegFaultAX|work2: Frozenlock: I know how to do it. Again, I just don't want to re-invent something that might already exist.

20:41 Frozenlock: jeremyheiler: bullseye, again.

20:41 jeremyheiler: uses*

20:43 Frozenlock: Wasn't there `logic', or something like it, to check if we where reinventing the wheel?

20:44 SegFaultAX|work2: Frozenlock: Is it illogical to assume that such a thing might already exist?

20:44 duck1123: it doesn't have all the wheels, but check out kibit

20:45 Frozenlock: SegFaultAX|work2: No, I mean, the package `logic'

20:45 That wasn't an insult at all :)

20:45 https://github.com/clojure/core.logic (but I don't know how to use it)

20:47 * Frozenlock successfully used a javascript library with cljs

20:47 Frozenlock: Yeah, achievements, I has zhem!

20:56 mefesto: I'm trying to get color-theme working on my system (OSX 10.8). I

20:56 installed emacs with homebrew and everything else seems to be fine.

20:56 I'm unable to install any other color-theme packages from marmalade.

20:56 It complains that I have color-theme 6.5.x when I need 6.6.x. Any

20:56 ideas (I'm new to OS X)?

20:56 ugh, im sorry about that :(

20:56 cut & paste gone wrong.

20:58 clj_newb_27892: how do I use macros in clojurescript

20:58 this is baffling me

20:58 so do I define them in a *.cljs file or a *.clj file, and do they go in cljs-src/* or clj-src/* ?

21:00 * Frozenlock is listening for this answer as well

21:00 emezeske: clj_newb_27892: You define them in a *.clj file

21:00 clj_newb_27892: where do I put them?

21:00 emezeske: clj_newb_27892: They can go in clj-src OR cljs-src, as long as they're on the classpath you're good

21:01 clj_newb_27892: hmm

21:01 okay

21:01 let me try

21:01 emezeske: clj_newb_27892: And make sure you use :require-macros instead of :require

21:01 clj_newb_27892: I'm using :use-macros

21:03 boyscared: how does one increase the timeout when running `lein repl'? my slow computer always gets REPL timeout errors :(

21:04 clj_newb_27892: what is this "lein timeout" ?

21:04 I've never heard of it.

21:05 boyscared: whenever i run `lein repl' on my netbook, i get "REPL server launch timed out."

21:05 it's just because it takes so long

21:09 nevermind, found it... it's :repl-options {:timeout x}

21:15 clj_newb_27892: this is a question about fishing, not a single fish: how do I get lein to tell me what the latest version of clojruescript is? I'm currently using [org.clojure/clojurescript "0.0-1236"] ... and I think this is part of my woes.

21:16 jeremyheiler: you can look it up on search.maven.org

21:16 http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojurescript%22

21:17 clj_newb_27892: why does the 1450 branch not show up on my "lein search clojurescript" ?

21:21 okay

21:21 somethign appears to work

21:22 thanks :-)

21:23 jeremyheiler: it shows up for me. maybe you need to refresh your local index? anyway, glad stuff is working.

21:25 clj_newb_27892: classpath, clean, compile, deploy, deps, help, install, interactive, jar, javac, new, plugin, pom, repl, retest, run, search test, test! trampoline, uberjar, upgrade, version <-- which one of these updates my local index?

21:25 oh, lein search --update hehe

21:26 lein search clojurescript Warning: couldn't download index for http://repo1.maven.org/maven2

21:26 hmm mauyb ethat is why it does not work for me

21:26 lein version Leiningen 1.7.1 on Java 1.7.0_05 Java HotSpot(TM) 64-Bit Server VM

21:26 what version of lein are you using?

21:27 jeremyheiler: 2.0.0-preview8

21:32 Frozenlock: Is there any other in-browser REPL?

21:32 (except himera)

21:39 ibdknox: wow

21:39 did you guys see the thread on fogus's blog post about snippets?

21:41 amalloy: ibdknox: i saw it this morning with about ten comments, has it exploded further?

21:41 ibdknox: amalloy: it's at 15, but you probably saw most of it

21:42 I'm just astounded by the bile in rich's responses

21:42 amalloy: i agree, it's nuts

21:42 ibdknox: fogus is absolutely correct

21:42 it is very important if only to provide a frame for what someone is looking at

21:42 amalloy: it's trivial to write a compelling snippet for clojure

21:42 ibdknox: I completely disregarded clojure for several months because of clojure.org

21:42 shaungilchrist: I get the feeling his bile is not directed at fogus but more at the general dumbing down/selling of languages

21:43 ibdknox: shaungilchrist: it's not a matter of dumbing it down, its a matter of providing a reference point

21:43 Frozenlock: ibdknox: could you post the link?

21:43 ibdknox: he's clearly never marketed anything

21:43 Frozenlock: http://blog.fogus.me/2012/08/23/minimum-viable-snippet/

21:43 Frozenlock: Thank you very much!

21:43 ibdknox: datomic suffers from a similar fate :(

21:44 Frozenlock: datowhat? :)

21:44 ibdknox: lol

21:44 shaungilchrist: yeah I actually agree - if I wasn't already "into" lisp clojure would not entice me

21:46 clj_newb_27892: is Rich Hickey the most brilliant systems engineer since the turing award winners?

21:46 ibdknox: lol

21:48 clj_newb_27892: I'm not kidding. Clojure has the brilliance of: functional data structures that actually works; the sending of agents _functions_ rather than _values_ is brilliant. I haven't figured out the brilliance of datomic yet, but I suspect it's sheer brilliance.

21:48 That said, I don't think he'll win the turing given it's not "theoretically new enough"

21:51 that said, I thikn fogus is absolutely right on the minimum vialbe snipplets

21:52 amalloy: personally i'd love to see the solution to project euler #2 (sum of even fibonacci numbers less than four million) on clojure.org. the simplicity is so captivating

21:53 i always use that to introduce folks to the dramatically reduced intermingling of "business logic" with bookkeeping code that clojure and FP bring

21:54 Frozenlock: Learning Clojure is for the masochists. No clear example on clojure.org. Still a (relatively) small community, absolutely no great tutorial to get started on the spot. (You can't get someone started on Clojure by telling him "Oh just use Emacs." If he's not already a user, that's just insulting.) Then there's the eternal `contrib' found in so many examples, yet which is now non-existent. Oh and everything assumes that you know java

21:54 javascript for cljs.

21:54 I am a masochist.

21:55 ibdknox: I disregarded clojure for several months because of this: http://www.loper-os.org/?p=42

21:56 clj_newb_27892: Frozenlock: I thought learning Clojure was hard. They I tried writing a realtime webchat in ClojureScript w/ websockets despite not knowing CSS, HTML, JavaScript, or web standards.

21:57 ClojureScript's code is the documentation.

21:57 oh, I forgot to mention _via_ Google Closure library ... taht made it extra fun

21:57 ibdknox: Frozenlock: wow.. that is impressively angry

21:57 clj_newb_27892: [/end bragging]

21:57 Raynes: Frozenlock: That guy is the biggest running joke we have in the Clojure community.

21:58 Frozenlock: Raynes: The guy from LoperOS?

21:59 casion: "The Clojure user who is missing some routine or other will run crying to Java for help"

21:59 ahahahaha

21:59 Raynes: Frozenlock: Indeed.

21:59 casion: this post is hilarious… it's sattire right?

21:59 I'm just going to assume it is so I can sleep easy

21:59 TimMc: casion: Hard to tell sometimes with LoperOS.

22:00 Frozenlock: clj_newb_27892: Clojure code is clear. However the slope is quite steep for those in this channel who are not geniuses, ie me.

22:00 casion: I'm pretty far removed from every clojure is, I don't use java much, I've never used lisp, I've never programmed functionally

22:00 but I find clojure code very easy to read

22:00 clj_newb_27892: truth be told, I started with haskell before Clojure ... then decided, at first, taht Clojure was not learning because Haskell convinced me I was not smart enough for functional programming

22:01 casion: solving things in clojure on my own though..

22:01 clj_newb_27892: then, by accident, I realized Clojure was closer to scheme than Haskell in the IQ-required category

22:01 casion: I find that very fiddicult due to the afforementined reasons

22:01 Frozenlock: casion: he has a valid point. How do you parse numbers in clojure? You call an obscure java method :)

22:02 Well obscure for me at least.

22:02 amalloy: &(read-string "23490235")

22:02 lazybot: ⇒ 23490235

22:02 Frozenlock: Wut

22:03 Wait what....

22:03 Iceland_jack: Couldn't `int' also parse strings into integers though? E.g. (int "242" 9) ⇒ 200

22:03 amalloy: Iceland_jack: couldn't "+" implicitly accept strings as well? you have to draw the line somewhere

22:03 ibdknox: Frozenlock: I think that is because Clojure has not yet been correctly presented for beginners. Not because of the language itself

22:04 Iceland_jack: I suppose, but there is a reason why + doesn't accept strings as well

22:04 amalloy: and same for int, of course

22:04 * brehaut has a PHP flashback

22:04 Iceland_jack: Well + accepting strings and integers would make it non-associative, i.e. (+ "hi" 2 5) could just as well return "hi7" and "hi25"

22:04 Frozenlock: amalloy: Omg I love you! I don't know why, everyone I saw was always using float.parse or something like that!

22:05 I won't feel dirty anymore!

22:05 TimMc: Frozenlock: read-string is a little weird for that, though.

22:05 &(doc *read-eval*)

22:05 lazybot: java.lang.SecurityException: You tripped the alarm! *read-eval* is bad!

22:06 TimMc: Careful with read on user input.

22:06 amalloy: Iceland_jack: i didn't imagine it would perform string concatenation. (+ "3" 5) could easily return 8

22:06 Frozenlock: ibdknox: Don't get me wrong, the language is GREAT. I'm doing more with it than I would with anything else. But some corner can be... wilder. Places where the underlying language isn't totally abstracted away.

22:07 amalloy: but it doesn't, because that would be bad, just like int being loose about what types it accepts

22:07 Iceland_jack: Hm maybe, I just feel something like Python's `int' is really the way to go

22:08 Frozenlock: I don't want to imagine how it was before leiningen....

22:08 Iceland_jack: I prefer Clojure to something like Common Lisp by a mile but I dislike the amount of Javaisms at times, Integer/parseInt…

22:08 brehaut: Iceland_back: type(int) #=> <type 'type'>

22:09 Iceland_jack: so the equivalent in clojure is to use javas Integer class

22:09 ,(Integer "123")

22:09 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Expecting var, but Integer is mapped to class java.lang.Integer>

22:09 brehaut: bah

22:10 Frozenlock: Oh.. `read-string' doesn't exist in cljs yet :(

22:10 brehaut: ,(Integer. "123")

22:10 clojurebot: 123

22:10 Iceland_jack: Hm, only that doesn't work with different bases

22:11 brehaut: ,(Integer/parseInt "AB" 16)

22:11 clojurebot: 171

22:11 brehaut: its not rocket surgery; just look at the javadoc

22:12 Iceland_jack: Yeah I know how to do it :) it's an aesthetic nitpick

22:13 brehaut: i have a nitpick with python not allowing unboxed ints, so lets call it even ;)

22:13 Iceland_jack: Fair enough

22:14 Clojure is a beautiful language, and the Java interop is a(n almost) neccessary part of it

22:17 clj_newb_234: wtf ... is (:selector hashmap) broken in clojurescript? i.e. (def x {:first "Alexander" :last "the Great"}) (:first x)

22:18 tomoj: incidentally (int "3") works in cljs :/

22:18 because (Math/floor "3")

22:19 also (= (+ 1 "1") (+ "1" 1) "11") ...

22:20 (pos? "1")

22:20 ibdknox: clj_newb_234: no, that's not broken

22:21 clj_newb_234: ibdknox: it is broken for me

22:21 what version of clojurescript are you using?

22:21 i'm using 0.0-1450

22:21 it worked back when I was using 0.0-12??

22:21 lazybot: clj_newb_234: What are you, crazy? Of course not!

22:21 ibdknox: I'm using something around there

22:22 I track master, but I'm a little behind

22:22 clj_newb_234: exact code?

22:22 clj_newb_234: let me produce a minimal example with corresponding javascript

22:23 ibdknox: http://pastebin.com/zK6HFVAz

22:24 Error: Uncaught TypeError: undefined is not a function

22:24 I need to becareful here. If not, I might end up being useful to the clojure community rather than being a leech.

22:25 I ahve no optimization flags; I do have :pretty-print true

22:25 Frozenlock: clj_newb_234: Works for me.

22:25 clj_newb_234: Frozenlock: can you pastebin the generated javascript code you get?

22:25 Frozenlock: No, I simply tested it in my REPL...

22:25 ibdknox: clj_newb_234: what line is that error on?

22:26 clj_newb_234: Frozenlock: We're testing ClojureSCRIPT, not Clojure ...

22:26 Frozenlock: Yes, my cljs repl

22:26 clj_newb_234: ibdknox: line 116 -- should I paste the entire genrated file?

22:27 ibdknox: clj_newb_234: I'm more wondering which of the two generated lines it's on

22:27 clj_newb_234: oh; the "return" line

22:27 ibdknox: clj_newb_234: the first call or the second?

22:27 clj_newb_234: the second call

22:27 ibdknox: swap the order of the two call

22:27 s

22:27 and see what happens

22:28 clj_newb_234: it still dies on the (:first x) line

22:28 tomoj: so, what, theKeyword.call is undefined?

22:28 ibdknox: cljs.core.Keyword doesn't exist?

22:28 clj_newb_234: tomoj: I believe the problem is trying to use th ekeyword as a function.

22:29 ibdknox: how can I test taht?

22:29 ibdknox: using chrome?

22:29 clj_newb_234: (js/console.log "printing keyword") (js/console.log cljs.core.Keyword)

22:29 outputs "undefined"

22:29 yes, using Chrome

22:30 ibdknox: do lein cljsbuild clea

22:30 n

22:30 sounds like your core.cljs got hosed somehow

22:30 tomoj: how would a Keyword have a call anyway?

22:31 clj_newb_234: restarting web server ....

22:31 (:keyword x m) should ge equiv to (get m :keyword)

22:31 tomoj: I thought implementors of IFn don't get auto-promoted to real js functions

22:31 clj_newb_234: still does not work

22:32 amalloy: tomoj: dnolen added some tricks in the compiler, so that calling a keyword literal as a function is extra-smart somehow. i don't recall the details

22:32 clj_newb_234: same error: cljs.core.Keyword is apparently still undefined

22:32 what version of clojurescript are you guys using?

22:32 tomoj: also I notice in my core.cljs (deftype Keyword [k] IFn (invoke [_ coll] ..))

22:32 clj_newb_234: I'm happy to upgrade. :-)

22:32 tomoj: but IFn has only -invoke

22:32 peculiar...

22:33 Frozenlock: I don't remember downloading any particular version... is it contained in cljsbuild?

22:34 clj_newb_234: hmm, I'm unforunately not using cljsbuild

22:34 Frozenlock: No repl an no cljsbuild o_0 you are courageous!

22:35 tomoj: cljsbuild 0.2.5 depends on 0.0-1450

22:35 ibdknox: clj_newb_234: why aren't you using cljsbuild?

22:35 clj_newb_234: i hacked my system so taht when I hit ctrl-l in VIM, cljsbuild is called (via require cljs.build), and then the web browser is remotely restarted

22:36 ibdknox: clj_newb_234: just for kicks and giggles, turn on simple optimizations

22:36 clj_newb_234: actually, after I nuked .repl

22:36 something else is broken,

22:37 {return cljs.core.apply.call(null,Array.,cljs.core.map.call(null,clj__GT_js,x)); (core.js line 68)

22:37 so your intuition is right, something is wront with cljs core

22:37 tomoj: amalloy: I see the bit that emits new Keyword(...).call, but not how Keyword gets a call method

22:44 clj_newb_234: hmm, the following is intereting:

22:44 WARNING: Wrong number of args (0) passed to cljs.core/array at line 115 file:/Volumes/ramdisk/crfx/lib/clojurescript-0.0-1450.jar!/cljs/core.cljs

22:44 wtf, is 1450 broken?

22:45 I'm using clojure 1.4.0

22:45 mindbender1: while I was learning clojure I looked up to a number of people. But now it's clearer to me who's who and those who actually know what they are doing and why they are in clojure in the first place

22:46 clj_newb_234: hmm

22:46 I havefound an offentind pieces of code (wrhtten by me)

22:46 (apply js/Array. (map ...))

22:47 apparently Js/Array. is not the right way to construct an aaray in JavaScript

22:47 how do I create a JavascriptArray ?

22:47 ibdknox: array

22:47 it's a core function

22:48 tomoj: ah, I see, extend-type (which is called by deftype) notices IFn and sets .call and .apply on the prototype

22:48 clj_newb_234: this is completely unsatisfying: but eerything works now

22:48 I really wish I knew _wtf_ I did incorectly

22:49 Frozenlock: ibdknox: Do you know if there's any plan to integrate a function similar to your clj->js from jayq in cljs.core?

22:50 ibdknox: I dunno

22:50 there should be :)

22:50 dnolen is the man to talk to

22:50 or just file an issue

22:50 tomoj: I heard someone say that it is not provided because there is no generally correct answer

22:50 ibdknox: my version from jayq recently became incorrect though

22:51 Frozenlock: How comes? .core changed?

22:51 ibdknox: .strobj is not guaranteed to be there anymore

22:51 since we have for realz persistent datastructures now

22:53 Frozenlock: tomoj: well clojure is almost synonymous with maps. Something MUST be able to convert it to javascript compatible data.

22:53 ibdknox: As long as I don't update I'm safe :)

22:53 tomoj: you may be able to write a conversion function which satisfies you

22:53 maybe ibdknox's would satisfy you

22:54 the claim is something like that there is no one obvious solution that will satisfy everyone

22:55 clj_newb_234: dumb question: is there a way to tell JavaScript: "When I read an undefined variable, don't give me nil. Give me a BIG RED WARNING"?

22:55 this would save me an infinite amount of debugging time

22:55 for some value of infinite

22:56 tomoj: I think you can get that by wrapping your code in `(function(){"use strict";<CODE>})()`

22:56 Frozenlock: tomoj: perhaps. I don't know js, there might be other things than json and arrays that could hold the data as well. Still, Maps are a big part of clojure. If you can't use them easily, it's a big handicap.

22:57 clj_newb_234: tomoj: how do I do that in clojurescript?

22:58 tomoj: there is no better way I know of than e.g. a shell script that adds that wrapper to the compiled output

22:58 (which can be called in cljsbuild's :notify-command

22:58 clj_newb_234: to every *.js file in public/out/ ?

22:59 tomoj: if you use cljsbuild with :output-to you will only get one file

22:59 also I've no clue whether the generated code is strict-friendly..

23:03 and even if you have multiple files you probably only need the strict wrapper in the main file that contains your entry point

23:04 Frozenlock: Anyone tried this? https://github.com/bodil/catnip I'm too lazy to try it myself....

23:05 clj_newb_234: post it as a task to mechanica turk

23:09 yankov: anyone knows how to achieve this? (set! (symbol k) 32)

23:09 need to set a value of var where name of var stored in k

23:10 brehaut: yankov: why are you wanting to set vars programmatically?

23:11 Raynes: Step one: tell you how you don't really want to do this

23:11 Step two: tell you how to do this

23:11 yankov: brehaut: I want to write a simple data structure server as a learning expretiment

23:11 Raynes: Step three: tell you again how you don't want to do this.

23:12 brehaut: yankov: have you considered having a map of keywords to values in an atom?

23:12 amalloy: brehaut: probably symbols to values, imo, but i guess we don't know enough context to be sure

23:13 yankov: brehaut: yes, but I thought i won't be able to have a lot of keywords in a single map? would it be efficient?

23:13 brehaut: lets leave efficency aside; avoiding madness is a better first priority

23:13 yankov: like could I have millions of keys

23:13 amalloy: yankov: a namespace is just a map too

23:14 yankov: amalloy: hm.. really?

23:14 interesting..

23:15 amalloy: it's not an IPersistentMap, but it's not magic either. demanding random access for a million keys is a slight pain either way

23:15 but maps are very fast; just worry about solving your actual problem, not invented subproblems like efficiency

23:15 yankov: but what would be a right way to approach it. say i wanna be able to store millions of keys

23:15 gotcha.. I'll try to dig this way. with maps

23:20 brehaut: ,(count (time (into {} (map (juxt identity identity) (range 1000000)))))

23:20 yankov: oh, let me try :)

23:20 Frozenlock: This time I won't fall for it.

23:20 amalloy: you may not make it in the sandbox time limit, brehaut

23:21 clojurebot: Execution Timed Out

23:21 brehaut: amalloy: looks like it takes about 5 seconds locally

23:21 i wasnt sure what clojurebots limit is

23:21 yankov: took 2 seconds for me

23:22 does clojurebot eval stuff

23:22 ,(+ 1 1)

23:22 clojurebot: 2

23:22 yankov: nice

23:22 amalloy: &(let [m (time (into {} (map (juxt identity identity) (range 1000000))))] (time (count (assoc m 10 20)))

23:22 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

23:22 brehaut: yankov: the number it gives isnt especially useful; if its a hot piece of code the JVM will reoptimize it and it will start running a bunch faster

23:22 amalloy: &(let [m (time (into {} (map (juxt identity identity) (range 1000000))))] (time (count (assoc m 10 20))))

23:22 lazybot: ⇒ "Elapsed time: 2751.355012 msecs" "Elapsed time: 285.904236 msecs" 1000000

23:23 tomoj: huh

23:23 amalloy: 2.5s to build the map makes sense, but 0.2s to update it seems really high

23:23 tomoj: yes

23:23 gc hiccup?

23:24 amalloy: could be. maybe into's use of transients helps a LOT?

23:24 brehaut: its running much faster on my local machine

23:24 amalloy: yeah, same here

23:24 brehaut: 0.03s sort of thing

23:24 amalloy: ~clojurebot

23:24 clojurebot: clojurebot is a cold unfeeling genderless mechanism

23:24 amalloy: damn it, clojurebot, tell me you're not a benchmarking platform

23:24 tomoj: &(let [m (time (into {} (map (juxt identity identity) (range 1000000))))] (time (count (assoc m 10 20))))

23:24 lazybot: ⇒ "Elapsed time: 2085.048106 msecs" "Elapsed time: 222.939766 msecs" 1000000

23:25 brehaut: it is spiking a bunch though; i suspect there is some GCing of all those vectors and seq links going on

23:25 tomoj: &(let [m (time (into {} (map (juxt identity identity) (range 1000000))))] (time (assoc m 10 20)))

23:25 amalloy: brehaut: 0.03s? for me it's like 0.03ms

23:25 brehaut: yeahs orry, ms

23:26 amalloy: tomoj: no good, you've printed it all

23:26 lazybot: ⇒ "Elapsed time: 2353.310162 msecs" "Elapsed time: 321.089554 msecs" {0 0, 32768 32768, 65536 65536, 98304 98304, 131072 131072, 163840 163840, 196608 196608, 229376 229376, 262144 262144, 294912 294912, 327680 327680, 360448 360448, 393216 393216, 425984 425984, 458752 458752, 491520 491520, 5242...

23:26 tomoj: realized that as emacs was freezing up from me having typed it at the repl just before I sent it here :(

23:26 I don't get it

23:27 the assoc is ~10% of the build time, where I see 0.007% here

23:30 maybe it's on a micro ec2?

23:31 brehaut: or the heap size is really low?

23:31 amalloy: oh sure. the heap size *is* small

23:31 he gets 60mb, or maybe 80

23:31 tomoj: why would that make an assoc slow?

23:32 cus GC is just making everything slow?

23:34 amalloy: actually he seems to be accidentally running with a *large* heap, and the machine is swapping. so taht's my analysis

23:35 doesn't explain why building the map is fast, i guess

23:41 yankov: hm, I guess if I have a one giant map atom, if I change value of one keyword and value of other keyword was changed concurrently - that'd screw it up

23:44 cause it'll compare a value of the entire map each time. so if one of the million of keywords was changed then it'll try to rewrite again with the new value

23:44 do i make any sense ...

23:45 jeremyheiler: yankov: thats when you'll probably want to use stm

23:47 yankov: jeremyheiler: yes, and I thought of creating a separate atom for each "key"

23:50 jeremyheiler: ah i see. i suppose it depends if your map is flat or not

23:51 or at least, that the only part you care to "manage" is the first level

Logging service provided by n01se.net