#clojure log - May 10 2010

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

0:00 _brian2_: so I can log in remotely

0:00 DuneMan: yeah, though I don't run mongo with authentication...

0:00 _brian2_: I dont see that documented

0:00 in congomongo

0:01 DuneMan: doesn't look like the connect call takes any args about user/pass

0:02 _brian2_: so can it really connect?

0:02 DuneMan: http://www.mongodb.org/display/DOCS/Java+Tutorial#JavaTutorial-Authentication%28Optional%29

0:02 sexpbot: "Java Tutorial - MongoDB"

0:02 _brian2_: ok thanks

0:03 DuneMan: might have to write a bit of clojure wrapper to that...

0:03 _brian2_: ok

0:04 DuneMan: (.authenticate (:mongo *mongo-config*) ....) or something

0:05 or maybe write a better mongo! function that supports auth

0:05 and submit a patch :-)

0:05 (I'm using mongo + clojure in a trusted environment right now, so... yeah)

0:05 _brian2_: ok

0:07 technomancy: interesting. the new slime.el has the same problem with the old slime-repl.el as with the new one.

0:07 DuneMan: Performs well... though I do see some weird memory usage patterns come up when generating lots of writes with congo. Might just have something to do with the allocation pattern of the bson objects.

0:07 technomancy: hugod: could you toss me the sha of the revision you're on?

0:07 _brian2_: there was a post about that on the mail list

0:08 DuneMan: Basically allocates 500megs of objects and releases them

0:08 which in my case means I get these huge GCs about once a minute

0:08 even with the concurrent collector

0:08 _brian2_: or a question, anyways, that the author will probably answer

0:08 DuneMan: but I haven't had a chance to debug it since... well... it was friday :-)

0:09 so if he doesn't answer it I'll probably spend some time this week going through and seeing if I can figure out why it's happening.

0:09 thanks for poiting that out, I'll look for the post

0:09 :-)

0:09 _brian2_: ok

0:09 Im glad somebody else is out there working on this

0:10 not just me'

0:10 DuneMan: *nods*, lots of us.

0:11 Not sure how many people are using it from java/clojure, but at least some.

0:11 I did my first cut at the project in python, and am now writing the real server in clojure.

0:12 but yeah, talked to some people from Intuit at mongosf, and from ShareThis!, apple, etc.

0:12 doing similar things to what I'm doing... which is event processing/stats

0:12 _brian2_: cool, well I'm more of an applications guy than engineer

0:13 DuneMan: Finding both clojure and mongo suitable?

0:13 _brian2_: though I'd love to learn more

0:13 very

0:14 technomancy: aha; I guess the call to slime-setup is not optional

0:14 DuneMan: Well, I've been spending lots of time in here, learning etc, so maybe we can help each other ;-)

0:14 technomancy: so much for "I hate elpa because it's not the \"standard\" way to install emacs libs" =P

0:15 _brian2_: great, nice to meet you

0:15 i'm using it to process twitter data

0:15 mine it that it

0:16 DuneMan: Do you work for Publitweet by any chance?

0:16 _brian2_: is

0:16 no, I'm independent

0:16 DuneMan: ah, okay.

0:16 I talked to someone from there at mongosf too, so thought you might have been involved.

0:17 _brian2_: its huge

0:17 or will be

0:17 DuneMan: Yeah, eveyone's trying to make that work.

0:17 _brian2_: totally, its the wild west

0:18 DuneMan: :-)

0:18 _brian2_: ok, I live in arizona

0:18 DuneMan: ahah, I live in SF.

0:18 _brian2_: we're all cowboys here

0:18 MadWombat: technomancy: I wish it was more standard than it currently is

0:18 DuneMan: and work aproximately 1 mile from twitter.

0:19 _brian2_: cool

0:19 MadWombat: I am in the middle of NM desert, so I am more of a cowboy than either of you :)

0:19 _brian2_: nice

0:19 DuneMan: I spent last summer hiking around the southwest

0:19 love it.

0:19 technomancy: MadWombat: well if trends continue, package.el will keep getting better and slime's crazy custom stuff will keep getting worse

0:19 MadWombat: agreed :)

0:20 _brian2_: totaly..

0:21 MadWombat: albeit the relative cowboyness depends on particular region of AZ

0:21 _brian2_: for sure, we have alot fake ones here

0:21 and real ones too

0:21 DuneMan: I spent a couple weeks in Taos, where... instead of Cowboys there are... well

0:21 newage potheads

0:22 which is much more my style

0:22 _brian2_: i've had more new age here than I can take

0:22 DuneMan: then you'd hate sf!

0:22 _brian2_: everybody is a "healer"

0:22 DuneMan: I live with a life coach.

0:22 _brian2_: lol

0:22 DuneMan: and my ex is a life coach and dula

0:23 _brian2_: one guy I worked for is a re-incarnated moses or soemthing

0:23 DuneMan: nice.

0:23 technomancy: man, moses would be so confused if he were re-incarnated

0:24 DuneMan: Honestly, I like being around those people.

0:24 Because it helps to balance me out.

0:24 _brian2_: I rather music, hiking, ladies, anything else

0:27 somnium: DuneMan: ping

0:27 DuneMan: pong

0:28 somnium: DuneMan: you were having a memory leak with cm?

0:28 saw the question on the group, was pondering a reply but have no idea about the issue

0:28 DuneMan: Not a leak, but a strange pattern where the GC does big deallocs after allocing 400-500mb of data

0:29 And it looks like the GC is trying to figure out what to do.

0:29 Because the slope of the growth curve changes

0:29 (but its linear)

0:29 However, everything *does* get deallocated.

0:30 (Are you online at night or during the day mostly? [im in PST])

0:30 somnium: DuneMan: after reads or inserts? All of the resource management is proxied through the java-driver, but lazy-seqs plus cursors can be weird

0:30 DuneMan: Inserts

0:30 basically I'm doing 2000+ inserts/seconds

0:30 second*

0:30 somnium: more often at night EST

0:31 DuneMan: I tend to work late, so, that might work anyway

0:31 somnium: mass inserts in chunks of 2000?

0:31 DuneMan: yes.

0:32 The driver has to coerce all my data from normal hash-maps into bson objs

0:33 I'll do a memory dump and jhat it

0:33 and see where the memory's at.

0:34 somnium: its stuffs them into an array, so it will blow up on really big mass inserts

0:34 DuneMan: So maybe the GC just isn't keeping up with deallocing big arrays?

0:35 so then it periodically does a big stall and cleans them all up?

0:35 somnium: that sounds reasonable

0:36 DuneMan: Is the array stuffing done on the congo side?

0:36 somnium: its gotten a bit outdated, the .java can all be replaced with protocols, and a 2.0 vs of the java-driver came out

0:36 DuneMan: are you gonna be doing work on that?

0:36 somnium: plus at least two forks have more features, hoping to consolidate when clojure 1.2 comes out

0:39 DuneMan: my usage of the lib is fine with this memory usage, and I currently only need mass inserts and simple finds.

0:40 but I'm interested in the lib getting better, so I may be willing to do some work on it if that's needed :-)

0:41 somnium: DuneMan: I did a pass on protocols back in November (amazing theyve been around that long) with good results, that plus the forks

0:41 DuneMan: who did the forks?

0:42 somnium: I havent actually used it much in last 2 months :/ It fit a couple projects like a glove, hope to use it again soon

0:42 rads and jcromartie

0:42 DuneMan: it fits my current project like a glove, in fact.

0:46 What features are you thinking of merging back?

0:48 somnium: I like the validation features, I need to go back and look at it

0:52 DuneMan: priv ok?

0:52 DuneMan: sure.

1:50 LauJensen: Morning all

4:37 jwr7: technomancy: oh, cool, I was hoping a new release was coming. Managing swank-clojure and slime versions is becoming a serious problem. Plus, there is lots of confusing information floating around (witness my utf-8 encoding pull request, based on outdated jochu's repo)

4:37 will test

4:42 technomancy: although I guess it would help a bit if you provided a URL or another pointer to the new versions…

5:16 AWizzArd: Native speakers, is it a) introduction into web services or b) introduction to web services ?

5:18 Fossi: as non-native i'd say to. into sounds like a common german mistake

5:18 then again i could be wrong ;)

5:19 AWizzArd: à propos german, Fossi, you should also visit #Clojure.de :)

5:19 Fossi: ah, thanks for the hint

5:23 SynrG: yes, b

5:23 AWizzArd: ok, thanks

5:25 rava: hello

5:26 AWizzArd: Hallo rava.

5:27 rava: i'm trying to figure out the best or at least the most idiomatic way of putting together a gui front end for some shell scripts in linux env

5:29 the scripts run on a server, and users would connect to the server with the app (which basically list and decrypt pgp files). i'm wondering if it makes sense to do a webstart app using swing or use some RIA web front end and servlet

5:30 AWizzArd: rava: you could try clj-pivot

5:30 http://github.com/hoeck/clj-pivot

