#clojure log - Dec 10 2010

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

0:00 cemerick: technomancy: seems odd -- into works on collections via conj, but strings are scalars

0:02 technomancy: cemerick: it seems like into is the converse of seq

0:03 hiredman: so what does (into "" [{:a 1} {:b 2}]) do?

0:03 and why?

0:03 cemerick: seq isn't an operation

0:04 technomancy: cemerick: I don't follow

0:06 cemerick: That was poor wording.

0:07 `seq` is a polymorphic function that returns a persistent sequential "view" over a collection.

0:07 technomancy: whereas into forces things?

0:07 cemerick: A "converse" of that would have to be able to build up arrays, strings, iterables, etc.

0:08 i.e. that polymorphism is opaque

0:08 technomancy: right; I guess it would be unrealistic to expect everything to be reversible

0:08 cemerick: and unidirectional almost by definition

0:09 technomancy: well, there's good reason you couldn't into any arbitrary iterable

0:09 strings and arrays seem feasible

0:10 but I guess hiredman's point is also valid

0:10 cemerick: There's also the implementation detail.

0:11 into is really just a reduction of conj

0:11 technomancy: if you look at it that way it does start to fall apart

0:11 cemerick: You would not like the result of that with strings.

0:14 technomancy: fair enough

0:23 joshua__: I'm trying to use \d in a clojure regular expression and it is saying that the escape character \d is undefined?

0:25 hiredman: ,"\d"; like this?

0:25 clojurebot: Unsupported escape character: \d

0:25 hiredman: because that just means you aren't in a regular expression

0:25 ,#"\d"

0:25 clojurebot: #"\d"

0:33 amalloy: #"\d"

0:33 whoops, late to the party

0:37 joshua__: Ah... I had done (re-pattern "\d")

0:37 ,(re-pattern "\d")

0:37 clojurebot: Unsupported escape character: \d

0:37 hiredman: ,"\\d"

0:37 clojurebot: "\\d"

0:37 joshua__: Oh.

0:37 Ohhhhhhh

0:37 Thanks!

0:37 hiredman: \ is an escape, so you have to escape it

0:37 inside strings

0:38 joshua__: That was dumb of me =/.

0:39 clj-time was the library that we talked about the last time we talked about working with time units right?

0:40 I'm writing a function right now to convert a Hacker News style timestamp ("(\d+) (minutes|hours|days) ago") to a date. =)

0:42 (Don't do it for me, I'm learning the language =p)

0:42 amalloy: yes, clj-time

0:43 * technomancy grumbles about that getting renamed from "Chrono"

0:44 joshua__: technomancy your the guy who is behind incanter right? =)

0:44 technomancy: no, not me.

0:44 amalloy: leiningen though

0:44 technomancy: that's liebke

0:44 joshua__: oh

0:44 technomancy: I wrote the first rev of clj-time, called chrono, which at one point was part of incanter.

0:45 my version wasn't very good though

0:45 except for the name.

0:46 joshua__: I see.

0:49 cemerick: not having a prefer-method corollary for protocols is *very* unfortunate

0:53 That *almost* makes me want to say that extend-* should only support concrete types, at least until a prefer-* facility is available.

1:16 joshua__: technomancy: do you know if there is a strip function for datetime (like you give it a datetime and it gives you back a date)? Or should I roll one myself?

1:18 Going to make it myself =) Seems simple enough in my head.

1:20 technomancy: I haven't followed it at all--it's been rewritten since I was involved

1:21 joshua__: No problem at all. It actually took me longer to ask you that question than it did to write the function o.0.

1:22 technomancy: nice

1:22 joshua__: Maybe I'm to fast to ask questions. Thing is when I don't I end up spending all day on the problem and you guys figure it out in a second.

1:22 Function to grab the date of a hacker news comment is completed =) woot

1:24 I can't wait to finish this project so I can share it with people. So excited, I think people might actually use it ;P.

1:55 scottj: it's silly that there's no rss feed for comments on an article.

1:56 on HN

2:38 joshua__: Now that I'm digging into Hacker News I'm finding that there are a lot of things that are silly. For example.. "0 minutes ago"..

2:38 omg omg

2:39 Thank God I just said that, my parser might be broken. I confused zero and one.

2:40 cky: "ID01T"? :-P

2:44 joshua__: yes

2:48 For some reason I was under the impression for the last hour that 0 was where you expected a singular, so I thought that the lack of one was an idiosyncrasy. Turns out that 1 is where a singular belongs and is handled just fine. Thankfully, the fix should be pretty easy. Just change the cond to expect a singular form and use (minute|hour|day)s? instead of (minutes|hours|days).

2:49 I hope o.0

2:50 Yep, fixed and working =P

2:50 Programming is so much fun!

2:52 Just a warning to anyone who is doing what I'm dong.. building something on top of Hacker News is extremely hard. It is way too easy to get distracted. I mean seriously imagine if you had to browse reddit to get work done.

2:54 technomancy: it's open source; you could run your own instance and seed it with boring articles =)

2:57 joshua__: technomancy: I think you might have just discovered how lorem ipsum dummy text came to be.

2:57 The original content was just way to distracting ;p

3:04 amalloy: cky: !D10T, perhaps? much easier to pass off as "identity", and as an added bonus actually looks like you can spell :)

3:05 cky: amalloy: It's actually a comment about joshua__'s "confused zero and one".

3:05 amalloy: aha. a little too meta for me, it seems

3:07 joshua__: amalloy: I missed it too. I like it now that I get it though.

3:07 amalloy: cky: go hang out in #mensa, clearly too clever by half for #clojure

3:08 cky: amalloy: Hahahahahahaha.

3:08 (I laughed because I'm a Mensan IRL, but, I don't think they have a strong presence on IRC.)

3:09 joshua__: :-)

3:20 joshua__: Good night all.

4:29 zz_auser: anyone up?

4:40 scgilardi: 'course we are

4:40 technomancy: lies!

4:40 zz_auser: heh

4:41 bobo_: :-(

5:02 zz_auser: anyone have an experience with BlockingQueue (java) from within clojure?

5:03 hiredman: works great

5:03 a++ would block on this queue again

5:03 zz_auser: interesting...

5:03 did you use a :gen-class with BlockingQueue?

5:03 for the worker?

5:04 just looking at: http://www.java2s.com/Tutorial/Java/0160__Thread/CreatingaBoundedWorkQueue.htm

5:04 hiredman: uh, why would you create your own blocking queue?

5:04 just use one from java.util.concurrent

5:04 zz_auser: I don't want to, I mean't for the worker

5:04 how do you define the run() method?

5:04 hiredman: why do you need a run method?

5:05 zz_auser: So this is what I'm trying to implement in clojure: http://www.hazelcast.com/documentation.jsp#Queue

5:06 I'm feeling a little lost I suppose (this is my first day on clojure :))

5:07 bobo_: i cant see any run method?

5:07 i might be blind, that has happend before =)

5:07 zz_auser: yeah, I'm wrong on that...

5:09 okay... so... umm... wanna help me turn that into a clojure fun?

5:09 heh

5:09 I've spent the last hour trying

5:10 it's probably pretty easy for someone experienced in clojure

5:10 bobo_: (def q (Hazelcast/getQueue"task"))

5:10 (. q put (Mytask.))

5:10 fbru02: zz_auser: so when i used it was only a matter of saying BlockingQueue. and then using .put .get etc

5:10 bobo_: (def task (. q take))

5:11 does taht help you zz_auser ?

5:11 zz_auser: yep, it definitely does... Think Mytask can be a method?

5:11 and um... are those local variables? I mean, do they have to be in a method, rather... they do, right?