5:30 Lets you easily use Apache Pivot ( http://pivot.apache.org/ ).

5:30 sexpbot: "Apache Pivot"

5:31 rava: ooo, pivot looks neat

5:33 AWizzArd: true

5:34 Your gui could be offered via WebStart (or as an Applet, or as a download of a double-clickable .jar)

5:35 rava: the thing is, if you are not experienced with WS, then you can easily spend 2 days on it, to learn how to use it. It is nothing intuitive that can be done within 15 minutes if you never did it before.

5:35 rava: I'm still new to java app distribution, coming from a python/web developing background

5:36 AWizzArd: Yes, and this all is doable, it just could mean that you won't get WebStart running immediately.

5:36 If you really need something very fast and small, then maybe pure html+js could also make sense.

5:37 But going the route with Pivot will allow you to use all Java libs in the browser, all of Clojure and Contrib, etc.

5:39 rava: i'm wondering if i can just save myself some hassle and make some compojure web services and just interact with them using gwt, otherwise i'd have to mess without remote method calls

5:40 since it would be clients sending calls to the server

5:42 AWizzArd: rava: you can use compojure to offer RESTful web services.

5:43 That is what it can do really good.

5:43 rava: exactly what i was thinking

5:43 since i'm already used to chugging out REST apps

5:43 AWizzArd: And btw, Pivot was well designed to communicate with such a setup.

5:43 rsynnott: rava: that's possibly better, yeah

5:44 AWizzArd: Compjoure can take GET, POST, UPDATE, DELETE from your client, and reply for example with a json object.

5:44 rava: figured i'd save myself the headache of java's rpc

5:44 rsynnott: a lot of people don't _like_ 'rich web applications' (scary plugin-based things) very much

5:44 rava: ah, the beauty of gwt, no plugins required

5:44 now the w3 needs to hurry up with html 5 with decent svg support

5:44 rsynnott: yep

5:44 AWizzArd: As soon gwt switches to html 5 a whole new browser is required, which seems to be much heavier than just a plugin.

5:45 rsynnott: rava: well, IE<=8 will still be around until 2020 or so, no doubt :(

5:45 AWizzArd: There is also a GWT section: https://cwiki.apache.org/PIVOT/frequently-asked-questions-faq.html

5:45 rava: feh, they'll adapt or die. its already slowly dieing. my env is 100% linux/mac though so i don't even have to worry about it :)

5:47 rsynnott: In general, though, attempts to make people use actual applications written as java applets, flash, silverlight or what have you have not ended well

5:47 rava: indeed

5:47 rsynnott: (though java isn't quite as bad as flash there; at least it has a proper UI)

5:47 *UI libraries

5:47 AWizzArd: The technology evolved in the past decade.

5:47 rava: ntm java applets don't crash a whole system when they go wonky

5:48 AWizzArd: It does not make sense to take the 1997 experience with applets to see how the ones of today work.

5:48 GWT - coding in Java, not Clojure. Having only some JS libs, not everything that the jvm offers, including: no Clojure.

5:48 Just depends on what you want/need.

5:49 rava: aye, can't use clojure for the gwt stuff, but i use gwt to interact with a bunch of different stuff so its no big deal

5:50 with guice dependency injection it makes it slightly less painful to use it

5:51 AWizzArd: html 5 also won't solve too many things. It will have a Canvas, but Java2D offers way more things it can do. And GWT is only Java 5 I think.

5:53 rava: i just like the idea of highly customizable drawing canvas that i can play with in the dom

5:53 so my client code wouldn't be tied to a specific back end

5:55 AWizzArd: yes

5:57 rava: which is what makes me hang onto gwt even though it ties to me writing more java code (which is distastefully verbose for a python guy)

5:59 AWizzArd: yay :)

6:01 GeoffSK: why does this give an exception: (-> 10 (fn [x] (+ 3 x)))

6:02 AWizzArd: ,(-> 10 (fn [x] (+ 3 x)))

6:02 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:02 AWizzArd: GeoffSK: because of the macro expansion:

6:02 ,(macroexpand-1 '(-> 10 (fn [x] (+ 3 x))))

6:02 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:03 AWizzArd: well, it becomes: (fn 10 [x] (+ 3 x))

6:04 ,(fn 10 [x] (+ 3 x))

6:04 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:04 GeoffSK: so i have to use actual functions, not anonymous functions with the thread operator

6:04 ?

6:04 AWizzArd: yes

6:04 -> only transforms the code

6:05 GeoffSK: is that a bug?

6:05 AWizzArd: no, it is intended to work this way

6:05 GeoffSK: i guess when i know more that will make sense.

6:05 Thanks for the explanation.

6:06 AWizzArd: -> operates on the code directly, and just "injects" a literal expression at the first position in the following expression

6:08 GeoffSK: like a reader macro?

6:08 AWizzArd: (-> 5 (+ 2) (* 4)) becomes (-> (-> 5 (+ 2)) (* 4)) which becomes (* (-> 5 (+ 2)) 4) which becomes (* (+ 5 2) 4). Now this expression contains no macro, only functions.

6:10 GeoffSK: your explanation makes perfect sense.

6:11 AWizzArd: GeoffSK: macros can not be evaluated/executed. Before compilation there comes the macroexpansion time, in which all macros are removed from your code.

6:12 GeoffSK: i was expecting some sort of reverse comp(ose) function.

6:14 AWizzArd: well yes, it is similar... but also comp would not result in 13 for (comp (fn [x] (+ x 3)) 10)

6:14 but you could do something such as

6:14 ,((comp (fn [x] (+ 3 x)) (constantly 10)))

6:14 clojurebot: 13

6:16 GeoffSK: clearly i have no idea.

6:17 AWizzArd: well, you were pretty close

6:19 GeoffSK: ((comp #(+ % 3)) 5) ; works

6:19 rava: i have to admit

6:19 the pivot demos look smooth

6:20 Chousuke: GeoffSK: but that's just the same as (#(+ % 3) 5)

6:20 rava: i'll have to play with it. the good thing is that my company's software is all java and xml

6:20 so whatever i make can likely be cludged in esle where for later

6:20 good night guys, thanks for advice/chat. great new tool this clojure is

6:23 GeoffSK: who is (#(10)) different to (fn [] 10)

6:23 how is (#(10)) different to (fn [] 10) ?

6:23 sorry i meant:

6:23 how is (#(10)) different to ((fn [] 10)) ?

6:33 AWizzArd: GeoffSK: #() is a reader macro. See here:

6:34 ,'#(10)

6:34 clojurebot: (fn* [] (10))

6:34 AWizzArd: so (#(10)) is different from (fn [] 10)

6:34 ,(10)

6:34 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

6:34 AWizzArd: ,(do 10)

6:34 clojurebot: 10

6:35 AWizzArd: ,(#(do 10))

6:35 clojurebot: 10

6:35 GeoffSK: it looks like i am expect reader macros to be macros (and they obviouslt can't be)

6:35 AWizzArd: The reader macros are very similar to normal macros. They only run during read time.

6:36 while macro expansion time comes afterwards

6:38 GeoffSK: doesn't that mean #(...) should expand to (do ...) rather than (...)

6:38 AWizzArd: no

6:39 #(+ 5 %) would become (fn [x] (do + 5 x))

6:40 ,((fn [x] (do + 5 x)) 100)

6:40 clojurebot: 100

6:40 GeoffSK: yep that makes sense

6:41 AWizzArd: The first expression within #() should typically be a symbol, denoting a fn or a macro.

6:41 GeoffSK: #(5) becomes (fn [] 5), only it doesnt, it becomes (fn [] (5) - thus my error.

6:43 AWizzArd: when you want to say 5 then just say 5, not #(5)

6:44 GeoffSK: yes, i am just using it as minimalist example.

6:44 AWizzArd: right

6:44 GeoffSK: thanks for help, i have to do more reading and coding.

6:47 AWizzArd: np

7:20 tgk: I think there is a function for replacing values in a map with f of their values, but I can't find it. Any suggestions?

7:26 GeoffSK: isnt that just map?

7:27 tgk: Does that work on maps? That just returns a lazy-seq, doesn't it?

7:28 It might not exist, I can give a usage example of what I thought existed

7:29 (magic-fn {:a 1 :b 2} {"first" :a "second" :b}) => {"first" 1 "second" 2}

7:29 GeoffSK: sorry i meant doseq

7:30 tgk: Hmmm no

7:36 dnolen: ,(let [m {:a 1 :b 2}] (into {} (map (fn [[k v]] [k (m v)]) {"first" :a "second" :b})))

7:36 _mst: tgk: there's clojure.contrib.fnmap, but I'd probably just (zipmap (keys mymap) (map myfn (vals mymap))) normally

7:36 clojurebot: {"first" 1, "second" 2}

7:36 AWizzArd: uhm...

7:37 do you want to replace the keys or the values?

7:37 tgk: The values, I think I have an answer now

7:40 I'll use dnolens solution, but I just assumed there was a function for doing it. Thanks guys.

8:02 naeu: what are the clj equivalents of Ruby's Enumerable#find and #find_all

8:03 i.e. [1,2,3,4].find{|i| i > 2} ;=> 3

8:03 so I can do: (blah #(> 2 %) [1 2 3 4])

8:08 AWizzArd: naeu: filter

8:08 ,(filter #(> % 2) [1 2 3 4])

8:08 clojurebot: (3 4)

8:09 AWizzArd: and in clojure.contrib.seq you can find find-first

8:09 (find-first #(> % 2) [1 2 3 4]) ==> 3

8:57 naeu: AWizzArd: thanks :-)

9:15 LauJensen: naeu: Did you notice that my fluidsim has been ported to penumbra? Its in the /test/examples/gpgpu/ lib on the master branch

9:16 Now doing about 30fps on a 800x600 board on non-unix systems :)

9:16 naeu: LauJensen: nice

9:16 how is penumbra doing?

9:17 last time i played with it it was using full cpu for the cube example

9:17 seemed that it was running the event loop too quickly or something - i.e. essentially doing a lot of busy waiting

9:17 jcromartie: hi, someone mentioned me yesterday, but it scrolled off

9:18 LauJensen: naeu: its really shaping up

9:18 Cube demo ran fine here

9:18 naeu: low cpu usage?

9:18 LauJensen: jcromartie: clojure-log.n01se.net

9:18 jcromartie: thanks

9:18 LauJensen: naeu: I honestly didn't check, but I have a graph on-screen all the time so I would have noticed I think

9:18 (ie. noticed if it went high)

9:19 naeu: oh, cool

9:19 I bought a 3D mouse the otherday

9:19 LauJensen: ?

9:19 naeu: a 3DConnexion SpaceNavigator

9:19 just hooking it up to Clojure just now

9:20 LauJensen: $google 3DConnexion SpaceNavigator

9:20 sexpbot: First out of 17500 results is: 3Dconnexion : Start

9:20 http://www.3dconnexion.com/

9:20 naeu: should be fun to control penumbra visualisations with

9:20 I got the SpaceNavigator for Notebooks

9:21 LauJensen: That looks like serious fun

9:21 naeu: indeed

9:22 zakwilson: I'm getting "Content is not allowed in prolog." trying to parse an XML file with clojure.xml/parse. I believe the encoding is set properly, and a BOM is present (those being problems I encountered previously). Suggestions?

9:22 naeu: LauJensen: are you one of the guys doing the clojure tutorial in Belgium?

9:23 LauJensen: Yes sir

9:28 naeu: how's it going?

9:28 I would have loved to tag along

9:28 but my company would never pay for such a thing given that we're a Ruby shop

9:29 zakwilson: Being an X shop has always seemed like a mistake to me.

9:30 LauJensen: naeu: Its going to be quite a blast I think - Would be great if you could talk them into joining :)

9:33 Borkdude: LauJensen: do you guys have a date yet?

9:34 LauJensen: Borkdude: Its Wed-Fri 23-25 of next month

9:35 rsynnott: zakwilson: X11, in this day and age? :)

9:35 Borkdude: LauJensen: ah

9:36 zakwilson: rsynnott: It still does the job.

9:37 rsynnott: well, but very few interact with it directly anymore

9:37 (it was a bad joke :) )

9:40 zakwilson: If I had to guess, I'd say more people interact directly with X11 now than ever before.

9:41 rsynnott: nah; everyone uses libraries

9:41 zakwilson: Ahh... I thought you meant end-users.

9:58 This is maddening. I stripped an XML file to its bare essentials and still can't parse it. I hand-typed an exact copy in Emacs, and clojure.xml/parse parses that, but not the original. diff shows no difference. Their md5sums are the same.

9:58 naeu: LauJensen: sadly that's never going to happen. Maybe I'll take a trip for the post talk drinks? :-)

9:59 LauJensen: naeu: You're more than welcome - Or you could leave the phone number for your boss and I'll see what I can do for you :)

9:59 naeu: zakwilson: I couldn't agree more with your dislike of X shops. So if you can't change your job, change your job - which is exactly what I'm doing.

9:59 LauJensen: (gotta go afk)

10:00 zakwilson: naeu: I'm freelance, and working on a possible startup.

10:00 naeu: LauJensen: wouldn't help, I'm leaving my job in Aug anyway, so he wouldn't train someone leaving in a language he doesn't see the value in ;-)

10:01 Borkdude: Then take some time off and pay yourself

10:01 or join zakwilson 's startup and he'll pay

10:02 zakwilson: Found the problem with clojure.xml/parse: it doesn't like the *filename*. I'm not sure exactly what about it it doesn't like though.

10:02 Hodapp: how do I wash all the C++ off my hands? it's always stuck there after work

10:02 zakwilson: Borkdude: he'll have to wait until I have a product for that. Right now, I just have a kick ass text classifier.

10:03 naeu: Borkdude: I'm actually leaving to do some research at Cambridge University without funding

10:03 so i'll be strapped for cash :-)

10:03 Borkdude: naeu: sounds great :)

10:03 what exactly will you be working on?

10:03 naeu: I'll be spending the year building musical instruments/compositions with Clojure and SuperCollider

10:04 Hodapp: naeu: Will you be using them together? Or what?

10:04 I have wanted to learn SuperCollider but I just haven't had the time

10:04 naeu: Hodapp: yep, together

10:04 Borkdude: what is the group you're joining called?

10:04 Hodapp: messed with Pd a little bit though

10:04 naeu: have you seen Overtone?

10:04 It's a really exciting project with great potential

10:04 it's a Clojure language environment for SuperCollider

10:05 Hodapp: ooh

10:05 I

10:05 ...er... (damn, tiny keyboard)

10:05 I

10:05 GAH

10:05 * Hodapp shuts up

10:05 naeu: http://project-overtone.org/

10:05 sexpbot: "Home"

10:05 Hodapp: naeu: thanks. That looks interesting.

10:05 naeu: yeah, it's great

10:06 the creator, Jeff Rose is also really nice too

10:06 he lives in Amsterdam too

10:06 so we've been hanging out a lot

10:06 Borkdude: naeu: are you from Amsterdam?

10:06 naeu: Borkdude: no, I'm English, but I've lived here for 2.5 years

10:07 (here being Amsterdam in this context)

10:07 Borkdude: for work/research?

10:07 naeu: work

10:07 Borkdude: company?

10:07 Hodapp: naeu: ever used Processing much?

10:07 naeu: but now going back to research for a bit

10:07 I work for a company called innovation factory

10:07 Borkdude: naeu: sounds great, I used Lisp for the first time for a year long in a group called Music Mind Machine

10:07 naeu: it's a nice place, but I'm much less of a programmer and much more of a thinker

10:08 so I'm looking forward to a year of research

10:08 whilst I figure out what the hell i want to do with my life :-)

10:09 Borkdude: cool - what kinds of thing did you build with lisp?

10:09 did you find that it was a good fit for music?

10:09 Borkdude: naeu: I made kind of a transformation language for musical structures, like if you have a legato from the one note to the other note, and stretch it, it will behave differently than a vibrato

10:10 naeu: Borkdude: how cool

10:10 is any of the stuff still available (and open source)?

10:10 Hodapp: is Common Lisp Music any good?

10:10 Borkdude: naeu: that was my first project

10:11 naeu: the second project was about analysing performances using the musical structure, and also being able to amplify some characteristics like short or long phrases

10:11 naeu: seems to me that most high level languages are rubbish for live synthesis of music, but limited to either offline transformations or high-level control of synthesis engines

10:11 Borkdude: it was not at the synthesis level though, all symbolic

10:11 naeu: sure, perfect for a lisp

10:12 Borkdude: naeu: there is still smth online here, but no source files: http://www.nici.kun.nl/mmm/drempdemo/drempdemo.html

10:12 sexpbot: "Music, Mind, Machine Group :: de- and recomposition demo"

10:12 naeu: i want to be able to do both at once - symbolic manipulation and generation and live synthesis

10:12 which is why i think the combination of clojure and supercollider to be full of potential

10:13 Borkdude: naeu: of course the symbolic representation could be translated into a midi file which could be sent to a sequencer/synthesizer

10:13 naeu: Borkdude: I want more than just OSC/MIDI communication. I want to be able to define synths on the fly :-)

10:14 Hodapp: don't a lot of these languages end up being dataflow languages where you're sort of stuck at runtime with whatever you started with?

10:14 code-wise

10:14 naeu: Borkdude: this is very impressive. I'm amazed that you managed to keep the form of the original whilst only modifying the style

10:15 Hodapp: what do you mean? Could you expand?

10:16 Hodapp: naeu: e.g. Pure Data; the actual structure through which data flows cannot really change while you're running, at least not in a programmatic way

10:16 naeu: Hodapp: true, but you can control the data structures in scsynth with parameters, and you can also replace the structures with a minimal time cost

10:17 Borkdude: naeu: this group I was in now moved to Sheffield apparently: http://www.sheffield.ac.uk/music/staff/academic/reneetimmers/mmm

10:17 sexpbot: "Music mind Machine"

10:18 Hodapp: naeu: I haven't used supercollider at all yet, so I was more asking than saying

10:18 naeu: Hodapp: it's worth looking at. It essentially offers a programming interface to PD-style data graphs

10:18 so instead of pointy-clicky-click, you can typey-type-type

10:18 and with Overtone you can macro-boom-expand

10:19 Hodapp: lol... I think you can typey-type-type in Pd too but I haven't used it in awhile

10:19 I just used it to generate some particular waveforms for a subwoofer to output near a solution of corn starch and water because it makes for very interesting effects

10:20 naeu: hahahahahaha

10:23 Hodapp: naeu: did you ever answer if you'd used Processing at all or not?

10:27 naeu: Hodapp: sorry, I forgot to answer - I have looked at it, but haven't used it for anything serious

10:28 I think it's pretty cool though

10:28 Hodapp: It's quite neat, but I'm not much a fan of Java sometimse

10:29 just find it clumsy and verbose, though not nearly as much as C++

10:30 but Processing is definitely fun to play with... unfortunately, I always want to visualize in real-time the algorithms that take too much computation to do well on a single CPU

10:30 and things get messy quickly when you try to throw SIMD or GPUs or clustering into the mix

10:31 praptak: How to get a static field value of a class given as an expression/variable? As in (let [z Math] ("get PI here using z - (. z PI) obviously does not work"))

10:32 naeu: Hodapp: do you have any opinions on the difference between Processing and Penumbra?

10:33 Hodapp: Penumbra?

10:33 Borkdude: praptak: why would you want to do that?

10:34 praptak: Well, if it's possible I want to be able to do that :)

10:34 I'm just curious.

10:35 naeu: Hodapp: http://github.com/ztellman/penumbra

10:38 Hodapp: naeu: unavailable

10:39 naeu: hmmm, i was just on it

10:39 defn: yeah it's there

10:39 Hodapp: hmm, it did say "temporarily unavailable"

10:40 yeah, it's up for me now

10:40 penumbra looks like it has a much more narrow focus than Processing

10:44 zmila: while github/penumbra is down one may use http://www.penumbragame.com/ :))

10:44 sexpbot: "The Penumbra Series"

10:46 naeu: I get errors in Penumbra's HEAD running the examples

10:47 Hodapp: zmila: Penumbra is quite an awesome game.

10:48 zmila: Hodapp, very maybe :) but it refused to start on my laptop

10:54 rlmcintyre: Hi everyone -- I'm writing a macro to create proxies of java objects. It's for a very.... strange thing we're playing with here at the MIT AI lab. Anyway, my macro works when I copy and paste the output of macroexpand-1 into the repl, but not when I try to directly call the function. Shouldn't this be impossible?

10:57 Borkdude: rlmcintyre: sounds weird indeed

10:57 rlmcintyre: An example that shows what I'm talking about is:

10:57 (defmacro proxy-functions-bad

10:57 []

10:57 (into

10:57 (list (list (symbol (str "run" "")) [] (list 'println 5)))

10:57 (list [] (vector Runnable ) 'proxy)))

10:57 It works if you copy and paste macroexpand-1's output, but not if it is directly called.

10:58 I feel like this souldn't be possible at all.

10:59 chouser: rlmcintyre: yes, the symbol function is too permissive

10:59 rlmcintyre: yes, the symbol function is too permissive

11:00 rlmcintyre: what's going on though -- isn't it the same reader in both cases?

11:01 chouser: the problem is the symbol you're creating prints differently than it reads.

11:01 ,(symbol "run" "")

11:01 clojurebot: run/

11:02 chouser: ,(read-string (pr-str (symbol "run" "")))

11:02 clojurebot: java.lang.RuntimeException: java.lang.Exception: Invalid token: run/

11:02 nurv: Hi.

11:04 chouser: rlmcintyre: the reader isn't involved after macroexpand, so that bad symbol gets passed along. But when you paste that macroexpanded result into a REPL, the reader is involved.

11:05 hiredman: ,(symbol ":foo")

11:05 clojurebot: :foo

11:05 chouser: rlmcintyre: you just need to make sure that the symbols you produce with the symbol function still obey the constraints documented here: http://clojure.org/reader

11:06 rlmcintyre: but then this means that the homoiconicity of the language is broken w.r.t. the sumbol function?

11:06 chouser: rlmcintyre: http://www.assembla.com/spaces/clojure/tickets/17

11:06 sexpbot: "#17 - GC Issue 13: validate in (keyword s) and (symbol s) (Test) | Clojure | Assembla"

11:08 chouser: rlmcintyre: I don't think I'd put it that way. All valid clojure programs are made up entirely of valid clojure objects (symbols, lists, maps, etc.)

11:08 rlmcintyre: so it's more of not catching an invalid program then

11:08 I see

11:08 chouser: wyeah

11:08 yeah

11:09 Nobody promised that every possible datastructure can be printed and re-read to produce identical results.

11:09 ,(java.util.Date.)

11:09 clojurebot: #<Date Mon May 10 08:14:04 PDT 2010>

11:10 chouser: ,(read-string (pr-str (java.util.Date.)))

11:10 clojurebot: java.lang.RuntimeException: java.lang.Exception: Unreadable form

11:20 Borkdude: Does Java have verbatim strings like C# or do I have to put "\\w" in regexes?

11:21 Licenser: aloa

11:21 Borkdude: no and no

11:21 hiredman: Borkdude: clojure is not java, and java does not have regex literals, which clojure does, and clojure's regex literals are read differently by the reader from strings

11:22 Borkdude: hiredman: I was asking about Java, not Clojure

11:22 Licenser: oh I thought you were talking clojure too, I've no idea aobut java

11:23 hiredman: Borkdude: well, you picked an odd place to ask

11:23 Borkdude: yeh, sorry for the confusion

11:23 hiredman: I think not, since there must be some Java people in this room ;)

11:23 naeu: how do i create a regexp matcher from a string?

11:23 hiredman: more in ##java

11:24 but I do believe Licenser did answer for java

11:24 at least as far as the first no

11:24 Licenser: lies, all lies, I think for java it is no and yes

11:25 Borkdude: this is the java support group, it is like asking in a dry alcoholics group 'hey how do I mix a long isaland ice tea*'

11:25 Borkdude: haha

11:27 Anonymous Javadevs?

11:27 Licenser: yea something like that

11:27 kylesmith: Does anyone have any thoughts/experience implementing iterative algorithms with Batch systems (such as PBS)?

11:27 Licenser: Hello everyone, please welcome Blkt to our group. Blkt do you want to share your problem with us?

11:28 Borkdude: Licenser: I will only join if the classes are anonymous too ;-)

11:28 Licenser: Borkdude: we use proxy

11:28 kylesmith: no but I think there are some examples in the sun HP-Cluster package

11:29 kylesmith: Ack, I should have said search algorithms.

11:29 Licenser: link?

11:30 Licenser: kylesmith: let me dig it out

11:31 since oracle bought sun all went down the tdrain there :(

11:31 Blkt: Licenser: I actually do not have any kind of problems but I'll be glad to inform you whenever I got one :)

11:31 Licenser: That is OK Blkt we all take our time untill we are ready to admit our problems

11:32 kylesmith: http://gridengine.sunsource.net/ is the one thing I mean

11:32 sexpbot: "gridengine: Home"

11:32 Licenser: I think at least

11:33 Borkdude: Off to the train, the place I can read some more The Joy of Clojure.

11:37 kylesmith: Licenser: I already have access to a cluster with PBS installed. My problem is I must modify some search algorithms to use PBS, but I want to make sure there isn't an easier way first.

11:38 Licenser: kylesmith: I just menated that in the sge package there are some examples of algorismth

11:43 kylesmith: Licenser: I found the javadocs, but there isn't an sge package.

11:43 Licenser: hmm the sun grid engine, I downloaded it a year ago,

11:47 kylesmith: Licenser: I don't think the sun grid engine is what I want.

11:47 Licenser: I know all I was saying is that there were examples in ther that might help

11:49 kylesmith: I can't find the examples.

11:55 chouser: it would be so nice if auto-gensym worked in nested unquote/syntax-quote contexts

11:55 that shouldn't be impossible, should it?

11:55 Chousuke, hiredman: did either of you look at doing that in your readers?

12:05 puredanger_: so is clojure.contrib.string now the place I should look first for string-related functions in a clojure 1.2 world ?

12:06 chouser: puredanger: I think that's right.

12:06 lpetit: puredanger_: I guess so

12:06 $mymail

12:06 chouser: unless those have moved to clojure.string

12:07 puredanger: afaict there is no clojure.string (yet)

12:16 what's the preferred path to submit a docstring bug for something in clojure core or contrib? assembla ticket? fork and a patch? being whiny in irc? ;)

12:17 technomancy: puredanger: even trivial patches won't get accepted without mailing in a dead-tree contribution agreement, so unfortunately the latter is probably your best bet.

12:18 puredanger: how about filing an assembla ticket *without* a patch?

12:18 technomancy: actually that'd probably be fine

12:22 puredanger: technomancy: done: https://www.assembla.com/spaces/clojure/support/tickets/344-reduce-docstring-args-don-t-match-docs

12:25 hiredman: chouser: I did not, I know Chousuke was looking at making syntax-quote a macro, something which I have recently become interested in

12:27 do you really think nesting is desired?

12:30 ,(squote '(A B C# (unsquote-splice [1 2 3]) C#))

12:30 clojurebot: (list (quote sandbox/A) (quote sandbox/B) (quote C__15399) 1 2 3 (quote C__15399))

12:32 puredanger: it seems to me like this should return nil rather than throw NPE: (replace-str "a" "b" nil)

12:33 hiredman: ,(doc replace-str)

12:33 clojurebot: excusez-moi

12:33 puredanger: opinions?

12:34 to be more precise: (clojure.contrib.string/replace-str "a" "b" nil)

12:34 user=> (doc replace-str)

12:34 -------------------------

12:34 clojure.contrib.string/replace-str

12:34 ([a b s])

12:34 Replaces all instances of substring a with b in s.

12:34 chouser: hiredman: nice

12:35 hiredman: as a multimethod it works out well

12:35 chouser: but yes, I'd like to `(fn [a#] ~(for [x [1 2 3]] `(a# ~x)))

12:35 hiredman: well, sure

12:36 chouser: that's all I meant

12:36 hiredman: I know

12:36 I just don't now that it is wise to support such a thing

12:37 could be, I am not sure though

12:37 chouser: I'm having trouble seeing how it would be a problem.

12:39 hiredman: chouser: for must macroexpand to something that could contain a `#a somewhere right?

12:39 er

12:40 a#

12:40 chouser: I was thinking the outer ` would register the name it picks for a# somewhere so that the inner a# could find it

12:40 hiredman: right, but the for

12:41 I dunno

12:41 *shrug*

12:41 chouser: oh, uh -- yeah, I guess so.

12:41 hiredman: monday morning

12:41 chouser: :-)

12:42 Licenser: okay something to try out: http://tryclojure.licenser.net/

12:42 sexpbot: "TryClojure"

12:43 chouser: Licenser: nice

12:43 peregrine81: Licenser: I get security exceptions when I try to do

12:43 (def p "Hello")

12:44 or (defn p [] (str "hello"))

12:45 Licenser: peregrine81: of cause, because defing things isn't allowed

12:45 peregrine81: Licenser: Very nice though I was looking for something like this all weekend I ended up with Lord of The Repls

12:45 Licenser: defing things means storing stuff on the server, storing stuff on the server means the posibility toflood it

12:46 peregrine81: Licenser: how does http://lotrepls.appspot.com/ do it?

12:46 sexpbot: "Lord of the REPLs"

12:46 chouser: Licenser: I'm afraid you're storing stuff on the server anyway.

12:46 hiredman: peregrine81: I imagine they let google worry about it

12:46 Licenser: chouser: am I? but I shouldn't for any long period - I think

12:46 heh

12:46 I'm not sure so, you might very well know something I don't :P

12:47 lotr does not work at al for me

12:47 chouser: huh. do send-off and no agent

12:47 s/do/no/

12:47 sexpbot: huh. no send-off and no agent

12:47 chouser: sexpbot: stopit

12:48 Licenser: chouser: how do you mean?

12:48 chouser: Licenser: those are disallowed fns

12:49 Licenser: hmm do is disallowed?

12:49 na do is fine

12:49 send-off and agent are

12:49 chouser: no, "send-off" and "agent" are disallowed

12:49 right

12:49 Licenser: I know, I write the sandbox it runs in :P

12:50 peregrine81: Licenser: whats the use of clojure without fns its no fun!

12:50 stuartsierra: Does defrecord have a place for a doc string?

12:50 Licenser: peregrine81: use let :P

12:50 peregrine81: Licenser: it just seems there are better ways to get around it then just carpet bomb blocking it

12:51 Licenser: but peregrine81 I amthinking about a way to make stuff persistent but I have to figure some things out first like if the java sandbox can limit memory usage

12:51 but I like my carpet bombs :(

12:51 peregrine81: Licenser: Thats what I was thinking :)

12:51 Licenser: but that means research for java and I don't like java :P

12:51 chouser: it's a bit frustrating to try out expressions when I don't know which parts of normal clojure may happen to be completely disallowed.

12:51 is there a list somewhere?

12:51 peregrine81: Licenser: http://www.devx.com/tips/Tip/14688

12:51 sexpbot: "Setting the Default Memory Limit of the JVM"

12:52 Licenser: oh no I know how to do it for a JVM

12:52 but I want to do it for a sandbox of the JVM

12:52 chouser: stuartsierra: I don't think so. I'm not sure anyone's figured out where a docstring would be stored.

12:52 Licenser: the JVM itself is limited already

12:52 stuartsierra: chouser: ok, thanks

12:52 Licenser: but doing that means 1 user can claim all the memory = bad

12:52 peregrine81: Licenser: my battery is going to die, sorry to run so soon :(

12:53 Licenser: no worries toa care peregrine81

12:53 chouser: stuartsierra: there's a nice options area though -- might show up there eventually

12:53 (defrecord Foo [a b c] :doc "Potential docstring, currently useless and harmless")

12:55 stuartsierra: right

13:03 * fogus reading http://axisofeval.blogspot.com/2010/04/why-i-ignore-clojure.html

13:05 * AWizzArd smells fire :)

13:06 stuartsierra: fogus: I agree with that article in principle, but I also believe the "community process" of Lisp failed decades ago.

13:06 chouser: "Everyone should be writing new Lisps! ... but stop whining about how it's a more modern or better Lisp"

13:07 fogus: stuartsierra: I don't know enough about the Lisp process it to comment

13:07 chouser: so writing new lisps is good as long as we claim they're only the same or worse than existing lisps?

13:07 * chouser loses interest and does something else.

13:07 AWizzArd: This article is not worth discussing it. Now you drove some attention to it which it doesn't deserve.

13:07 fogus: chouser: I take the opposite approach. My Lisp is the worst Lisp ever written, it's neither modern nor good

13:08 stuartsierra: http://xkcd.com/386/

13:08 chouser: sounds like exactly what he's recommending

13:08 sexpbot: "xkcd: Duty Calls"

13:09 fogus: AWizzard: Why is it not worth discussing? Especially on a Clojure channel

13:10 AWizzArd: It just states opinions of a possibly frustated author. It does not outline specfic problems in Clojure, nor strong points of other lisps. Facts could have been discussed, but with whining it is difficult.

13:12 fogus: "Well, if it works, Lisp will adopt it in a couple of decades." <- My favorite part

13:12 AWizzArd: yes :-)

13:13 fogus: I find articles such as http://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html more interesting.

13:13 sexpbot: "Messages not Models: Clojure vs JavaFX Script: only 5x slower!"

13:15 fogus: I like the axisofeval article for a simple reason... people actually think this way. It's nice to know how to address this kind of wobbly criticism. Without outright ignoring it and without becoming the XKCD guy

13:17 AWizzArd: So far it got 0 comments. Just a random guy, frustrated about new technologies instead of embracing them.

13:17 chouser: One thing I'd like to try is to be very affirming about the investment required to learn a new language.

13:17 yes there are a lot of new languages all the time. yes it's hard to know which are worth any time at all.

13:18 yes it requires a lot of time and work to learn any one of them enough to even know if it's worth learning well.

13:18 yes if you choose to learn a particular language well, it may not end up being directly useful to you anytime soon.

13:19 it's hard. we get that. you shouldn't feel bad for ignoring languages based on very little investigation.

13:19 fogus: chouser: That's a perspective that I hadn't considered

13:20 chouser: hopefully that opens a small window of mutual understanding through which you can plant a seed or two, though I'm not sure what the next step should be.

13:20 fogus: Seems incredibly ... reasonable

13:21 chouser: maybe the next step is, "but I've put effort into learning clojure pretty well -- is there anything specific you'd like to know about it?"

13:21 or "what's your current favorite language, and what about it do you like the least?"

13:23 fogus: #2 is my favorite interview question. :-)

13:23 chouser: the second one might be too open-ended. If they say "I like Java the best, but what I hate is deployment pain -- classpaths, incompatible jvms on the target, lack of access to the iphone" there's not much Clojure can do about that.

13:23 yet

13:29 fogus: chouser: I really think you're onto something here. Perhaps the best way to counter this kind of criticism is to defuse it. It's tempting to go and raise a fuss, but I suppose the Internet has enough of that.

13:29 puredanger: personally, I find it's most productive to make AWESOME rather than to try to combat AWFUL

13:30 at least, it's more fun

13:30 chouser: his argument strikes me a bit desperate. Does he really want to sit around waiting for 20 years to use something good that he could use today?

13:30 Borkdude: chouser: what link is this about?

13:31 chouser: and if everyone does that, how do we have any better idea if it's good in 20 years than we do today?

13:31 Borkdude: http://axisofeval.blogspot.com/2010/04/why-i-ignore-clojure.html

13:31 sexpbot: "The Axis Of Eval: Why I ignore Clojure"

13:31 chouser: at least it's short. :-)

13:32 anyway, it seems likely he knows the argument isn't really convincing, it's more a personal expression of emotion, trying to find some basis to allow him to continue ignoring clojure.

13:32 so trying to debate directly would most likely just harden positions.

13:33 fogus: chouser: based on some comments elsewhere, it seems that the Python camp has come to the same conclusion

13:33 chouser: the python camp regards clojure the same way? Or that's how python camp approches evangelism.

13:34 fogus: The python camp has come to the same conclusions about that blog as you have 2-3 sentences before

13:34 Borkdude: hmm, if persistent datastructures would be good, Lisp (Common Lisp?) would adopt it in the long end? isn't that like breaking with tradition?

13:34 chouser: oh. huh.

13:36 Borkdude: it's not clear to me what he means with Lisp. Clojure is a Lisp right?

13:36 so how can Clojure ignore it

13:36 hiredman: he means common lisp, of course

13:37 Borkdude: And Common Lisp would adopt immutability? I don't believe it

13:40 Obviously he is into writing new Lisps himself (http://lambda-the-ultimate.org/user/2103), what's wrong if one of them suddenly would become popular because it's just so darn good?

13:40 sexpbot: "Manuel J. Simoni | Lambda the Ultimate"

13:45 technomancy: chouser: does your clojure-log site turn on rel=nowfollow for links in order to prevent giving google juice to things people link to? if not we should keep from linking to that multiple times. =)

13:45 chouser: hm.

13:45 I should probably have rel=nofollow

13:45 LauJensen: chouser: wow, that was a fun/sad read

13:46 chouser: LauJensen: fogus found it. I'm not sure "fun/sad" is a real thing. ;-)

13:46 LauJensen: Whadda ya mean ?

13:46 fogus probably wrote it, just to hype up a conflict to draw more attention to your book "The Joy of ignoring Lisp"

13:46 fogus: I felt fun/sad once... it opened a rift in the space-time continuum.

13:46 chouser: yeah, like that.

13:47 cemerick: that axis fellow sounds a lot like the loper fellow, after a margarita

13:47 chouser: heh

13:47 Raynes: That loper guy was amusing.

13:47 LauJensen: cemerick: in case you're still confused about his opening statement, it read "<ignores who="clojure">lisp</ignore>"

13:47 fogus: cemerick: Oh yeah, I forgot about that Loper guy

13:47 clojurebot: clojure is the best way to learn java

13:48 cemerick: the loper guy is awesome. Artful stuff.

13:58 fogus: But I have to say, the blog name Axis of Eval is pretty clever.

13:58 cemerick: man, a scheme article on IBM DW?

13:59 fogus: Not only that, but Pt. 2!

13:59 Licenser: I find the articlele posted erlyer pretty arroant :/

13:59 cemerick: it's their once-a-decade lisp article

13:59 fogus: You mean I have to wait 10 years for pt. 3?!

14:00 cemerick: heh, looks like it!

14:01 tcrayford: grrr, working out where to use protocols is confusing

14:02 I'm writing a library that renders datastructures (doesn't matter how) in multiple ways

14:03 do I use dispatch to work out which renderer to use, or do I use it to figure out how each renderer renders that particular structure

14:03 chouser: tcrayford: sounds like you might actually want multiple dispatch

14:03 tcrayford: yeah

14:03 ie multimethods

14:03 chouser: right, instead of protocols

14:04 tcrayford: I've started out with if statements, (am just spiking atm), but its getting ugly damn fast

14:06 can I get at interfaces with multimethods?

14:07 say I want to dispatch on wether thing implment 'Named'

14:10 kotarak: Can someone enlighten me, why apply holds unto the head in certain situations?

14:10 I tried to understand it, but didn't see an obvious reason.

14:13 stuartsierra: kotarak: 'apply' will force the entire sequence

14:13 (apply + (range 5)) becomes (+ 0 1 2 3 4)

14:13 kotarak: stuartsierra: no, it's lazy

14:13 stuartsierra: but it holds the head.

14:13 chouser: tcrayford: yeah

14:13 stuartsierra: kotarak: 'apply' is not lazy

14:14 kotarak: ,(let [x (fn [& more] (take 5 more))] (apply x (iterate inc 1)))

14:14 clojurebot: (1 2 3 4 5)

14:14 kotarak: Seems lazy

14:14 stuartsierra: It's not.

14:14 technomancy: ,(take 1 (apply concat [[1 2 3] (iterate inc 0)]))

14:14 clojurebot: (1)

14:15 chouser: tcrayford: http://paste.lisp.org/display/99039

14:15 puredanger: tcrayford: yes, you can do that - multimethods are class hierarchy aware (see isa? and derive)

14:15 kotarak: stuartsierra: ok, then I don't get laziness

14:15 tcrayford: chouser: many thanks

14:17 chouser: "foo is lazy" is frequently an oversimplification.

14:17 stuartsierra: kotarak: Only things which return a lazy sequence can "be lazy."

14:17 chouser: you can pass a seq of infinite args via apply, so in that sense it's lazy

14:17 stuartsierra: chouser: what?

14:17 ,(apply + (iterate inc 0))

14:18 clojurebot: Execution Timed Out

14:18 chouser: that fails because + is eager, not because apply is.

14:18 kotarak: stuartsierra: what happens depends on + not on apply

14:18 stuartsierra: ok

14:18 kotarak: chouser:

14:18 woops

14:18 stuartsierra: No, it happens because 'apply' realizes the entire sequence.

14:18 kotarak: ,(let [x (fn [& more] (take 5 more))] (apply x (iterate inc 1)))

14:18 clojurebot: (1 2 3 4 5)

14:18 chouser: technomancy showed apply used with an infinite arg seq

14:18 hiredman: stuartsierra: nope

14:19 stuartsierra: I'd need to see that example then.

14:19 kotarak: apply "fails" if you run into spread in its implementation. I don't understand why.

14:19 Borkdude: ,(apply take 1 (iterate inc))

14:19 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$iterate

14:19 hiredman: ,(apply (constantly :foo) (repeatedly #(println :bar)))

14:19 clojurebot: :foo

14:19 :bar :bar

14:19 hiredman: check that out

14:19 kotarak: ,(take 1 (apply concat [[1 2 3] (iterate inc 0)]))

14:19 clojurebot: (1)

14:19 hiredman: sort of lazy'ish

14:20 stuartsierra: no

14:20 hiredman: yeah, it doesn't realize the entire sequence of println's

14:20 stuartsierra: None of these examples convince me that 'apply' is lazy.

14:20 hiredman: just the first two, for some reason

14:20 Borkdude: ,,(apply take 1 (iterate inc 0))

14:21 ,(apply take 1 (iterate inc 0))

14:21 hiredman: Borkdude: that won't work

14:21 Borkdude: typing is difficult

14:21 clojurebot: Execution Timed Out

14:21 Borkdude: hehe

14:21 chouser: ,(letfn [(odd-args [& xs] (filter odd? xs))] (take 5 (apply odd-args (iterate inc 0))))

14:21 clojurebot: (1 3 5 7 9)

14:21 hiredman: take takes two arguments and you are trying to give it infinite arguments

14:22 chouser: stuartsierra: there is apply being given an infinite arg seq and returning a lazy seq. what more do you want?

14:22 stuartsierra: It's still not doing anything lazy, merely manipulating functions that are themselves lazy.

14:23 It cannot receive an infinite seq in the last argument position.

14:23 chouser: yes it can. it just did.

14:23 kotarak: May I throw in my question again? Why does apply hold unto the head, if it runs into spread? Shouldn't the local fun arg be cleared on the tail call?

14:23 chouser: in what way is (apply odd-args (iterate inc 0)) not receiving an infinite seq in the last argument position?

14:24 kotarak: your question is harder. we'd rather just argue with stuartsierra.

14:24 :-D

14:24 kotarak: chouser: :)

14:24 stuartsierra: heh

14:24 Borkdude: hiredman: oh yeh

14:24 stuartsierra: ok, (take 5 (apply odd-args (iterate inc 0))) bothers me

14:25 That works because odd-args is a function on a lazy sequence.

14:25 chouser: stuartsierra: yes. nobody is claiming apply can take an eager fn and somehow make it lazy

14:25 stuartsierra: right.

14:26 But the fact that it works at all seems wrong to me.

14:26 chouser: but also, apply does *not* force the final seq you give it

14:26 the fn might, but apply does not

14:26 stuartsierra: That seems impossible to me. But obviously I am wrong.

14:26 chouser: stuartsierra: it certainly seemed impossible to me

14:28 kotarak: Well, it should conses the other args onto the front of the seq.

14:28 s/should/just/

14:28 sexpbot: Well, it just conses the other args onto the front of the seq.

14:28 kotarak: It forces only the first step with seq.

14:29 stuartsierra: But this doesn't work: (apply take 5 (iterate inc 0)))

14:29 chouser: apply forces as many steps as needed to supply non-variatic args required by the target function

14:29 stuartsierra: ah, yes, it's the variadic-ness that makes it work

14:30 hiredman: stuartsierra: right, because you aren't passing (iterate inc 0) as an arg to take, you are passing all the values in the seq (interate inc 0) as args

14:30 stuartsierra: yse

14:30 yes

14:30 Now I no longer assert its impossibility.

14:31 We now return to your regularly scheduled programming...

14:31 chouser: which unfortunately is trying to answer kotarak's harder question

14:32 kotarak: Ok. Now that I don't understand again. (Sorry) (apply take 5 (iterate inc 0)) Should be (.applyTo take (cons 5 (seq (iterate inc 0))))?

14:32 hiredman: ,(doc list*)

14:32 clojurebot: "([args] [a args] [a b args] [a b c args] [a b c d & more]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."

14:33 chouser: (apply take 5 (iterate inc 0)) is broken

14:33 hiredman: that just can't work

14:33 kotarak: Yeah. But why should apply look into the variadic-ness of the "target" function? Shouldn't applyTo tell something like "too many arguments" in this case?

14:34 hiredman: kotarak: apply doesn't

14:34 the helper method applyTo exists on the function

14:34 chouser: yeah, what I said there as a bit misleading

14:34 right

14:34 hiredman: apply just passes the seq off

14:34 chouser: which is why it is always slower, even if the args would line up

14:35 kotarak: chouser: ah, ok. I'm happy again. Phew. Now back to my previous question. ;P

14:35 hiredman: depends on the fn being applied I suppose

14:46 edbond: error loading slime: http://pastie.org/954153

14:46 void-variable package-activated-list

14:46 using git versions, not elpa

14:47 Borkdude: hmm this on the other hand forces the thing: (take 5 (apply #(filter odd? %&) (iterate inc 0)))

14:48 stuartsierra: Borkdude: I don't think #() supports var-args.

14:48 hiredman: does

14:48 %&

14:48 edbond: lol

14:49 stuartsierra: Oh, ok. Well I'm just wrong all over the place today.

14:49 :P

14:50 mmarczyk: kotarak: do you have an example of apply holding onto the head and thus causing trouble at hand...?

14:52 kotarak: mmarczyk: (defn print-many [& more] ((fn [n more] (when-not (zero? n) (println (first more)) (recur (dec n) (next more)))) 1000000 more)), (apply print-many (iterate inc 1)) works, (apply 1 2 3 4 5 6 7 8 9 10 (iterate inc 11)) does not

14:53 Borkdude: This on the other hand, doesn't force it. Now where it the magic going on? (take 5 (apply (fn [& xs] (filter odd? xs)) (iterate inc 0)))

14:53 mmarczyk: kotarak: thanks, but... really? then I second your question (going off to see for myself)

14:55 kotarak: mmarczyk: I suspect that in the second case the locals are not cleared, but I don't know, why.

14:58 DuneMan: apply does this

14:58 yes

14:58 Borkdude: To keep this interesting question persistent and clear, I posted this question at SA: http://stackoverflow.com/questions/2805575/clojure-apply-and-lazy-evaluation

14:58 sexpbot: "Clojure apply and lazy evaluation - Stack Overflow"

14:58 DuneMan: when the function that is being applied to takes [& args]

14:58 (apply (partial .....) <some infinite sequence>)

14:58 I ran into that last week

14:59 though I don't recall if that was fixed by 1.2

14:59 kotarak: Borkdude: you should post on the google list, chances of high-quality answers are higher

14:59 DuneMan: Ah. Let me check. Maybe I'm using 1.1 and look at the sources of 1.2! :/

14:59 Borkdude: kotarak: feel free to do it

15:00 chouser: 1.2 has local-clearing magic in the compiler itself

15:00 DuneMan: I fixed the apply/rest-args bug, and then found another, then upgraded to 1.2

15:00 so Im not sure if 1.2 will fix it.

15:03 mmarczyk: Borkdude: I'm not sure about your examples on SO

15:03 #(filter odd? %&) translates -- at read time! -- to (fn* [& xs] (filter odd? xs))

15:03 so I find it hard to believe there's a difference :-)

15:04 Borkdude: mmarczyk: me 2

15:04 :-s

15:04 mmarczyk: well that's your SO question :-P

15:04 kotarak: Hmm.. No 1.2 fails also for me.

15:05 Borkdude: Hmm, did I say SA? SO I mean of course

15:07 mmarczyk: if you evaluate the result of macroexpand with the #() it doesn't force

15:07 mmarczyk: um, what do you mean, macroexpand

15:08 ,(first '#(+ %1 %2))

15:08 clojurebot: fn*

15:08 mmarczyk: ,(second '#(+ %1 %2))

15:08 clojurebot: [p1__15467 p2__15468]

15:08 mmarczyk: ,(nth '#(+ %1 %2) 2)

15:08 clojurebot: (+ p1__15472 p2__15473)

15:08 Borkdude: ,(macroexpand '(take 5 (apply #(filter odd? %&) (iterate inc 0))))

15:08 clojurebot: (take 5 (apply (fn* [& rest__15477] (filter odd? rest__15477)) (iterate inc 0)))

15:08 Borkdude: ,(take 5 (apply (fn* [& rest__15477] (filter odd? rest__15477))

15:08 (iterate inc 0)))

15:08 clojurebot: EOF while reading

15:08 mmarczyk: well there's nothing to macroexpand with take in the operator position

15:10 Borkdude: mmarczyk: oh yeh, just '(...) is enough

15:12 mmarczyk: kotarak: I've changed your fn to only print the last item

15:12 kotarak: seems to work either way

15:12 kotarak: hmm...

15:12 mmarczyk: kotarak: i.e. (apply print-many 0 1 2 3 4 (iterate inc 0)) and (apply print-many (iterate inc 0)) both do fine

15:12 Borkdude: I'm still thinking that macroexpand is like mexpand-all

15:12 mmarczyk: on the current HEAD, I believe

15:13 Borkdude: actually #() involves no macroexpansion

15:13 Borkdude: it gets translated into a fn* form at read time

15:13 Borkdude: it is a reader macro, which will get expanded by the reader, yes I know

15:14 mmarczyk: right, so clearly the only place where macroexpansion might happen is in the (fn ...) example

15:14 because fn is actually a macro

15:14 Borkdude: ah

15:14 mmarczyk: built on top of fn* to handle destructuring etc.

15:14 oh, in fact, you might have been referring to the differences resulting from this all along :-)

15:15 sorry, I only realised just now

15:16 Borkdude: mmarczyk: explain?

15:17 eh, ah, because fn and fn* differ, you mean?

15:18 mmarczyk: Borkdude: well, I might be misunderstanding you, but I gather you've posted that SO question with two examples which are actually the same...?

15:19 ,(macroexpand '(fn [& xs] (filter odd? xs)))

15:19 clojurebot: (fn* ([& xs] (filter odd? xs)))

15:19 mmarczyk: ,'#(filter odd? %&)

15:19 clojurebot: (fn* [& rest__15484] (filter odd? rest__15484))

15:19 DuneMan: but yeah, this makes sense, doesn't it, that it would hold onto the head?

15:19 mmarczyk: DuneMan: does it? :-)

15:20 in fact, I've just ran through 10,000,000 items of (iterate inc 0) with sth like kotarak's print-many

15:20 kotarak: mmarczyk: just testing with latest snapshot.

15:20 DuneMan: (f [& args] (let [a reduce(... (filter.... args))] (next args...)))

15:20 mmarczyk: but amended to only print at the end and actually execute that many iterations of the loop

15:20 DuneMan: Why wouldn't "args" still point tot he head there?

15:21 mmarczyk: kotarak: ok

15:21 kotarak: mmarczyk: I've got probably some old snapshot here.

15:21 mmarczyk: kotarak: I'm working with what I pulled from Git yesterday

15:21 LauJensen: In terms of shell-script, is there an easy way to produce the correct classpath string for all the jars in lib/ ?

15:21 Borkdude: Hmm, wait, now they both just work

15:21 mmarczyk: DuneMan: locals tend to be cleared in Clojure when the compiler can prove they won't be needed again

15:22 LauJensen: mmarczyk: thats old-school. Now they're cleared more agressively

15:22 mmarczyk: LauJensen: cp=""; for jar in lib/*.jar; do $cp="$jar:$cp"; done

15:22 DuneMan: Ah, so if it weren't used anywhere except as the input to a seq-eating function then the local should be cleared?

15:22 LauJensen: mmarczyk: thanks

15:22 mmarczyk: LauJensen: you mean even when the compiler can't prove that? :-)

15:22 DuneMan: That's sorta confusing :-)

15:22 mmarczyk: LauJensen: yw

15:23 LauJensen: mmarczyk: Rich added agressive locals clearing a while ago. And at least in the beginning it was sometimes just a little bit agressive IIRC

15:23 DuneMan: in fact, thats confusing enough that I'd almost be annoyed if it worked that way.

15:23 Borkdude: Hmm, I think it is solved, I don't know why it looked as if the lazy seq got forced before. I think I'm too tired...

15:23 mmarczyk: LauJensen: yeah, maybe that's the difference between what kotarak is seeing and what I'm seeing

15:23 DuneMan: :-D

15:24 DuneMan: Because it becomes stupid hard to tell where you're holding references

15:24 LauJensen: Borkdude: That has driven me nuts in the past, when SLIME forces lazy-seqs and then when you deploy, threads hang...

15:24 DuneMan: without knowing the locals clearing rules

15:24 mmarczyk: Borkdude: no worries, though you might want to remove your Q or self-answer if the problem disappeared

15:24 DuneMan: and then, if you're doing somethign where memory actually matters (like in my code!)

15:24 it becomes nigh impossible not to write head-hold bugs

15:24 mmarczyk: Borkdude: if indeed you mean to say that it disappeared, I might be to tired to understand myself :-)

15:24 Borkdude: mmarczyk: I deleted it

15:25 mmarczyk: Borkdude: right, just got the funky "not found" SO page

15:26 kotarak: mmarczyk: I still see it with snapshot 20100507.230258-69

15:26 mmarczyk: Borkdude: incidentally, great question about podcasts for Clojurians

15:26 Borkdude: I hope somebody, somewhere finds the number of upvotes inspiring :-)

15:26 Borkdude: mmarczyk: tnx, hope that too :)

15:27 mmarczyk: http://pastie.org/954219

15:28 kotarak: see above for what I'm doing

15:28 kotarak: am I missing something...?

15:28 stuartsierra: anybody know how to disable email notifications in Assembla?

15:29 never mind, found it

15:29 DuneMan: It seems to me that local clearing, when it effects actual runtime behavior (like memory holding), should be... carefully and well defined

15:29 Maybe I just don't know the rules yet, but it appears others don't as well.

15:30 affects*

15:30 kotarak: mmarczyk: you can save the first more. the next realises it anyway

15:30 Will test

15:30 mmarczyk: DuneMan: if it works well, you never notice, except it's easier to lose the head

15:30 DuneMan: Well then it doesn't work well.

15:30 Because I notice it all the time.

15:30 chouser: DuneMan: in 1.2?

15:30 DuneMan: yes.

15:31 chouser: as in, you run into code that mysteriously holds the head?

15:31 mmarczyk: how d'you mean?

15:31 DuneMan: Well, yes in 1.2 if the (apply (partial...) ...) thing still does what it did before

15:31 chouser: yes. Though in the last few days I've gone a long way to understanding some of those cases

15:31 and now seem valid.

15:32 One issue is that library functions do this as well

15:32 and its hard to know which ones will

15:32 e.g. partition/partition-by will realize each whole partition in memory at some point.

15:32 kotarak: mmarczyk: no. fails here. -.-

15:32 DuneMan: or will try to until your JVM crashes.

15:32 if your partitions are large.

15:32 mmarczyk: kotarak: oh bother :-(

15:32 DuneMan: but that's not local clearing

15:32 so.

15:32 mmarczyk: kotarak: you mean "fails" as in "crashes"?

15:33 kotarak: mmarczyk: OutOfMemoryError

15:33 mmarczyk: kotarak: um, I wonder if I should try lowering the memory limit

15:34 on the other hand, why not just add to zeros to the number of iterations

15:34 ^two zeros

15:34 hiredman: ,1e0

15:34 clojurebot: 1.0

15:35 mmarczyk: DuneMan: right, we talked about it the other day

15:35 chouser: ,(apply (partial #(second %&) :skip) (iterate inc 0))

15:35 clojurebot: 0

15:35 DuneMan: mmarczyk: right.

15:35 Crowb4r: when does 1.2 become a stable release?

15:36 DuneMan: So now I understand how that works. But I admit its a bit mysterious as to when the a local will get released. One can figure it out... but so far I've only managed to figure it out after observing behavior

15:36 chouser: Crowb4r: coming up fast on a beta release, already essentially in feature-freeze

15:36 DuneMan: and thus deducing the rules the compiler is using.

15:36 mmarczyk: DuneMan: in the partition-by case, you gave the correct reason

15:36 Crowb4r: chouser: awesome

15:36 mmarczyk: DuneMan: the "drop-while" closure is holding onto the head

15:37 DuneMan: wow, in fact

15:37 Crowb4r: So, clojure might have just helpped me land a software dev job. :) Apperently learning a new language and playing with it constantly does that.

15:37 mmarczyk: DuneMan: how about trying to force a little bit of the drop-while part along with the take-while part... hmm... not sure that has any chance of working

15:37 chouser: (apply (partial #(last %&) :skip) (iterate inc 0)) ; does not seem to consume memory

15:38 mmarczyk: Crowb4r: great :-)

15:38 DuneMan: chouser: now that's interesting :-P

15:38 mmarczyk: kotarak: right, so I got an OutOfMemoryError finally

15:38 kotarak: but it includes a message: "GC overhead limit exceeded"

15:38 DuneMan: Yes, that's what happens

15:39 when the GC is doing too much work running over the object graph

15:39 kotarak: mmarczyk: For me it just says Java heap space.

15:39 mmarczyk: kotarak: how about "things get left behind and freed, but the GC can't keep up with the pace"

15:39 chouser: DuneMan: we had a fairly extensive section in the book discussing accidental head-hold with examples, suggestions for solving certain cases, etc.

15:39 then rhickey added the local-clearing magic to 1.2 and all our examples suddenly "just worked"

15:39 DuneMan: chouser: Oh, maybe I should read that.

15:39 kotarak: mmarczyk: why does then the other apply form work, which goes just as fast?

15:39 mmarczyk: kotarak: "and at some point it gives up"; could be pretty random

15:39 DuneMan: Oh.

15:39 chouser: yeah

15:39 mmarczyk: kotarak: yeah, just realised that...

15:39 chouser: so we fumbled a bit trying to get something useful and I think finally just removed it.

15:39 Borkdude: chouser: which section is that again? I'm curious if I forgot or if I'm about to read it

15:39 mmarczyk: kotarak: let me check if it does indeed work for me

15:40 kotarak: chouser: you may blog post just blew up. :)

15:40 DuneMan: chouser: Well, a suggestion would be "These library functions will realize things even when it looks lazy... beware!"

15:40 mmarczyk: chouser: don't you hate it when you're doing a perfectly good job on a book and then the language designer comes along and ruins a chapter ;-)

15:40 chouser: section 5.3

15:41 Borkdude: 5.3 let me see

15:41 chouser: kotarak: sorry, what?

15:41 Borkdude: co-incidentally that is the section where I stopped just before in the train today

15:41 chouser: Borkdude: heh.

15:41 DuneMan: Does anyone else not find it disconcerting that using an argument can, in some cases cause head holding, and in others (because of compiler magic) not?

15:42 I just find that fundamentally worrisome

15:42 chouser: hm, it's not quite as extensive as I rememberd.

15:42 DuneMan: it means you have to look at the implementation of every function to figure out what the hell it will do.

15:42 chouser: maybe we'd already slimmed it down a bit.

15:42 kotarak: chouser: well, your chapter blew up, just as my blog post did. (Not a book, but anyway...) I wanted to point out the apply is "lazy" (for some suitable definition of lazy) but holds the head. Then I found, that I actually didn't understand why it holds the head, and that it actually shouldn't because of locals clearing as I understand it. :|

15:43 chouser: kotarak: ah. :-) exactly.

15:43 Borkdude: chouser: are the versions of TjoC using a persistent datastructure? it must be still somewhere

15:43 DuneMan: maybe all of my concerns will go away with more experience.

15:44 chouser: I suppose I've rarely tried to work with lazy sequences that won't fit in memory

15:44 DuneMan: That is my whole use-case.

15:44 terabytes of streaming data.

15:44 with many gigabyte - terabyte-sized partitions

15:45 jwr7: Hmm. I'm finding that because of the thread-local semantics of vars, binding is nearly useless. I would much rather have new threads get the var value at the point of thread creation, than the root binding.

15:45 DuneMan: I've been watching sawtooth memory graphs for a week :-D

15:45 mmarczyk: kotarak: could it be that the no-spread version just loops through the varargs, whereas the spread version needs to do loads of consing as it goes?

15:45 chouser: DuneMan: heh

15:45 mmarczyk: kotarak: thus the varargs version would in fact lose the head, but generate *loads* of GC work

15:45 chouser: jwr7: you might look at bound-fn

15:46 hiredman: jwr7: good

15:46 please write to your local library authors and tell them to stop providing apis that use binding

15:46 kotarak: mmarczyk: it just conses the arguments. (apply x 1 2 3 4 5 (iterate inc 6)) becomes (.applyTo x (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 (seq (iterate inc 6)))))))). That's way it's "lazy".

15:47 Hmm.. I remember something with delay and local clearing and that it was too aggressive. Maybe it's turned off again?

15:47 jwr7: chouser: I know about bound-fn, but if I understand it correctly, it doesn't help much.

15:48 hiredman: I just wrote to myself. I went through a pile of code and removed all dynamic variables.

15:48 hiredman: nice

15:48 mmarczyk: kotarak: ouch, right

15:48 Borkdude: How about the lazy sequence (spider internet)

15:49 (spider the-web) is better maybe ;)

15:49 ataggart: (crawl spider the-web)

15:51 Borkdude: (apply crawl spider the-web)... omg, what will happen

15:51 DuneMan: mmarczyk: I gave up on writing a really-lazy-partition and am just using my strange nested recursive-lazy-seq thing, which works :-P

15:51 maybe I'll try again sometime

15:51 mmarczyk: DuneMan: fair enough :-)

16:44 wooby: would you guys consider 'ruby has open classes, protocols are like open interfaces' a valid analogy for people coming from ruby?

16:45 chouser: by open classes do you mean monkey-patchable

16:45 ?

16:45 kotarak: wooby: ruby has monkey-patching

16:45 wooby: (these people being me :)

16:45 cschreiner: evening!

16:45 wooby: hallo

16:45 mmarczyk: protocols have no name collision issues

16:45 DuneMan: I prefer bonobo patching, much more erotic.

16:45 *stops making comments*

16:45 wooby: lol

16:45 mmarczyk: in contrast to monkey-patching

16:45 kotarak: nono, kein bonobo, will kein bonobo sein, neinneinnein

16:46 mmarczyk: just to name one example of how the analogy might be less than perfect ;-)

16:46 wooby: i think i just need to read more code

16:46 anyone aware of a body of short record/protocol snippets up somewhere?

16:47 cschreiner: clojure.org/protocols

16:48 mmarczyk: also search what's currently on the index of disclojure.org for a number of links to blog posts etc. on protocols

16:48 wooby: thank you all

16:48 mmarczyk: same goes for planet.clojure.in, I suppose, though you'll get full posts there

16:49 cschreiner: Circuit Breaker is a nice resource though

16:58 mmarczyk: kotarak: funnily enough, (. print-many (applyTo (seq (iterate inc 0)))) just threw Java Heap Space for me

16:59 kotarak: things happen to people who drink fiasco

17:00 wooby: can huge arg lists inadvertently blow heap?

17:00 kotarak: wooby: depends

17:07 arohner: wooby: you can pass infinite seqs as arguments, and the function can do something to hold the head and evaluate the seq, so yes

17:08 puredanger: so I had my JavaOne talk accepted - it's a joint talk with Jonas Boner about Clojure (me) and Scala (him) comparing ways to do things vs Java

17:08 I'm kinda shocked actually

17:08 arohner: wooby: but just passing the infinite seq by itself won't blow the heap

17:08 wooby: you have to hold the head & evaluate to do that

17:08 DuneMan: arohner: And "apply" can do it for you and blow your heap in confusing ways :-)

17:09 arohner: DuneMan: I don't think so

17:10 DuneMan: arohner: Scroll back over the last couple hours for a bajillion examples.

17:10 arohner: apply should only need to eval enough args to get to the & part of the args

17:10 DuneMan: It shouldn't happen, maybe, but it does.

17:10 arohner: (defn foo [& args] (println (first args)))

17:10 (apply foo (range))

17:10 that doesn't blow the heap

17:11 DuneMan: yes, there are all kinds of ways to blow the heap by doing bad things with infinite seqs

17:11 but passing them as arguments and applying by itself won't blow the heap

17:11 DuneMan: That blows the heap for me

17:11 with an infinite seq

17:11 arohner: are you running 1.1?

17:11 DuneMan: I was. But, like I said, there were just a bajillion examples poste where it does it in 1.2

17:11 arohner: they're holding the head somewhere

17:12 DuneMan: No the apply is.

17:12 somehow

17:12 arohner: my example works in 1.2

17:12 DuneMan: There were some examples that worked

17:12 some that didnt

17:13 arohner: and my example shows that it's possible to pass an infinite seq to a function and use it, without blowing the heap

17:13 kotarak: arohner: sometimes, sometimes not

17:14 arohner: (apply f (iterate inc 1)) works for (for some f), while (apply f 1 2 3 4 5 6 7 8 9 10 (iterate inc 11)) does not

17:15 dakrone: Is there a way to take a record that extends a protocol and extend the record, so I can just replace 1 method instead of every protocol method?

17:16 kotarak: dakrone: you'll have to use mixin maps, I think

17:16 dakrone: kotarak: okay, I'll check it out, thanks

17:16 kotarak: speaking of protocols, any word on when vimclojure will support the right highlighting/indention for them?

17:16 arohner: kotarak: why does one work and one not?

17:17 kotarak: dakrone: -.- soon. This weekend is a long one (Thursday public holiday) I plan to work on VC, then.

17:17 arohner: kotarak: and replacing my foo example with extra args doesn't blow the heap either

17:17 dakrone: kotarak: cool, been using the pre-release and really liking it so far. Thanks for the awesome tool :)

17:17 kotarak: arohner: the first form does the right thing, the second blows the heap for me.

17:18 dakrone: watch out for things bypassing *out* and *err*, though.

17:18 arohner: kotarak: what version are you running? my snapshot as of last week doesn't blow the heap with my example

17:18 (defn foo [a b c d e f g h i j k & args] (println (first args))) works just fine

17:18 dakrone: kotarak: yea, already had some trouble with that, but not too bad to work around

17:18 kotarak: arohner: 20100507.230258-69

17:19 dakrone: nailgun does some voodoo. I have to check in how far I can extend that.

17:20 leif-p: Any way to write a macro that expands to code with type hints (my current guess is "no")? I think the crux of the problem the difference between (vec '(#^String s #^String a #^String b)) and (vec (map #(with-meta % {:tag String}) '[s a b])). Can someone explain the diff? They print the same if *print-meta* is true.

17:20 kotarak: arohner: my f is (defn print-many [ & more ] ((fn [n more] (if-not (zero? n) (recur (dec n) (next more)) (print (first more)))) 1000000 more))

17:21 DuneMan: well that holds the head because of (next more) (print (first more)...

17:21 oh, maybe not

17:21 kotarak: leif-p: it's possible: a hinted symbol: `(def ~(with-meta var-name {:tag `String}) "Hello")

17:21 DuneMan: that doesn't seem like it should :-)

17:22 kotarak: DuneMan: the function itself does not hold the head

17:22 arohner: kotarak: (apply print-many 1 2 3 4 5 6 7 8 9 10 (range)) doesn't blow for me

17:22 kotarak: arohner: maybe you need bigger n (or smaller heap)?

17:23 leif-p: you must put classes in the :tag, you have to a Symbol there

17:23 must not

17:24 arohner: kotarak: ok, you're right. I needed a bigger n to see it run long enough

17:25 DuneMan: right

17:25 like... an actual infinite sequence.

17:25 This becomes really obvious is your infinite sequence is gigs of event data :-)

17:25 kotarak: DuneMan: (iterate inc 1) is infinity enough ;)

17:25 DuneMan: yeah, that's a good one :-)

17:26 but integers are small :-)

17:26 arohner: kotarak: (range) works now too, FYI

17:27 kotarak: arohner: I know, just haven't switched to 1.2 in general, yet. (Did for this test, though)

17:29 leif-p: kotarak: Ah, that did it. Thanks!

17:31 mmarczyk: puredanger: congratulations! the contrast could be interesting (I mean three way, clj / sc / j) :-)

17:32 DuneMan: arohner:, kotarak: I will be very interested if you figure out what's going on there.

17:32 mmarczyk: arohner: I needed to increase the number of iterations of print-many's loop quite significantly to see the problem

17:33 arohner: mmarczyk: yeah, I added two zeros to the the number

17:33 kotarak: mmarczyk: I know, I know, I have only 1G Ram...

17:33 puredanger: mmarczyk: the talk is called "Cool Hand Duke" about how to escape from the Java prison ;)

17:33 mmarczyk: puredanger: cool :-)

17:34 puredanger: do you think there might be a video of it online after the conference?

17:34 puredanger: mmarczyk: no clue. they do record many on audio

17:35 arohner: kotarak, DuneMan: I think (spread) is the culprit

17:35 ~source apply

17:35 * arohner kicks clojurebot

17:35 arohner: clojurebot: help

17:35 clojurebot: http://www.khanacademy.org/

17:35 kotarak: arohner: I think local clearing is the culprit

17:38 arohner: kotarak: how so? the other arities of apply refer to the locals

17:39 kotarak: arohner: yeah. That's what I don't understand.

17:52 _brian2_: hi, how do I create a java char[] in clojure? this doesnt work > (into-array char ["a" "b"])

17:53 ndimiduk: clojurebot: ,(into-array ['a' 'b'])

17:53 clojurebot: excusez-moi

17:53 ndimiduk: err

17:54 kotarak: _brian2_: (into-array Character/TYPE ...) or - I think - char-array

17:54 _brian2_: ok, thnks

17:54 ndimiduk: (into-array [\a \b])

17:55 ,(into-array [\a \b])

17:55 clojurebot: #<Character[] [Ljava.lang.Character;@65f65e>

17:55 mmarczyk: chouser: just read "Roundoff Error and the Patriot Missile."... you guys have an *amazing* bibliography!

17:55 _brian2_: thanks

17:55 kotarak: ndimiduk: that's not a char array

17:55 ndimiduk: kotarak: you are correct.

17:56 ,(char-array [\a \b])

17:56 clojurebot: #<char[] [C@1d14f6a>

17:56 kotarak: ,(seq (into-array Charactoer/Type "Hello"))

17:56 clojurebot: java.lang.Exception: No such namespace: Charactoer

17:56 ndimiduk: that's what's nice about having a repl in irc :)

17:56 kotarak: ,(seq (into-array Character/TYPE "Hello"))

17:56 clojurebot: (\H \e \l \l \o)

18:55 bsteuber: I've coded docstring support for docstrings in a patch linked from http://www.assembla.com/spaces/clojure/tickets/280-def-and-defstruct-should-support-an-optional-doc-string

18:55 sexpbot: "#280 - def and defstruct should support an optional doc-string (New) | Clojure | Assembla"

18:55 bsteuber: would like to hear what you guys think about this

18:55 erm

18:55 for def, not docstrings lol

19:02 ninjudd: is anyone here an expert on writing a custom Java classloader?

19:09 wooby: bsteuber, like in c.c.def?

19:10 oh nm, that has its own 'defvar'

19:12 bsteuber: no, this is a patch for the builtin special operator

19:33 bobbytek2: yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!

19:33 ahem, hello

19:34 what is the main difference between clojure and scala?

19:35 zakwilson: One is Clojure and the other is Scala.

19:36 It's a bit like asking what the main difference is between Common Lisp and Standard ML. They're entirely different languages that happen to have a few things in common.

19:49 bsteuber: bobbytek2: I think the main difference is that clojure is better :)

19:53 tomoj: I get the sense that scala is more liberal than clojure with state?

20:04 bobbytek2: does clojure have classes?

20:04 is state really THAT evil?

20:04 I mean, humans have state

20:05 tomoj: so hitler had state?

20:05 scala is for nazis then?

20:05 bobbytek2: no, he actually didn't

20:06 Hodapp: well

20:06 scala might be more liberal with state

20:06 but scalia is very conservative with it

20:06 tomoj: d'oh

20:06 zakwilson__: State isn't evil, but in Clojure, it is not conflated with identity or value.

20:06 Hodapp: tomoj: come on, that deserved at least a "heh"

20:07 tomoj: badly managed state is evil, I think, but that's just begging the question

20:07 Hodapp: this sounds like #politics, really, but I think we're staying on topic

20:08 bobbytek2: so let me get this straight, hitler uses scala, but had he not been a statist, he would have used clojure?

20:08 makes sense....

20:08 Hodapp: hmmmm

20:11 zakwilson: Back to bobbytek2's original questions - Clojure doesn't have a first-class notion of classes. You can create them for Java interop, but using them in pure Clojure code is not idiomatic.

20:12 bobbytek2: does clojure have monads?

20:12 zakwilson: As a library

20:13 bobbytek2: so, can I connect to a database with clojure?

20:13 or is that against the law?

20:13 zakwilson: Yes, and there's a library providing a DSL for SQL.

20:14 bobbytek2: I guess I am a bit confused

20:14 is clojure pure functional?

20:14 zakwilson: No.

20:16 bobbytek2: why not?

20:16 Hodapp: ...

20:17 tomoj: what do you mean by "pure functional"?

20:17 zakwilson: Clojure can do IO directly, has mutable references and thread-local mutable data structures (transients). There's also Java interop, which isn't functional at all.

20:23 maxhodak: how do you alter tha state of a java object?

20:24 for example, if you have a class with an public instance variable int i

20:24 (. foo (.i 3)) says that there's no method 'i'

20:24 foo/i doesn't work

20:24 Hodapp: if Clojure is lispy enough, wouldn't it be fairly simple to implement a purely functional subset in clojure itself?

20:24 maxhodak: etc

20:25 technomancy: Hodapp: you could probably undefine all non-functional parts of Clojure pretty easily

20:25 tomoj: maxhodak: set!

20:25 Hodapp: technomancy: undefine how?

20:25 mmarczyk: technomancy: not . :-)

20:26 maxhodak: tomoj: i don't see set! in http://richhickey.github.com/clojure/clojure.core-api.htm ?

20:26 technomancy: mmarczyk: not until c-in-c anyway

20:26 tomoj: maxhodak: it's a special form

20:26 maxhodak: http://clojure.org/java_interop

20:27 mmarczyk: technomancy: right

20:27 maxhodak: tomoj: ok thanks

20:39 i need to build a list of in clojure ([L style), but i can only seem to get ISeqs

20:39 like

20:39 node[] <-- what i need

20:40 clojure.lang.LazySeq <-- what i get

20:45 mmarczyk: ,(doto (java.util.ArrayList.) (.add :wibble) (.add :wobble))

20:45 clojurebot: #<ArrayList [:wibble, :wobble]>

21:06 maxhodak: i don't want an ArrayList, but a primitive list

21:06 like the difference between Integer[] and ArrayList<Integer>

21:08 pd: maxhodak: (make-array Integer/TYPE 20)

21:09 where 20 is the length

21:09 maxhodak: pd: awesome thanks

21:09 DuneMan: (int-array) if you need in[]

21:09 int[]

21:10 maxhodak: DuneMan: no it's a user-defined class

21:10 DuneMan: ah, okers

21:11 maxhodak: hmm

21:11 Unable to find static field: TYPE

21:11 i'll do some googling

21:11 rhudson: ,(make-array java.net.URL 10)

21:11 clojurebot: #<URL[] [Ljava.net.URL;@114b607>

21:12 maxhodak: (removing the /TYPE did it)

21:12 rhudson: Integer/TYPE is a Java hack to say int vs Integer

21:14 mmarczyk: maxhodak: oh, sorry, didn't get the part about [L

21:14 maxhodak: though that is not a list, it's an array

21:15 maxhodak: for a 2-d array, would you do (make-array node 4 4) ?

21:16 there doesn't seem to be a make-array-2d

21:16 rhudson: ,(doc make-array)

21:16 clojurebot: "([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

21:17 maxhodak: rhudson: my reference java code is "new node[i][]"... how would you do the unparameterized second dimension?

21:17 dim of zero?

21:19 rhudson: It's being initialized though (in Java), right?

21:37 mmarczyk: something like (into-array (map into-array (partition i ...))) maybe?

23:23 rava: greetings programs

23:40 rlmcintyre: hey guys --- why doesn't (def (symbol "some_symbol") 5) work?

23:40 hiredman: def is not a function

23:41 Raynes: $(doc def)

23:41 sexpbot: DENIED!

23:41 Raynes: Oh yeah, that wont work.

23:41 ,(doc def)

23:41 clojurebot: DENIED

23:41 * Raynes sighs quietly to himself.

23:41 rlmcintyre: it just says see special forms anyway

23:43 Raynes: rlmcintyre: Indeed. I was pointing out that it is a special form.

23:46 arohner: ,(doc map)

23:46 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

23:46 arohner: ,(doc def)

23:46 clojurebot: DENIED

23:46 arohner: huh

23:47 Raynes: arohner: def is a no no.

23:47 $(doc map)

23:47 sexpbot: result: -------------------------clojure.core/map([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) Returns a lazy sequence consisting of the result of applying f to the set of first items of each c... http://gist.github.com/396894

23:47 arohner: Raynes: I should be able to call (doc def) though?

23:47 Raynes: No.

23:47 Because def appears in the form.

23:47 arohner: that's broken

23:48 rava: def is broken?

23:48 Raynes: No, it's expected behavior.

23:48 arohner: it's what *you* expect. I can call (doc def) at a normal repl and have it work

23:49 Raynes: A bot isn't a normal REPL. ;)

23:49 I could make sexpbot allow everything in the context of doc, but I bet you _ato would find a way to break it.

23:49 tomoj: ,'def

23:49 clojurebot: DENIED

23:50 arohner: ,(doc defn)

23:50 clojurebot: "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"

23:50 tomoj: seems pretty strange to me too

23:50 hiredman: the other thing is def is a special form, not a var

23:50 so it doesn't actually have a doc string

23:50 arohner: hiredman: so? (doc def) works in a normal repl

23:51 hiredman: arohner: because doc keeps a list of special forms and knows to tell you to go look at the website

23:52 arohner: ,(macroexpand '(defn foo [] (println "a"))

23:52 clojurebot: EOF while reading

23:52 arohner: ,(macroexpand '(member:defn foo [] (println "a")))

23:52 clojurebot: (member:defn foo [] (println "a"))

23:52 arohner: ,(macroexpand '(member:defn foo [] (println "a")))

23:52 clojurebot: (member:defn foo [] (println "a"))

23:52 rava: Maybe an odd question, but have any of you run into a problem clojure didn't work well to solve?

23:53 arohner: ,(macroexpand '(defn foo [] (println "a")))

23:53 clojurebot: DENIED

23:53 Raynes: rava: Global war... Oh wait.

23:54 rava: I'm finding myself replacing a ton of my sys admin scripts from python to clojure. nothing against python, but for long tasks the jvm performs better/faster and i just dig lispy syntax

23:56 arohner: rava: there are certain things requiring speed that clojure can't do...yet

23:57 technomancy: rava: it's no secret that clojure is relatively lousy for CLI scripts

23:57 especially short-running ones

23:58 rhudson: rlmcintyre, I think the basic answer to your question is that 'def does not evaluate its first argument. So the form of the first argument has to BE a symbol.

23:59 rava: technomancy: makes sense. luckily i've long since mashed all my cli like scripts into a hodgepodge of python scripts controlled by a glued together ui :)

23:59 its been fun cleaning up that mess

Logging service provided by n01se.net