5:12 fbru02: zz_auser: just saw godfoca replying to your tweet :)

5:12 zz_auser: thanks, by the way bobo_

5:12 oh yep

5:13 I'm feverishly trying (clearly less than 24 hours later :)

5:13 fbru02: err zz_auser here we don't have methods , we have functions :)

5:13 zz_auser: yep, you're right

5:13 fbru02: also there are not "variables" they are bindings

5:14 zz_auser: oh

5:14 bobo_: that example i would say do it anyway you like, since its just an example that doesnt realy do anytthing

5:15 fbru02: so the rule of thumb is that when you see square brackets [] is that you are doing a binding, there are couple of ways to do them, the usual is passing a func some argzs or in a let method

5:15 zz_auser: oh boy, I'm going to have to do some more reading

5:15 bobo_: =)

5:16 http://twitter.com/#!/dysinger/status/28515272157 that might interest you zz_auser

5:16 zz_auser: I saw that, actually

5:16 (:use [apparatus config cluster]) :)

5:18 fbru02: zz_auser: what are you reading as introduction (just curious )

5:18 zz_auser: two things primarily, the clojure docs and a clojure bookprogramming erlang

5:19 but it's split brained

5:19 bobo_: a clojure book programing erlang?

5:19 zz_auser: haha

5:20 sorry, told ya, a little split brained today

5:20 bobo_: :-p

5:24 zz_auser: hm, promise I won't ask any more "dumb" questions (at least tonight), but fbru02 how did you pull tasks out of the BlockingQueue?

5:26 wow, clojure is so cool

5:26 heh

5:32 bobo_: =)

5:54 zz_auser: night

6:06 licoresse: Hi group, when compiling in emacs it seems to "Fontify" twice, does any bell ring for someone?

6:07 I've been away for some time

6:11 fount it; (setq font-lock-verbose nil)

6:41 fbru02: zz_zz_auser: i was out , ping me when u are here

7:55 eckroth: I'm having a problem: I have some code that uses proxy's to add event listeners on swing components, for example; I run lein compile, but then when I run the app, I get classnotfoundexception

7:56 the exception is fixed if I "modify" the files with the proxy's (by adding a space, then deleting it, then saving), then running again

7:56 I assume it's something to do with AOT

7:56 I'm running like this: java -cp `lein classpath` myapp.core

8:03 this happens also when I do "lein clean" then "lein run"

9:20 chouser: intermittent failure from clojure-maven-plugin

9:25 kzar: What do you think of this? http://paste.lisp.org/display/117522 It's used to run things in a new thread, but somehow it crashes Java after a while

9:25 stuartsierra: chouser: ?

9:25 chouser: stuartsierra: awesome, right?

9:26 cemerick: kzar: use an agent or a future, don't create threads yourself

9:26 stuartsierra: can you give details

9:26 cemerick: and certainly never use .stop!

9:26 chouser: stuartsierra: I'm still fiddling. If I discover anything useful, I'll share.

9:27 kzar: cemerick: Heh I just kinda guessed my way along to be honest

9:27 gtrak: yea, clojure can take of most of that stuff for you, they already did the heavy lifting

9:28 cemerick: kzar: you don't even need the .stop in there -- after the function has completed, the thread will die on its own

9:28 the brutal execution of it is probably what led the jvm into the weeds

9:28 kzar: cemerick: Ah gotya

9:28 cemerick: kzar: even so, use an agent or a future :-)

9:30 _ato: kzar: Personally, I've no objection to using a manual thread if that's what you need. But you don't need proxy as well, this should do you: (doto (Thread. #(apply f args)) (.start))

9:31 cemerick: _ato: why wouldn't you make use of the threadpools that exist already?

9:32 gtrak: it's not idiomatic clojure if you can avoid using a manual thread right?

9:33 _ato: cemerick: because you may not want to use a thread pool (eg something that blocks) and sometimes you may not be interested in the return value (hence future is overkill)

9:33 sometimes you really just want a plain old new thread :-)

9:33 cemerick: gtrak: exactly

9:33 kzar: Thanks for the ideas everyone

9:33 bozhidar: does anyone around here know how to insert code snippets in OpenOffice Impress? I can't find anything online, except for some non-working plugin Coooder and I'm getting close to making screenshots of the code...

9:33 gtrak: yea, but i'm betting kzar probably doesn't :-)

9:33 cemerick: _ato: the threadpool that send-off and future use isn't limited, and therefore never blocks…?

9:34 Raynes: cemerick: I think the sandbox guys and I may have the one undeniable usage of .stop.

9:34 cemerick: All of the sandboxes, including clojail, use .stop to kill a thread after so many seconds have passed so that long-running evaluations are terminated.

9:34 cemerick: Raynes: sure, entirely reasonable

9:34 kzar: Well my step-sequencer seems to pretty much be working :D it sounds like crap but it's working

9:35 Raynes: It seems like it would be difficult to do otherwise.

9:35 gtrak: step-sequencer?

9:35 like fl studio?

9:35 Raynes: Of course, it wont work forever, since it's deprecated. I imagine it'll disappear in future JVMs.

9:35 cemerick: nREPL may end up doing the same in order to offer a "force interrupt" of a running expression.

9:35 kzar: OH crap it just crashed Java again, I guess there's another problem appart from the threads

9:35 _ato: kzar: crashed how?

9:36 gtrak: #java

9:36 kzar: Invalid memory access of location 0x0 rip=0x11a38abc1

9:36 Invalid memory access of location 0x0 rip=0x11a38b54a

9:36 dnolen: kzar: are you using a native lib?

9:36 _ato: eek

9:36 kzar: (This is pretty much practice for Java interop and what not so it's probably all pretty fucked heh)

9:38 dnolen: Yea I'm using javax.sound.sampled stuff to synthesize the sounds and swing stuff for the graphics and Thread for threads

9:38 gtrak: neato

9:38 kzar: gtrak: I'm not sure what fl studio is, it's like http://lab.andre-michelle.com/tonematrix but way way way crapper

9:38 Raynes: I don't think I've ever managed to crash the JVM. Randomly, sure, but not consistently.

9:39 gtrak: fl studio is pretty sweet

9:39 cemerick: Raynes: you will, you will ;-)

9:39 kzar: perhaps the sound stuff is not threadsafe…?

9:39 _ato: hehe, I've done it all too often

9:39 kzar: cemerick: Oh yea maybe, I didn't think of that

9:40 dnolen: kzar: cemerick: or it's a bad native call

9:40 cemerick: yeah, either-or

9:40 neotyk: Guys is any of you aware of OPS5 similar library in Clojure?

9:41 dnolen: kzar: if your Clojure code is improperly calling out into some OS native library that will take down the JVM.

9:41 kzar: Thing is it works for a while and then crashes

9:41 * dnolen is used to restarting the JVM frequently when using Penumbra

9:54 fliebel: Ugh, this is weird. I did the JFastCGI ring middlewhare, but comparing Jetty versus Apache I get that Jetty is slow, and php-cgi shuts down after a few hundred requests. But on the other hand, Apache seems to drop 80% of the connections when doing ab.

10:09 chouser: stuartsierra, cemerick: here's what I've got about my clojure/maven failure: https://gist.github.com/736310

10:10 any insight you might have would be deeply appreciated

10:12 note that if I take the [DEBUG] Command line: shown in the log and run it myself, I have yet to see it fail. It works and returns a success exit code 0 every time I've tried it.

10:13 stuartsierra: chouser: Why Clojure 1.3.0-alpha3 and contrib 1.2.0?

10:14 cemerick: chouser: this is intermittent?

10:14 chouser: lazytest requires Clojure 1.3.0-alpha3. congomongo requires contrib with the old-style artifact name

10:14 cemerick: yes.

10:15 cemerick: whew

10:16 chouser: I tried to patch clojure-maven-plugin to give more info about the failure, but my attempts to build it failed -- syntax errors in .java files (trying to extract docs from variatic args or something?)

10:17 hugod: looks like the catch blocks in AbstractClojureCompilerMojo could use some better reporting

10:19 cemerick: heh } catch (IOException e) { status = 1 } :-P

10:25 chouser: yeah, you really need to get a cmp build with better error reporting there.

10:25 I don't think it'll be possible to solve without it.

10:26 chouser: building clojure-maven-plugin, I get: com.thoughtworks.qdox.parser.ParseException: syntax error @[292,72] in file:/home/chouser/build/clojure-maven-plugin/src/main/java/com/theoryin

10:26 practise/clojure/AbstractClojureCompilerMojo.java

10:29 stuartsierra: So one of two things is happening:

10:29 1. clojure.lang.Compile returns exit status non-zero

10:30 2. while trying to run clojure.lang.Complie (in a separate process), clojure-maven-plugin encounters an IOException

10:30 chouser: yep

10:31 stuartsierra: (2) seems unlikely.

10:31 Unless it's a filesystem / OS / permissions issue.

10:34 chouser: ok, building the plugin seems to be doing better at the moment. taking it's time, though.

10:34 stuartsierra: clojure.lang.Compile catches exceptions and does not set error status, so it's unlikely to be returning non-zero exit status...

10:35 Unless something is throwing a RuntimeException during compile.

10:35 chouser: I don't understand the PumpStreamHandler thing -- what's supposed to be happening to the output of the java sub-process?

10:35 stuartsierra: PumpStreamHandler copies the sub-process's STDOUT to Maven's STDOUT

10:37 rata_: hi

10:38 chouser: stuartsierra: so that appears to be producing nothing at all

10:38 fliebel: rata_: hi

10:39 rata_: hi fliebel

10:40 cemerick: chouser: I'm betting on a RuntimeException of some sort prior to any output being emitted.

10:41 stuartsierra: Wouldn't that be caught and printed to STDERR by the JVM?

10:43 cemerick: stuartsierra: hrm, yes; maybe there's a race condition between the failing of the build and the stream handler flushing output to the mvn stdout?

10:43 * stuartsierra whstles

10:44 stuartsierra: exec.execute on line 452 should not return until the sub-process has completed

10:45 Oh, but maybe PumpStreamHandler hasn't finished, I see.

10:45 rata_: hi chouser

10:46 chouser: rata_: hi

10:46 stuartsierra: chouser: Try adding handler.stop() in a "finally" block

10:47 rata_: chouser: do you remember my problem with counted-sorted-sets and maps? I finally made a compare fn for maps that uses hash and handles hash collisions, it's here: https://github.com/rhz/kapjure/blob/master/src/kappa/maps.clj#L121

10:47 chouser: stuartsierra: ok. I just lost my connection to my dev machine ,so it may be a minute.

10:47 rata_: but the problem is, when I use disj it sometimes doesn't find the element I want to remove

10:48 even when the element is present in the set

10:48 chouser: hmm

10:48 rata_: do you know what could be a possible reason for that?

10:51 cemerick: chouser: lost your connection? Do you guys use some fancy VDI system?

10:52 rata_: I have an example of a particular counted-sorted-set that's giving me this problem, but it's a very long set... so if you would like to see it, let me know and I put it in a gist

10:52 chouser: cemerick: no, multiple devs on one box. we like to make it thrash for each other.

11:05 rata_: chouser: any ideas?

11:06 chouser: rata_: what happens if you remove from your set everything except the item that you're looking for (which currently fails)

11:10 rata_: I'll check

11:14 fliebel: What does a Aleph does with its output? After a lot of requests, it just halts. And then when I quit it, it trows log messages all over me.

11:14 chouser: cemerick: I can't get it to fail now, with either the original or patched plugin

11:15 fliebel: I'm afraid it fills up some buffer and then just blocks on writing to that.

11:15 cemerick: chouser: this is after a restart or something?

11:15 jcromartie: where does lein install maven?

11:15 chouser: cemerick: no, but some other java process have been killed off

11:16 cemerick: that's bizarre

11:16 chouser: cemerick: so I'm wondering if perhaps the sub process was failing due to memory shortage or something

11:16 So I guess we'll proceed for now and do more analysis if it begins to fail later.

11:19 rata_: chouser: when I do (second (split-tree (.tree s) #{m})), where s is the counted-sorted-set and m the map I want to remove, it returns a map that's not equal to m

11:19 (I'm still figuring out a short way to do what you asked me, as the set is very big)

11:36 chouser: if I remove everything except the item I'm looking for, it does the right thing

11:36 chouser: rata_: uh oh. that smells like a finger tree bug. :-(

11:37 rata_: (that is, I end up with a counted-sorted-set that just has the item I'm looking for)

11:38 chouser: can you map across the sorted set in order, running your compare function on a sliding window of pairs, to make sure they're getting inserted in order?

11:40 rata_: to do it I used this form: (reduce (fn [s m] (if (= m wanted-m) s (disj s m)) s s)... is that ok right?

11:40 chouser: like: (every? #{-1} (map (fn [[a b]] (map-compare a b)) (partition 2 1 your-set)))

11:41 rata_: yeah, that looks right

11:42 rata_: chouser: it returns true

11:42 chouser: hm

11:43 which suggests they're in order in the tree. so ... why can't isn't it found?

11:43 when you do the split on the item it can't find, is the one you want nearby?

11:43 as in at the end of the previous tree or beginning for the subsequent?

11:44 rata_: I'll check

11:45 no, it splits the tree at the last element

11:46 (let [[l x r] (split-tree (.tree s) #{wanted-m})] [(peek l) x (first r)]) returns [{17 27294, 18 26692} {17 27393, 18 27024} nil]

11:52 chouser: rata_: can you have your compare function log its return values each time it's called during that split?

11:52 rata_: and also its input values?

11:53 chouser: if it returns 1 every time, then finger tree is "correct" in slitting at the end

11:54 rata_: ok

11:56 I must recreate the counted-sorted-set though to change the compare fn... or can I change it in-place?

11:56 chouser: hmm

12:05 rata_: chouser: it does no comparison

12:05 chouser: hmph!

12:11 rata_: chouser: btw, did you see the issue I opened some days ago?

12:13 chouser: rata_: yes, thanks

12:13 rata_: =)

12:13 you're welcome

12:13 chouser: My non-work clojure time is going into the book right now, but once that's been tamped down again, finger trees will get some love.

12:14 rata_: I wasn't sure if you had a CA in -- I can't accept a patch without that, and also it should be submitted via the ticket system.

12:14 regardless of all that, thanks for trying out the code and spotting weak points -- that's very helpful.

12:15 rata_: where's the ticket system? I thought issues was the right place to put it

12:16 what's exactly the CA? the thing I use to push to my git repos?

12:17 hiredman: clojurebot: ca?

12:17 !

12:17 clojurebot: ping?

12:17 chouser: rata_: oh! ha, didn't see you'd used the github issues.

12:17 let's see...

12:18 amalloy: $whatis ca

12:18 sexpbot: ca does not exist in my database.

12:18 amalloy: $whatis CA

12:18 sexpbot: CA does not exist in my database.

12:18 amalloy: man wtf. bots both sucky here

12:19 hiredman: ping?

12:19 Raynes: We should really rename $whatis to $explain

12:19 clojurebot: PONG!

12:19 hiredman: clojurebot: ca?

12:19 clojurebot: CA is Contributor Agreement: http://clojure.org/contributing

12:19 gtrak: clojurebot: agent?

12:19 rata_: chouser: where did you see it then? I don't remember putting the patch elsewhere

12:19 clojurebot: I don't understand.

12:19 chouser: rata_: you sent email

12:21 rata_: really? did I sent you an email? I don't remember doing that

12:21 chouser: rata_: I guess I don't know where the right place is to file bugs for this "new contrib" system

12:22 rata_: ah, nm, when you created the issue, it emailed me

12:22 rata_: oh ok... but is github's issues then an acceptable place?

12:23 chouser: probably not long term, but I guess it's fine for now. The CA is more important. Without at least that I'll just need to creat my own fix for the problem.

12:26 rata_: ok... I must mail it to rhickey, right?

12:26 chouser: yes

12:26 rata_: mmm ok

12:27 that will take a while, as I am in Chile

12:28 chouser: sorry about that. I don't have any way I can ease that pain.

12:28 rata_: don't worry

12:28 anyway, that patch just adds two lines to finger-tree.clj

12:30 chouser: yeah, it shouldn't be a problem for me to fix now that you've reported it.

12:34 rata_: =)

12:34 chouser: also, please let me know if I can help you more with this split-tree thing

12:40 Islon: how can I see swank clojure output in cake?

13:00 amalloy: Islon: i don't understand the question. can you be more specific about what you want?

13:05 Islon: amalloy: how do I see cake's output, already discovered myself: .cake/project.log

13:28 edw: Clojure does *not* support nested DEFNs, correct?

13:28 stuartsierra: correct

13:29 edw: Thanks.

13:35 stuartsierra: I'm looking at an alternative approach to CLJ-322

13:36 Instead of introducing LOAD_LEVEL, just bind a set of symbols for names that should be written out.

13:42 cemerick: stuartsierra: with (constantly true) indicating transitivity?

13:42 stuartsierra: something like that

13:43 cemerick: stuartsierra: seems reasonable; but let me ask…

13:43 clojurebot: stuartsierra is retiring

13:43 stuartsierra: heh ;)

13:43 cemerick: where the $#!* were you two months ago?

13:44 said with all due ;-) and :-D of course ;-)

13:44 stuartsierra: Hmmm… I think I was still eyeballs-deep in testing frameworks at that point.

13:44 * cemerick is slightly off from cold medicene

13:44 stuartsierra: Spending the past 3 weeks or so on Maven has gotten me thinking about compilation.

13:44 Speaking of which...

13:45 cemerick: stuartsierra: I'm totally just screwing with you. Your idea sounds far superior on the face of it.

13:45 stuartsierra: java.lang.Class is Serializable. Anybody know what happens if you serialize it?

13:46 cemerick: bytes that will be deserialized into a Class?

13:46 stuartsierra: What I'm wondering is, do you get a normal .class file?

13:46 I'd guess not.

13:46 cemerick: Hrm, no.

13:47 stuartsierra: Maybe what we really want is not non-transitive compilation, but *selective* emitting of .class files.

13:47 that is, compiling source and writing .class files are two different things.

13:48 You always want to compile your sources; they're not much use otherwise.

13:48 cemerick: except the relationships between namespaces, functions, and class files are roughly an implementation detail

13:48 stuartsierra: But it's a deterministic relationship, right?

13:49 cemerick: But I get your point -- AOT compilation is a good sanity check in any case, classfile emitting or not

13:49 stuartsierra: Could we have a function/macro like (emit-classfile-for symbol)?

13:49 cemerick: probably not after we've dropped the byte[] of the generated classfile on the floor once it's loaded into the VM

13:50 stuartsierra: Hmm, yes.

13:50 cemerick: I think if you said that the set would be namespaces for which classfiles would be written, that makes sense.

13:51 And allows for AOT-loading without necessarily AOT-classfile-emission

13:53 stuartsierra: What I'm wanting is to leave "compile" as-is, and add a new thing "write-classfile"

13:54 hiredman: the whole point of compile is to write class files

13:54 cemerick: not true

13:54 * technomancy was hoping rebinding *compile-files* to false while requiring other nses would work, but that turned out to be a worlde o' hurt

13:55 stuartsierra: right, but most of the time people use "compile" just because they need *one* class file, like a main class or a gen-class

13:55 hiredman: cemerick: that is exactly what it is for

13:56 stuartsierra: "clojure.core/compile" does 3 things: load, generate bytecode, write classfile

13:56 cemerick: hiredman: Perhaps that's it's explicit purpose, but AOT-compiling to a temp dir is just good practice at this point so as to ferret out any loading issues.

13:56 stuartsierra: I want to separate out the third step, writing the classfile, so it can be invoked selectively.

13:57 hiredman: cemerick: or you can just load the namespace

13:57 cemerick: stuartsierra: there are scenarios where comprehensive classfile emission is required.

13:57 stuartsierra: Yes, absolutely.

13:57 hiredman: I never call "compile" to check if a file loads

13:57 stuartsierra: And I want to leave that available.

13:57 hiredman: I call load

13:57 or require or use

13:58 cemerick: hiredman: sure, sure. But AOT is the hook that's available to load everything in a given project, so…

13:58 stuartsierra: cemerick, hiredman: this is immaterial

13:59 hiredman: cemerick: I think you are confusing what your tool chain offers as "compiling" with what clojure's compile does

13:59 stuartsierra: What are the situations where you *need* to write a .class file for things to work?

13:59 1. gen-class

13:59 hiredman: defprotocol

13:59 stuartsierra: hiredman: how so?

13:59 hiredman: well

13:59 sort of

13:59 cemerick: hiredman: I'm quite sure I know what Clojure's compile does. I'm being fast and loose with language though.

14:00 hiredman: depends what you are doing with protocols and records

14:00 stuartsierra: If you want the protocol to make an interface you can call from Java, you certainly need a .class file.

14:00 hiredman: cemerick: aot compiling a namespace in no way loads an entire "project" it will only load what that namespace loads, so you may as well just use load

14:00 stuartsierra: rigth

14:01 stuartsierra: Same for deftype/defrecod.

14:01 cemerick: stuartsierra: same goes for def/gen-interface

14:02 stuartsierra: and "clojure.core/compile" doesn't help you if you just want to write a .class file for a protocol, for example, because it works at the level of namespaces

14:03 With gen-class, you can work around it by putting all your "gen-class" declarations in a separate file and loading it with *compile-files* set true

14:03 But if I want a .class file for my protocol / datatype, and nothing else, I'm stuck.

14:23 suehs: have you ever seen the lein repl hang intermitently?

14:25 raek: suehs: there was a bug a time ago that caused the output to not be flushed. try evaling 1... does the output appear then?

14:29 suehs: that seems to work fine:

14:29 user=>1

14:29 1

14:29 as well as (eval 1) and some toying with some lists

14:30 and if I jiggle it with an extra () the rest of the output falls out and I get another prompt

14:30 I'll try dropping rlwrap in my classpath.

14:31 maybe it goes back to the j readline differences

14:35 raek: hrm, I can't find the ticket, but IIRC it was a bug in clojure itself (it has been fixed, btw)

14:42 suehs: I am using 1.2.0. I'll check for a later version.

14:42 I'm also playing with incanter. I don't think that's a problem though

14:48 technomancy: suehs: latest version should fix all that

14:51 suehs: latest stable release or do I need to be adventurous?

14:51 technomancy: stable's fine.

15:11 chouser: cemerick: https://gist.github.com/736310#file_with extra error reporting .txt

15:12 amalloy: chouser: that link looks a little dubious :P

15:12 chouser: heh, yeah. spaces in my fake filename

15:13 cemerick: chouser: "error=12, Cannot allocate memory" has lots of hits on google, though nothing that makes immediate sense

15:13 sounds like you've got local environment issues, tho

15:13 chouser: cemerick: yeah, seems likely

15:14 cemerick: chouser: Do get your error reporting patch over to Mark though

15:15 hiredman: depending on how maven is launching java, the way java forks on linux the child process when it begins tries to allocate the same amount of memory as its parent

15:15 http://stackoverflow.com/questions/209875/from-what-linux-kernel-libc-version-is-java-runtime-exec-safe-with-regards-to-m

15:17 rata_: chouser: I made a mistake before, because I was using #{wanted-m} instead of #(>= 0 ((.cmpr s) wanted-m (:right %))) as the predicate fn for split-tree

15:18 when I use the latter, I get {17 2812, 18 20990}, but I'm looking for {18 23554, 17 215}

15:21 and the surroundings of the element returned by split-tree are {17 3544, 18 20255} (last element in the left tree) and {17 2580, 18 21300} (first element in the right tree)

15:21 so the map I'm looking for doesn't appear there

15:22 (the log of the comparisons is "1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1")

15:23 chouser: weird

15:23 so it appears to be hunting through the set in roughly the kind of pattern one would hope for

15:24 and indeed ends up in the middle somewhere, but not next to the one you're looking for

15:25 rata_: yes

15:25 and when I run (get s wanted-m) it prints the same log and returns nil

15:26 (well, that is expectable)

15:32 oh! it's in the left tree and when I do (split-tree l #(>= 0 ((.cmpr s) wanted-m (:right %)))) it founds it!

15:32 (printing the log "1 1 1 0")

15:32 chouser: ^

15:34 chouser: wounds like it's down the right-hand side of the left tree

15:34 sounds

15:35 rata_: yes

15:36 also, the hash values of the first found by split-tree and the map I'm looking for are similar: &(hash {17 2812, 18 20990}) and &(hash {18 23554, 17 215})

15:37 &(hash {17 2812, 18 20990})

15:37 sexpbot: ⟹ 23769

15:37 rata_: &(hash {18 23554, 17 215})

15:37 sexpbot: ⟹ 23766

15:37 chouser: so "near" in the tree

15:37 rata_: I don't know if that could have to do with the issue

15:37 yes

15:38 in fact, (peek (pop l)) is the map I'm looking for

15:46 chouser: I keep thinking is my map-compare fn the root of the problem

15:47 chouser: rata_: I'd like to believe that :-) ...but I'm not seeing anything you did wrong.

15:48 rata_: maybe the part that handles hash collisions is "diverting" to the wrong path the search

15:49 in fact, in this tree there are two maps with the same hash code

15:50 (being one of those map the one I'm looking for)

15:52 thus I think when it arrives to the other map with the same hash code, the split fn choose the wrong path

15:52 chouser: hm

15:52 rata_: do you know of a better way to have a guaranteed unique hash fn?

15:53 amalloy: rata_: guaranteed unique is kinda the opposite of a hash

15:53 chouser: sha1 etc come close, but that's not really what's wanted here

15:53 rata_: or should I just use (compare (vec (sort-by > (vals m1))) (vec (sort-by > (vals m2))))

15:54 that's way slower than comparing hashes

15:54 chouser: rata_: you could try that to see if it "works", and then add more complexity

15:54 rata_: ok

15:59 the creating of the reaction-chamber (no matter what that is) takes now 86secs vs 58secs using the hash-based compare fn

15:59 but let's see if the simulation part works

16:02 stuartsierra: So I think I have a version of selective compilation

16:05 https://github.com/stuartsierra/clojure/tree/write-classes

16:06 anonymouse89: I'm going through some VERY large XML files with clojure.xml/parse like this: (let [items (parse file)] (doseq [item items] do stuff))

16:06 chouser: oh, as opposed to automatic transitive?

16:06 stuartsierra: yes

16:06 chouser: excellent

16:07 anonymouse89: I would like to drop the head of the items sequence as this conusmes a lot of memory and give me OOM errors

16:07 stuartsierra: Instead of changing "compile", I added "compile-write-classes"

16:08 https://github.com/stuartsierra/clojure/blob/write-classes/src/clj/clojure/core.clj#L5320

16:08 hiredman: I still fail to see why you wouldn't just change compile

16:09 stuartsierra: "compile" by itself isn't enough in the face of deftype

16:09 hiredman: how would you change "compile" to get .class files for deftype/defprotocol?

16:09 rata_: chouser: it doesn't work either :(

16:09 chouser: rata_: bleh. ok, sorry. gotta run.

16:10 rata_: chouser: ok

16:10 hiredman: stuartsierra: beats me, I'm not the one with a proposed solution

16:10 stuartsierra: :)

16:10 rata_: I'll continue searching for a solution

16:11 hiredman: maybe we need to split clojure source file types

16:11 rata_: chouser: so if you could help me afterwards, that'd be cool

16:11 hiredman: one type can generate classes the other can't

16:11 rata_: I need to have some results of this simulation for monday =S

16:12 stuartsierra: hiredman: there's still some value to "compile" doing AOT-compile on everything, for example when you want to release a pre-built app with minimal load time

16:12 hiredman: I tried to use aot to cut down on load times, but it didn't do much

16:12 stuartsierra: Selective compilation is more important for Java interop or library releases

16:13 hiredman: yeah, the bulk of the load time is loading clojure.lang.RT anyway

16:32 Messanger: world leaders setting you all up right now to get microchipped by RFID microchips with identity/healthcare/credit information into their new world order why they are folding the economy , their solution to the problem they are causing is the RFID microchip http://www.scribd.com/doc/44997148/The-Mark-of-the-Beast Romans 10:13 all who call upon the name of the Lord shall be saved.

16:34 amalloy: i...i can't really put a lot of credibility in anyone named Messanger

16:35 technomancy: amalloy: he's angry about messiness; makes sense to me.

16:36 stuartsierra: Added my patch with comments to CLJ-322

16:36 tonyl: now that was weird

17:19 lpetit: hello, missa missing this channel!

17:20 tonyl: lol

17:50 npoektop: hi. If i literally translate how russians call bad written code with many copy/pastes: hindu code. How to translate it correctly?

17:54 amalloy: npoektop: there are a lot of ways to say it in english :P

17:54 copypasta is a good one: spaghetti code that's also copy/pasted

17:54 Adamant: npoektop: copypasta works

17:54 so does cut and paste

17:55 I've heard JCS (Java Coder Syndrome)

17:55 but that's pretty obscure

18:05 m7d: i am hoping i can get a bit of help: can i get a recommendation for libraries to use to do credit card transactions? especially for authorize.net?

18:05 i am guessing it would probably be a java lib that i need to interact with from clojure

18:07 also, any pointers for a tutorial or screencast that shows the whole path to setting up a clojure env on os x? i use CL currently so i am used to slime,etc.

18:08 oh, i see there is a clojure-authorize for cc stuff

18:09 pdk: http://mischneider.net/?p=171

18:09 http://kylecordes.com/2010/emacs-osx

18:10 m7d: pdk: good links , thanks, did the instructions work for you?

18:10 pdk: i'm not on os x so couldn't vouch for em

18:10 m7d: pdk: yeah, i have found some links on google, just hoping to find something that is for sure up to date, etc.

18:10 pdk: on windows at least there is clojure box which has clojure + emacs + slime all bundled together and configured, the package might be available for os x/linux too

18:11 m7d: pdk: i'll check that out, thanks

18:11 pdk: you probably just have to change any hardcoded references to the clojure version number like 1.1.0 or 1.2.0 etc

18:11 m7d: pdk: is lein the way things are gelling or cake?

18:12 pdk: i haven't tried either enough to say, iirc cake is probably newer

18:12 amalloy: m7d: some of both

18:12 cake is definitely newer, but lein is older, so they both win that one :P

18:12 m7d: amalloy & pdk: ok, does it seem like one will win out realistically?

18:12 amalloy: i like cake for its nailgun functionality, personally

18:13 m7d: amalloy: i just looked up cake, what is nailgun?

18:13 amalloy: m7d: http://blog.raynes.me/?p=48

18:13 clojurebot: nailgun?

18:13 clojurebot: nailgun is http://www.ruby-forum.com/topic/186850#815956

18:14 m7d: amalloy: thanks, nice bot feature

18:14 amalloy: $whatis nailgun

18:14 sexpbot: nailgun does not exist in my database.

18:14 amalloy: sexpbot is the bot i actually work on, m7d, but i confess clojurebot's lookup/whatis feature is a lot more convenient

18:15 m7d: amalloy: so looks jruby specific, nailgun that is

18:15 amalloy: nono

18:15 janything :P

18:15 it really just keeps a jvm running

18:15 m7d: amalloy: oh, i see

18:15 amalloy: i don't know if cake actually uses nailgun or re-implements the functionality, but either way it acts the same

18:16 m7d: amalloy: like a supervisor daemon or something

18:16 amalloy: you can ask around in #cake.clj, or ninjudd/Raynes/lancepantz are the cake whizzes

18:16 m7d: amalloy: ok, thanks

18:16 technomancy: leiningen does that now with the interactive task

18:16 pdk: do they recommend apple pumpkin or black forest

18:16 amalloy: or ask technomancy if you want someone to defend leiningen :)

18:16 m7d: technomancy: thanks for the emacs rig by the way

18:17 technomancy: m7d: starter-kit?

18:17 m7d: yep

18:17 technomancy: yeah, I'm working on rewriting that

18:18 m7d: technomancy: you should know the answer to this then: a blog post that gets me quickly through clojure setup? I am common lisper, rubyist, with past java experience so it isn't all foreign, but i don't have hours to mess up

18:18 lancepantz: cake doesn't use nailgun

18:18 technomancy: m7d: I don't know a good way to use slime that works for both clojure and CL

18:19 m7d: but the swank-clojure readme should be the canonical reference for a slime setup that works with clojure 1.2 and older.

18:19 m7d: technomancy: i see, no problem, maybe i'll go slimeless for a while in clojure

18:19 technomancy: generally blog posts about slime are not very reliable since they get out of date and nobody updates them

18:20 case in point: http://technomancy.us/126

18:20 m7d: yeah, it is all moving fast, just like early rails days, brings back good but painful memories too

18:21 technomancy: the difference being that rails never really got good Emacs support =\

18:21 for templating at least

18:21 m7d: technomancy: yeah, that is very true

18:21 lancepantz: oh jesus, views are hell in raisl

18:21 *rails (in emacs)

18:22 technomancy: speaking as the co-author of rhtml-mode... that was a disaster.

18:23 m7d: as an example, it was sort of difficult to build penumbra (see on github) starting from nothing, still don't have it working cuz i didn't want to spend more time on it and some of the stuff online is way out of date apparently

18:23 lancepantz: i'd ask zach, he's really good about responding

18:24 m7d: lancepantz: is that zach beane?

18:24 lancepantz: zach tellman

18:24 m7d: oh, ok

18:24 there is a zach in lisp who is really helpful and a rippin good lisper

18:25 lancepantz: thanks

18:25 zach: r u here?

18:25 lancepantz: maybe it's just all zachs? :)

18:25 m7d: lancepantz: i think it is :)

18:26 technomancy: I dunno; my 1-year-old Zach is not.

18:26 lancepantz: i'm sure he will be :)

18:26 that's it, i'm naming my kid zach

18:26 m7d: technomancy: patience, give him time

18:26 lancepantz: i've never known a bad zack

18:26 *h

18:31 m7d: is it possible to work with projects defined in lein using cake?

18:31 slyrus: m7d: xach

18:31 dnolen: m7d: yup

18:31 slyrus: and you can usually find him in #quicklisp

18:32 m7d: slyrus: yep, quicklisp is great, it has made things easier for sure

18:32 slyrus: glad to hear it. I'm a fan as well.

18:32 m7d: dnolen: cool, some special cake command that makes it parse lein package defs or something?

18:33 lancepantz: m7d: we just use the same syntax

18:33 m7d: lancepantz: excellent

18:33 lancepantz: for defproject

18:33 m7d: i'll install the gem now

18:38 actually i ended up doing lein self-install

18:40 it blew up trying to build penumbra though via lein deps and suggested i just get the project from it's website...oh well

18:41 it looked like it was almost done too, darn

18:42 well, penumbra looks like a hairy project with lots of dependencies so maybe it isn't a good representative project for lein

18:42 technomancy: pure-JVM projects are going to be simpler

18:43 as in any language, foreign dependencies muck things up something nasty

18:43 m7d: technomancy: yep, you created lein right? thanks for doing it, that looks like a lot of work

18:43 technomancy: it's actually pretty simple

18:43 it only passed 1000 LOC recently

18:43 m7d: technomancy: yep, like building elephant in cl which i eventually, without too much trouble did, but it wasn't quicklispable

18:44 technomancy: well, that's cool, seems like a great contribution

18:45 technomancy: thanks

18:45 m7d: technomancy: welcome

18:46 know of any clojure projects that start getting close to the machinery needed for an ecommerce project?

18:46 as a starting off point?

18:46 i see clojure-authorize on github and now i need to figure out persistence, probably relational for ecommerce

18:47 amalloy: m7d: clojureql? i haven't tried it, but it's brand new and looks very appealing

18:47 m7d: amalloy: thanks, i'll check that out

18:48 lancepantz: clojureql is awesome

18:48 amalloy: plus, if you need help with it you can bug Laujensen, which will be fun (and give you a reason to stay up late, if you're not in europe)

18:49 m7d: amalloy: hah, cool - yeah clojureql looks pretty nice - i like getting my composed sql back in a repl, that's nice

18:51 tomoj: when you want to do something outside clojureql's features, do you have to drop down to c.c.sql?

18:52 amalloy: tomoj: it's hard to imagine that not being the case

18:53 tomoj: then I guess the question is, how hard would it be for me to add the features I need to clojureql

18:53 scottj: I suspect it has a function where you can enter sql statements.

18:58 m7d: i know it's early in clojure's life, but is there any standard vetted way of doing persistence in clojure? the clojureql lib looks great, but i am not looking for something so new that i feel their development pain

19:01 raek: tomoj: from what I have heard, it should be very simple to instert custom strings of SQL into the query in ClojureQL

19:11 scottj: m7d: if you limit persistence to just sql then maybe c.c.sql

19:12 but there's nothing that encompasses sql + all the other persistence things. clojurize wants to do that though.

19:12 m7d: scottj: thanks, i'll check it, i am creating a proj and setting up clojureq, c.c.sql next

19:12 s/clojureq/clojureql

19:12 sexpbot: <m7d> scottj: thanks, i'll check it, i am creating a proj and setting up clojureql, c.c.sql next

19:14 m7d: ah, so clojure uses the directory namespace matching stuff from java

19:15 clojure.test looks to have the same interface as stefil from cl, so that's nice

19:16 scottj: there are lots of newer frameworks than c.test but none have won out yet

19:16 m7d: scottj: thanks for the info

19:16 amalloy: m7d: clojure seems to have chosen not to use java's long, domain-qualified namespaces/packages, fwiw

19:17 m7d: scottj: learning from my rails/merb days, i'll just stick with the standard offering on testing

19:18 technomancy: are there better alternatives to slime for clojure dev? or good ones at least? i have eclipse installed on my machine. since cl slime integration and clojure slime integration are difficult to attain simultaneously

19:18 scottj: amalloy: was interesting how quickly that changed, I think in large part due to lein

19:19 amalloy: scottj: i showed up after the decision was made, i think

19:19 m7d: counterclockwise for eclipse is supposed to be good

19:19 scottj: m7d, slime is the best. vim and ccw are probably next.

19:20 m7d: amalloy: thanks

19:20 scottj: you can use slime w/ cl and clojure, I do it

19:20 m7d: scottj: i use vi in emacs so that could work

19:20 scottj: yeah, mind sharing your .emacs relevant to it?

19:20 i dig slime

19:20 muscle memory and all that

19:21 scottj: I don't think I have anything special, it just works. requiring clojure-test-mode will break it though

19:21 m7d: scottj: is that the red green stuff?

19:21 scottj: I slime-connect to everything. I don't run clojure or sbcl from inside emacs

19:21 m7d: scottj: yeah, you are smart not too. i need to stop doing that

19:21 scottj: m7d: yeah and a few other things

19:22 m7d: i saw a screencast of that and it caught my eye

19:22 amalloy: agreed, slime-connect is easier

19:22 scottj: I have some screencasts at http://youtube.com/emailataskcom covering emacs/slime/clojure stuff

19:23 m7d: scottj: thanks, i'll check it now - i just got the lein stuff sorted and clojure installed and a project started, now i need my tools!

19:26 scottj: cool screencast, which screencast covers getting setup? i am watching the latest right now

19:28 scottj: I don't cover getting setup, that's too boring :)

19:29 m7d: scottj: ok, fine, i'll find out :)

19:31 scottj: basically add clojure-mode swank-clojure and slime and slime/contrib to load-path then require clojure-mode and slime and run (slime-setup '(slime-fancy)) require clojure-mode and slime (I use from trunk, don't expect support though if you have problems)

19:32 cut the second require clojure-mode and slime bit

19:33 m7d: scottj: ok, i'll check that out - i also found a link to an article from a lisper i respect: http://nklein.com/2010/05/getting-started-with-clojureemacsslime/

19:34 * technomancy wishes people didn't feel compelled to reproduce the official documentation on their own blogs where the community can't fix them when they become out of date

19:34 technomancy: hard enough keeping one set of docs up-to-date

19:35 scottj: m7d: that's a lot more code than you need if you don't mind running slime-connect

19:35 m7d: scottj: ok, i'll try for the slime-connect and fix my cl emacs stuff at the same time

19:35 getting clojure-mode right now

19:36 cool that's done

19:36 scottj: I bet you could do cl/clojure just fine installing everything from elpa

19:36 m7d: scottj: i did if that is the same as M-x packages-install followed by clojure-mode

19:37 i'll try the others from elpa too as you suggest

19:38 scottj: slime from elpa doesn't have contrib (I think) so if you want fancy stuff you need trunk

19:38 m7d: scottj: i just grabbed the swank-clojure bits from elpa and i'll do a cvs checkout on my slime install

19:39 technomancy: swank-clojure.el is deprecated; skip it

19:39 you just want slime-repl, clojure-mode, and paredit from package.el

19:40 m7d: technomancy: ok, i'll check those instead, i use paredit all the time for cl, so maybe i don't need that and now i have clojure-mode, so i'll grab slime-repl

19:40 \

19:40 got the new slime bits

19:40 scottj: if you're going cvs you don't need slime-repl from elpa

19:40 m7d: scottj: k, thanks...doin it now

19:41 technomancy: paredit 20 is missing a few features that are good to have in clojure

19:41 m7d: i guess i already have slime-repl since i use slime for cl all the time, i just tried to get it and it said i already have it

19:42 so now i guess i just need to load things up in my .emacs

19:43 scottj: technomancy: following up on yesterday, so where are you seeing difftest output? lein test, in repl on C-c C-, or in C-c '?

19:44 technomancy: scottj: yeah, I misspoke; it's just lein test

19:45 m7d: technomancy: how do i get those missing features then?

19:45 technomancy: m7d: the swank-clojure readme shows how to add "technomancy" as a package source; once you do that you can get paredit 22

19:46 m7d: technomancy: ok, thanks

19:47 technomancy: i thought swank-clojure was deprecated? don't i want that for slime-connect?

19:48 technomancy: slime-connect is part of slime

19:48 scottj: just the emacs lisp file is deped

19:48 m7d: right, what am i say, sorry, drinking from the firehose, this is my first hour of clojure

19:49 technomancy: it's confusing

19:49 m7d: s/say/saying

19:49 sexpbot: <m7d> right, what am i saying, sorry, drinking from the firehose, this is my first hour of clojure

19:49 alexyk: wow, sexpbot has come a long way! it evolved into a vi

19:49 scottj: clojure box for windows is really nice

19:49 amalloy: alexyk: soon we'll be adding non-modal editing :)

19:49 technomancy: it'll be a lot easier once Emacs 24 is released with built-in package.el

19:50 alexyk: scottj: did you mean, windows box for clojure is nice? :)

19:50 scottj: haha

19:50 m7d: well, it wasn't any easier getting setup with cl, i just want to do this as fast as possible

19:51 my cl emacs rig is tricked out so i guess i have to invest the time here as well

19:51 scottj: if you use lein, install swnak-clojure as a plugin, and use slime-connect it's pretty easy

19:52 if you already had slime for cl then you'd just need clojure-mode, just like any other programming language mode for emacs

19:53 m7d: scottj: thanks, that's sounds more direct

20:03 aoeu256: err under the clojure box slime repl how do you terminate your input after calling (read)?

20:03 vIkSiT: lo all

20:04 I've got a function that returns a list or a seq

20:04 hiredman: lists are seqs

20:04 vIkSiT: how would i declare 2 vars to get the value of list[0] and list[1]?

20:04 hiredman, indeed..

20:05 I'd like to have a and b assigned to 1 and 2 respectively, given [1 2]

20:05 how would I do that?

20:05 aoeu256: (def a (first list))

20:05 (def b (second list)) ?

20:05 tomoj: do you really mean 'vars'? :(

20:06 amalloy: &(let [[a b] [1 2]] (print a b))

20:06 sexpbot: ⟹ 1 2nil

20:06 amalloy: aoeu256: ^^

20:07 vIkSiT: amalloy, aah.

20:07 is there a way to do that for globally scoped variables?

20:07 amalloy: vIkSiT: no. but don't do it :P

20:07 vIkSiT: tomoj, er, vars have a special meaning do they?

20:07 amalloy, right :)

20:09 amalloy: vIkSiT: vars are one of clojure's mutable reference types. they're used [almost] exclusively for storing globals, like defns and defs

20:10 _ato: (def a 1) <-- var

20:10 m7d: technomancy: so i did lein install swank-clojure and got swank running fine, but when i slime-connect it says my version of slime and swank are different versions "do you want to continue?" continuing blows up

20:11 tomoj: what do we call the things let establishes? local bindings?

20:11 vIkSiT: amalloy, aah

20:11 amalloy: tomoj: i think so. locals, maybe

20:11 _ato: yeah, lexical binding or local binding or let binding

20:11 technomancy: m7d: that's a bug in slime's packaging; it's fixed in the version from my personal archive

20:12 oh wait, never mind

20:12 m7d: i have a brand new slime checkout

20:12 technomancy: the bug is that it asks

20:12 m7d: oh, yeah I don't know how swank works with cvs slime. many problems have been reported.

20:12 m7d: technomancy: m, ok, lesson learned

20:13 technomancy: some people have gotten it working supposedly, but I haven't paid attention since I'm not interested in CL

20:13 m7d: right

20:13 technomancy: and they haven't contributed any docs or upstream fixes

20:13 m7d: i think that article i referenced will be a good one since he is doing both, i'll have to wade through it or similar i guess

20:14 i definitely don't want to break my cl slime stuff

20:14 aoeu256: Question: In the slime repl how do you terminate your input after calling (read)?

20:16 amalloy: aoeu256: iirc slime doesn't play very nice with stdin

20:16 you could try C-j or C-o or something, if ret doesn't work, but i wouldn't hold my breath

20:17 _ato: aoeu256: try the *inferior-lisp* buffer if you launched clojure from within emacs with M-x slime. Otherwise try the terminal you ran swank from

20:18 vIkSiT: also, does anyone here use aleph?

20:19 tomoj: yep

20:20 that I use aleph doesn't mean I can answer your question, but maybe someone who doesn't answer your meta-question can

20:27 ossareh: 'lo all

20:28 aoeu256: _ato: thanks

20:28 amalloy: clojurebot: ask?

20:28 clojurebot: I don't understand.

20:30 amalloy: anyway vIkSiT, it's very tempting to ask whether anyone can help before you ask an actual question, because it feels more "polite", but all it does is waste everyone's time; nobody knows they can help until they hear a real question

20:38 vIkSiT: amalloy, i agree, i'm a bit proponent of "dont ask to ask" :) but that *was* my question - curious to see how many people use it

20:38 big*

20:44 amalloy: hah

21:13 technomancy: clojurebot: anyone?

21:13 clojurebot: Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.

21:13 technomancy: amalloy_: I think that's what you're looking for =)

21:23 tomoj: vIkSiT: I see

21:23 looking over the aleph mailing list gives you some idea

21:23 I think I saw you posted there recently

21:38 vIkSiT: tomoj, indeed. I was curious to see if there was an overlap from the mailing list to IRC..

22:00 unclebob_: I could use a hand setting up emacs for clojure. Anybody willing?

22:03 amalloy: technomancy?

22:03 clojurebot: technomancy is to blame for all failures

22:03 hiredman: ~botsnack

22:03 clojurebot: thanks; that was delicious. (nom nom nom)

22:04 unclebob_: Yeah, technomancy

22:06 It's some kind of problem with elpa

22:06 it can't download clojure jars

22:06 and it can't acquare clojure-test-mode

22:06 Perhaps I should try a different emacs.

22:08 technomancy: unclebob_: the swank-clojure readme has advice for a more up-to-date packgae.el version

22:14 ossareh: I'm making use of the :handler option in c.c.http.agent - what is the clojureish way to read the entire body in this situation - you're obliged to use (stream httpagent) to get a HTTPInputStream - and I could read it all - but I feel this is wrapped up nicely somewhere for me.

22:15 amalloy: ossareh: slurp?

22:16 ossareh: ,(doc slurp)

22:16 clojurebot: "([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."

22:17 ossareh: amalloy: I considered that but stopped on the back of it requiring a file.

22:18 works beautifully

22:18 unclebob_: No luck. I think I'll give up for awhile.

22:18 ossareh: thanks amalloy ! (I think that is at least 5 beers you're owed from me)

22:19 amalloy: ossareh: i think slurp just works on input streams really, and will coerce things to input streams if necessary

22:21 ossareh: amalloy: certainly seems that way - I'm going to have to work reading core.clj into my self study

22:45 hmm - so I am using pmap to map a function onto 50k elements - the function triggers a http.agent which returns an agent. I don't care about the returned data, but the returned data is causing me to OOM. Any thoughts? the functions are impure so I care only about a data structure that is updated as part of my mapped function.

22:46 I guess I could return nil - perhaps I wont oom with 50k nils?

22:48 amalloy: ossareh: pcall

22:48 &(doc pcall)

22:48 sexpbot: java.lang.Exception: Unable to resolve var: pcall in this context

22:48 amalloy: &(doc pcalls)

22:48 sexpbot: ⟹ "([& fns]); Executes the no-arg fns in parallel, returning a lazy sequence of their values"

22:48 ossareh: nice!

22:48 amalloy: hm, i guess not. that's still returning values

22:49 #(do (uninteresting-data-with-side-effects) nil)?

22:50 ossareh: pretty much what I'm doing

22:50 I'm OK with the nils being returned - cheers.

22:51 I think asking the question initially helped my brain realise the issue - there should be a channel for that #randomstatementstohelpmethink

22:51 amalloy: ossareh: #/dev/null

22:53 ossareh: now an auto-join room for me ;)

22:53 amalloy: ossareh: you could also do (comp boolean myfunc), which is probably shorter than the (do) nonsense, still lets you tell nil from non-nil

23:04 ossareh: amalloy: I guess I could wrap it in a filter with (not= nil x)

23:04 amalloy: ossareh: ##(doc keep)

23:04 sexpbot: ⟹ "([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."

23:05 ossareh: I'll give it show once my current pmap stops

23:05 amalloy: also, (complement nil?) is the same as #(not= nil %)

23:06 ossareh: ah, that is nice

23:06 I have not-nil? defined in most of my projects

23:07 amalloy: ossareh: i like to (def ! complement), so i can write (! nil?)

23:08 hiredman: (comp not nil?) is shorter

23:09 ossareh: (comp not nil?) is nice

23:09 amalloy: hiredman: (comp not foo) is shorter than (complement foo); if that were sufficient reason not to use complement, it wouldn't exist

23:09 * technomancy prefers to count tokens rather than chars

23:10 hiredman: amalloy: hey, man, if it was up to me it wouldn't

23:10 amalloy: hiredman: heh, not unreasonable. personally i'm glad to have it but wish it had a shorter name

23:11 * amalloy prefers to count ideas, but that's just snobbery

23:11 ossareh: emacs error: "Variable binding depth exceeds max-specpdl-size"

23:11 any emacs people able to help me with ^

23:12 technomancy: ossareh: that's a stack overflow

23:15 ossareh: swank.commands.basic$eval985$invoke_nth_restart_for_emacs__986.invoke(basic.clj:447)

23:15 that seems to be the top level exception - pressing "0" to quit to slime causes the other exception

23:15 technomancy: M-x toplevel might be of help

23:16 ossareh: technomancy: gets me back to slime, thanks - though I can't do anything - seems it is fubar.

23:17 technomancy: M-x slime-connect will get you a fresh connection

23:18 ossareh: slime-net-filter(#<process SLIME Lisp> "000023(:write-string \"nil\n\" :repl-result)000016(:return (:ok nil) 66)000019(:debug-activate 1 1 nil)")

23:18 auser: hola technomancy ... I've got a q for you... I want to run a function before all the tests run when using 'lein test' Is that possible?

23:19 technomancy: auser: yeah, that's what robert hooke is for; see the prepend macro

23:19 auser: thanks :)

23:19 technomancy: https://github.com/technomancy/robert-hooke

23:19 auser: how about all the tests globally?

23:20 before everyone, I mean

23:20 looking, thanks for the link technomancy

23:21 technomancy: also possibly relevant: http://technomancy.us/141

23:52 cemerick: Back in the compojure 0.3.x days, a response vector's contents would be intelligently merged into a single response map for ring. That looks to have been removed; is the equivalent still available somewhere in the current revs of compojure or ring?

23:57 hrm, I suppose not; that behaviour was implemented by an update-response multimethod with a variety of impls

Logging service provided by n01se.net