#clojure logs

2010-05-10

00:00_brian2_so I can log in remotely
00:00DuneManyeah, though I don't run mongo with authentication...
00:00_brian2_I dont see that documented
00:00_brian2_in congomongo
00:01DuneMandoesn't look like the connect call takes any args about user/pass
00:02_brian2_so can it really connect?
00:02DuneManhttp://www.mongodb.org/display/DOCS/Java+Tutorial#JavaTutorial-Authentication%28Optional%29
00:02sexpbot"Java Tutorial - MongoDB"
00:02_brian2_ok thanks
00:03DuneManmight have to write a bit of clojure wrapper to that...
00:03_brian2_ok
00:04DuneMan(.authenticate (:mongo *mongo-config*) ....) or something
00:05DuneManor maybe write a better mongo! function that supports auth
00:05DuneManand submit a patch :-)
00:05DuneMan(I'm using mongo + clojure in a trusted environment right now, so... yeah)
00:05_brian2_ok
00:07technomancyinteresting. the new slime.el has the same problem with the old slime-repl.el as with the new one.
00:07DuneManPerforms 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.
00:07technomancyhugod: could you toss me the sha of the revision you're on?
00:07_brian2_there was a post about that on the mail list
00:08DuneManBasically allocates 500megs of objects and releases them
00:08DuneManwhich in my case means I get these huge GCs about once a minute
00:08DuneManeven with the concurrent collector
00:08_brian2_or a question, anyways, that the author will probably answer
00:08DuneManbut I haven't had a chance to debug it since... well... it was friday :-)
00:09DuneManso 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.
00:09DuneManthanks for poiting that out, I'll look for the post
00:09DuneMan:-)
00:09_brian2_ok
00:09_brian2_Im glad somebody else is out there working on this
00:10_brian2_not just me'
00:10DuneMan*nods*, lots of us.
00:11DuneManNot sure how many people are using it from java/clojure, but at least some.
00:11DuneManI did my first cut at the project in python, and am now writing the real server in clojure.
00:12DuneManbut yeah, talked to some people from Intuit at mongosf, and from ShareThis!, apple, etc.
00:12DuneMandoing similar things to what I'm doing... which is event processing/stats
00:12_brian2_cool, well I'm more of an applications guy than engineer
00:13DuneManFinding both clojure and mongo suitable?
00:13_brian2_though I'd love to learn more
00:13_brian2_very
00:14technomancyaha; I guess the call to slime-setup is not optional
00:14DuneManWell, I've been spending lots of time in here, learning etc, so maybe we can help each other ;-)
00:14technomancyso much for "I hate elpa because it's not the \"standard\" way to install emacs libs" =P
00:15_brian2_great, nice to meet you
00:15_brian2_i'm using it to process twitter data
00:15_brian2_mine it that it
00:16DuneManDo you work for Publitweet by any chance?
00:16_brian2_is
00:16_brian2_no, I'm independent
00:16DuneManah, okay.
00:16DuneManI talked to someone from there at mongosf too, so thought you might have been involved.
00:17_brian2_its huge
00:17_brian2_or will be
00:17DuneManYeah, eveyone's trying to make that work.
00:17_brian2_totally, its the wild west
00:18DuneMan:-)
00:18_brian2_ok, I live in arizona
00:18DuneManahah, I live in SF.
00:18_brian2_we're all cowboys here
00:18MadWombattechnomancy: I wish it was more standard than it currently is
00:18DuneManand work aproximately 1 mile from twitter.
00:19_brian2_cool
00:19MadWombatI am in the middle of NM desert, so I am more of a cowboy than either of you :)
00:19_brian2_nice
00:19DuneManI spent last summer hiking around the southwest
00:19DuneManlove it.
00:19technomancyMadWombat: well if trends continue, package.el will keep getting better and slime's crazy custom stuff will keep getting worse
00:19MadWombatagreed :)
00:20_brian2_totaly..
00:21MadWombatalbeit the relative cowboyness depends on particular region of AZ
00:21_brian2_for sure, we have alot fake ones here
00:21_brian2_and real ones too
00:21DuneManI spent a couple weeks in Taos, where... instead of Cowboys there are... well
00:21DuneMannewage potheads
00:22DuneManwhich is much more my style
00:22_brian2_i've had more new age here than I can take
00:22DuneManthen you'd hate sf!
00:22_brian2_everybody is a "healer"
00:22DuneManI live with a life coach.
00:22_brian2_lol
00:22DuneManand my ex is a life coach and dula
00:23_brian2_one guy I worked for is a re-incarnated moses or soemthing
00:23DuneMannice.
00:23technomancyman, moses would be so confused if he were re-incarnated
00:24DuneManHonestly, I like being around those people.
00:24DuneManBecause it helps to balance me out.
00:24_brian2_I rather music, hiking, ladies, anything else
00:27somniumDuneMan: ping
00:27DuneManpong
00:28somniumDuneMan: you were having a memory leak with cm?
00:28somniumsaw the question on the group, was pondering a reply but have no idea about the issue
00:28DuneManNot a leak, but a strange pattern where the GC does big deallocs after allocing 400-500mb of data
00:29DuneManAnd it looks like the GC is trying to figure out what to do.
00:29DuneManBecause the slope of the growth curve changes
00:29DuneMan(but its linear)
00:29DuneManHowever, everything *does* get deallocated.
00:30DuneMan(Are you online at night or during the day mostly? [im in PST])
00:30somniumDuneMan: after reads or inserts? All of the resource management is proxied through the java-driver, but lazy-seqs plus cursors can be weird
00:30DuneManInserts
00:30DuneManbasically I'm doing 2000+ inserts/seconds
00:30DuneMansecond*
00:30somniummore often at night EST
00:31DuneManI tend to work late, so, that might work anyway
00:31somniummass inserts in chunks of 2000?
00:31DuneManyes.
00:32DuneManThe driver has to coerce all my data from normal hash-maps into bson objs
00:33DuneManI'll do a memory dump and jhat it
00:33DuneManand see where the memory's at.
00:34somniumits stuffs them into an array, so it will blow up on really big mass inserts
00:34DuneManSo maybe the GC just isn't keeping up with deallocing big arrays?
00:35DuneManso then it periodically does a big stall and cleans them all up?
00:35somniumthat sounds reasonable
00:36DuneManIs the array stuffing done on the congo side?
00:36somniumits gotten a bit outdated, the .java can all be replaced with protocols, and a 2.0 vs of the java-driver came out
00:36DuneManare you gonna be doing work on that?
00:36somniumplus at least two forks have more features, hoping to consolidate when clojure 1.2 comes out
00:39DuneManmy usage of the lib is fine with this memory usage, and I currently only need mass inserts and simple finds.
00:40DuneManbut I'm interested in the lib getting better, so I may be willing to do some work on it if that's needed :-)
00:41somniumDuneMan: I did a pass on protocols back in November (amazing theyve been around that long) with good results, that plus the forks
00:41DuneManwho did the forks?
00:42somniumI havent actually used it much in last 2 months :/ It fit a couple projects like a glove, hope to use it again soon
00:42somniumrads and jcromartie
00:42DuneManit fits my current project like a glove, in fact.
00:46DuneManWhat features are you thinking of merging back?
00:48somniumI like the validation features, I need to go back and look at it
00:52somniumDuneMan: priv ok?
00:52DuneMansure.
01:50LauJensenMorning all
04:37jwr7technomancy: 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)
04:37jwr7will test
04:42jwr7technomancy: although I guess it would help a bit if you provided a URL or another pointer to the new versions…
05:16AWizzArdNative speakers, is it a) introduction into web services or b) introduction to web services ?
05:18Fossias non-native i'd say to. into sounds like a common german mistake
05:18Fossithen again i could be wrong ;)
05:19AWizzArdà propos german, Fossi, you should also visit #Clojure.de :)
05:19Fossiah, thanks for the hint
05:23SynrGyes, b
05:23AWizzArdok, thanks
05:25ravahello
05:26AWizzArdHallo rava.
05:27ravai'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
05:29ravathe 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
05:30AWizzArdrava: you could try clj-pivot
05:30AWizzArdhttp://github.com/hoeck/clj-pivot
05:30AWizzArdLets you easily use Apache Pivot ( http://pivot.apache.org/ ).
05:30sexpbot"Apache Pivot"
05:31ravaooo, pivot looks neat
05:33AWizzArdtrue
05:34AWizzArdYour gui could be offered via WebStart (or as an Applet, or as a download of a double-clickable .jar)
05:35AWizzArdrava: 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.
05:35ravaI'm still new to java app distribution, coming from a python/web developing background
05:36AWizzArdYes, and this all is doable, it just could mean that you won't get WebStart running immediately.
05:36AWizzArdIf you really need something very fast and small, then maybe pure html+js could also make sense.
05:37AWizzArdBut going the route with Pivot will allow you to use all Java libs in the browser, all of Clojure and Contrib, etc.
05:39ravai'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
05:40ravasince it would be clients sending calls to the server
05:42AWizzArdrava: you can use compojure to offer RESTful web services.
05:43AWizzArdThat is what it can do really good.
05:43ravaexactly what i was thinking
05:43ravasince i'm already used to chugging out REST apps
05:43AWizzArdAnd btw, Pivot was well designed to communicate with such a setup.
05:43rsynnottrava: that's possibly better, yeah
05:44AWizzArdCompjoure can take GET, POST, UPDATE, DELETE from your client, and reply for example with a json object.
05:44ravafigured i'd save myself the headache of java's rpc
05:44rsynnotta lot of people don't _like_ 'rich web applications' (scary plugin-based things) very much
05:44ravaah, the beauty of gwt, no plugins required
05:44ravanow the w3 needs to hurry up with html 5 with decent svg support
05:44rsynnottyep
05:44AWizzArdAs soon gwt switches to html 5 a whole new browser is required, which seems to be much heavier than just a plugin.
05:45rsynnottrava: well, IE<=8 will still be around until 2020 or so, no doubt :(
05:45AWizzArdThere is also a GWT section: https://cwiki.apache.org/PIVOT/frequently-asked-questions-faq.html
05:45ravafeh, 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 :)
05:47rsynnottIn general, though, attempts to make people use actual applications written as java applets, flash, silverlight or what have you have not ended well
05:47ravaindeed
05:47rsynnott(though java isn't quite as bad as flash there; at least it has a proper UI)
05:47rsynnott*UI libraries
05:47AWizzArdThe technology evolved in the past decade.
05:47ravantm java applets don't crash a whole system when they go wonky
05:48AWizzArdIt does not make sense to take the 1997 experience with applets to see how the ones of today work.
05:48AWizzArdGWT - coding in Java, not Clojure. Having only some JS libs, not everything that the jvm offers, including: no Clojure.
05:48AWizzArdJust depends on what you want/need.
05:49ravaaye, 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
05:50ravawith guice dependency injection it makes it slightly less painful to use it
05:51AWizzArdhtml 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.
05:53ravai just like the idea of highly customizable drawing canvas that i can play with in the dom
05:53ravaso my client code wouldn't be tied to a specific back end
05:55AWizzArdyes
05:57ravawhich 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)
05:59AWizzArdyay :)
06:01GeoffSKwhy does this give an exception: (-> 10 (fn [x] (+ 3 x)))
06:02AWizzArd,(-> 10 (fn [x] (+ 3 x)))
06:02clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:02AWizzArdGeoffSK: because of the macro expansion:
06:02AWizzArd,(macroexpand-1 '(-> 10 (fn [x] (+ 3 x))))
06:02clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:03AWizzArdwell, it becomes: (fn 10 [x] (+ 3 x))
06:04AWizzArd,(fn 10 [x] (+ 3 x))
06:04clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:04GeoffSKso i have to use actual functions, not anonymous functions with the thread operator
06:04GeoffSK?
06:04AWizzArdyes
06:04AWizzArd-> only transforms the code
06:05GeoffSKis that a bug?
06:05AWizzArdno, it is intended to work this way
06:05GeoffSKi guess when i know more that will make sense.
06:05GeoffSKThanks for the explanation.
06:06AWizzArd-> operates on the code directly, and just "injects" a literal expression at the first position in the following expression
06:08GeoffSKlike a reader macro?
06:08AWizzArd(-> 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.
06:10GeoffSKyour explanation makes perfect sense.
06:11AWizzArdGeoffSK: macros can not be evaluated/executed. Before compilation there comes the macroexpansion time, in which all macros are removed from your code.
06:12GeoffSKi was expecting some sort of reverse comp(ose) function.
06:14AWizzArdwell yes, it is similar... but also comp would not result in 13 for (comp (fn [x] (+ x 3)) 10)
06:14AWizzArdbut you could do something such as
06:14AWizzArd,((comp (fn [x] (+ 3 x)) (constantly 10)))
06:14clojurebot13
06:16GeoffSKclearly i have no idea.
06:17AWizzArdwell, you were pretty close
06:19GeoffSK((comp #(+ % 3)) 5) ; works
06:19ravai have to admit
06:19ravathe pivot demos look smooth
06:20ChousukeGeoffSK: but that's just the same as (#(+ % 3) 5)
06:20ravai'll have to play with it. the good thing is that my company's software is all java and xml
06:20ravaso whatever i make can likely be cludged in esle where for later
06:20ravagood night guys, thanks for advice/chat. great new tool this clojure is
06:23GeoffSKwho is (#(10)) different to (fn [] 10)
06:23GeoffSKhow is (#(10)) different to (fn [] 10) ?
06:23GeoffSKsorry i meant:
06:23GeoffSKhow is (#(10)) different to ((fn [] 10)) ?
06:33AWizzArdGeoffSK: #() is a reader macro. See here:
06:34AWizzArd,'#(10)
06:34clojurebot(fn* [] (10))
06:34AWizzArdso (#(10)) is different from (fn [] 10)
06:34AWizzArd,(10)
06:34clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
06:34AWizzArd,(do 10)
06:34clojurebot10
06:35AWizzArd,(#(do 10))
06:35clojurebot10
06:35GeoffSKit looks like i am expect reader macros to be macros (and they obviouslt can't be)
06:35AWizzArdThe reader macros are very similar to normal macros. They only run during read time.
06:36AWizzArdwhile macro expansion time comes afterwards
06:38GeoffSKdoesn't that mean #(...) should expand to (do ...) rather than (...)
06:38AWizzArdno
06:39AWizzArd#(+ 5 %) would become (fn [x] (do + 5 x))
06:40AWizzArd,((fn [x] (do + 5 x)) 100)
06:40clojurebot100
06:40GeoffSKyep that makes sense
06:41AWizzArdThe first expression within #() should typically be a symbol, denoting a fn or a macro.
06:41GeoffSK#(5) becomes (fn [] 5), only it doesnt, it becomes (fn [] (5) - thus my error.
06:43AWizzArdwhen you want to say 5 then just say 5, not #(5)
06:44GeoffSKyes, i am just using it as minimalist example.
06:44AWizzArdright
06:44GeoffSKthanks for help, i have to do more reading and coding.
06:47AWizzArdnp
07:20tgkI think there is a function for replacing values in a map with f of their values, but I can't find it. Any suggestions?
07:26GeoffSKisnt that just map?
07:27tgkDoes that work on maps? That just returns a lazy-seq, doesn't it?
07:28tgkIt might not exist, I can give a usage example of what I thought existed
07:29tgk(magic-fn {:a 1 :b 2} {"first" :a "second" :b}) => {"first" 1 "second" 2}
07:29GeoffSKsorry i meant doseq
07:30tgkHmmm no
07:36dnolen,(let [m {:a 1 :b 2}] (into {} (map (fn [[k v]] [k (m v)]) {"first" :a "second" :b})))
07:36_msttgk: there's clojure.contrib.fnmap, but I'd probably just (zipmap (keys mymap) (map myfn (vals mymap))) normally
07:36clojurebot{"first" 1, "second" 2}
07:36AWizzArduhm...
07:37AWizzArddo you want to replace the keys or the values?
07:37tgkThe values, I think I have an answer now
07:40tgkI'll use dnolens solution, but I just assumed there was a function for doing it. Thanks guys.
08:02naeuwhat are the clj equivalents of Ruby's Enumerable#find and #find_all
08:03naeui.e. [1,2,3,4].find{|i| i > 2} ;=> 3
08:03naeuso I can do: (blah #(> 2 %) [1 2 3 4])
08:08AWizzArdnaeu: filter
08:08AWizzArd,(filter #(> % 2) [1 2 3 4])
08:08clojurebot(3 4)
08:09AWizzArdand in clojure.contrib.seq you can find find-first
08:09AWizzArd(find-first #(> % 2) [1 2 3 4]) ==> 3
08:57naeuAWizzArd: thanks :-)
09:15LauJensennaeu: Did you notice that my fluidsim has been ported to penumbra? Its in the /test/examples/gpgpu/ lib on the master branch
09:16LauJensenNow doing about 30fps on a 800x600 board on non-unix systems :)
09:16naeuLauJensen: nice
09:16naeuhow is penumbra doing?
09:17naeulast time i played with it it was using full cpu for the cube example
09:17naeuseemed that it was running the event loop too quickly or something - i.e. essentially doing a lot of busy waiting
09:17jcromartiehi, someone mentioned me yesterday, but it scrolled off
09:18LauJensennaeu: its really shaping up
09:18LauJensenCube demo ran fine here
09:18naeulow cpu usage?
09:18LauJensenjcromartie: clojure-log.n01se.net
09:18jcromartiethanks
09:18LauJensennaeu: I honestly didn't check, but I have a graph on-screen all the time so I would have noticed I think
09:18LauJensen(ie. noticed if it went high)
09:19naeuoh, cool
09:19naeuI bought a 3D mouse the otherday
09:19LauJensen?
09:19naeua 3DConnexion SpaceNavigator
09:19naeujust hooking it up to Clojure just now
09:20LauJensen$google 3DConnexion SpaceNavigator
09:20sexpbotFirst out of 17500 results is: 3Dconnexion : Start
09:20sexpbothttp://www.3dconnexion.com/
09:20naeushould be fun to control penumbra visualisations with
09:20naeuI got the SpaceNavigator for Notebooks
09:21LauJensenThat looks like serious fun
09:21naeuindeed
09:22zakwilsonI'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?
09:22naeuLauJensen: are you one of the guys doing the clojure tutorial in Belgium?
09:23LauJensenYes sir
09:28naeuhow's it going?
09:28naeuI would have loved to tag along
09:28naeubut my company would never pay for such a thing given that we're a Ruby shop
09:29zakwilsonBeing an X shop has always seemed like a mistake to me.
09:30LauJensennaeu: Its going to be quite a blast I think - Would be great if you could talk them into joining :)
09:33BorkdudeLauJensen: do you guys have a date yet?
09:34LauJensenBorkdude: Its Wed-Fri 23-25 of next month
09:35rsynnottzakwilson: X11, in this day and age? :)
09:35BorkdudeLauJensen: ah
09:36zakwilsonrsynnott: It still does the job.
09:37rsynnottwell, but very few interact with it directly anymore
09:37rsynnott(it was a bad joke :) )
09:40zakwilsonIf I had to guess, I'd say more people interact directly with X11 now than ever before.
09:41rsynnottnah; everyone uses libraries
09:41zakwilsonAhh... I thought you meant end-users.
09:58zakwilsonThis 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.
09:58naeuLauJensen: sadly that's never going to happen. Maybe I'll take a trip for the post talk drinks? :-)
09:59LauJensennaeu: 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 :)
09:59naeuzakwilson: 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.
09:59LauJensen(gotta go afk)
10:00zakwilsonnaeu: I'm freelance, and working on a possible startup.
10:00naeuLauJensen: 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:01BorkdudeThen take some time off and pay yourself
10:01Borkdudeor join zakwilson 's startup and he'll pay
10:02zakwilsonFound 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:02Hodapphow do I wash all the C++ off my hands? it's always stuck there after work
10:02zakwilsonBorkdude: he'll have to wait until I have a product for that. Right now, I just have a kick ass text classifier.
10:03naeuBorkdude: I'm actually leaving to do some research at Cambridge University without funding
10:03naeuso i'll be strapped for cash :-)
10:03Borkdudenaeu: sounds great :)
10:03Borkdudewhat exactly will you be working on?
10:03naeuI'll be spending the year building musical instruments/compositions with Clojure and SuperCollider
10:04Hodappnaeu: Will you be using them together? Or what?
10:04HodappI have wanted to learn SuperCollider but I just haven't had the time
10:04naeuHodapp: yep, together
10:04Borkdudewhat is the group you're joining called?
10:04Hodappmessed with Pd a little bit though
10:04naeuhave you seen Overtone?
10:04naeuIt's a really exciting project with great potential
10:04naeuit's a Clojure language environment for SuperCollider
10:05Hodappooh
10:05HodappI
10:05Hodapp...er... (damn, tiny keyboard)
10:05HodappI
10:05HodappGAH
10:05naeuhttp://project-overtone.org/
10:05sexpbot"Home"
10:05Hodappnaeu: thanks. That looks interesting.
10:05naeuyeah, it's great
10:06naeuthe creator, Jeff Rose is also really nice too
10:06naeuhe lives in Amsterdam too
10:06naeuso we've been hanging out a lot
10:06Borkdudenaeu: are you from Amsterdam?
10:06naeuBorkdude: no, I'm English, but I've lived here for 2.5 years
10:07naeu(here being Amsterdam in this context)
10:07Borkdudefor work/research?
10:07naeuwork
10:07Borkdudecompany?
10:07Hodappnaeu: ever used Processing much?
10:07naeubut now going back to research for a bit
10:07naeuI work for a company called innovation factory
10:07Borkdudenaeu: sounds great, I used Lisp for the first time for a year long in a group called Music Mind Machine
10:07naeuit's a nice place, but I'm much less of a programmer and much more of a thinker
10:08naeuso I'm looking forward to a year of research
10:08naeuwhilst I figure out what the hell i want to do with my life :-)
10:09naeuBorkdude: cool - what kinds of thing did you build with lisp?
10:09naeudid you find that it was a good fit for music?
10:09Borkdudenaeu: 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:10naeuBorkdude: how cool
10:10naeuis any of the stuff still available (and open source)?
10:10Hodappis Common Lisp Music any good?
10:10Borkdudenaeu: that was my first project
10:11Borkdudenaeu: 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:11naeuseems 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:11Borkdudeit was not at the synthesis level though, all symbolic
10:11naeusure, perfect for a lisp
10:12Borkdudenaeu: there is still smth online here, but no source files: http://www.nici.kun.nl/mmm/drempdemo/drempdemo.html
10:12sexpbot"Music, Mind, Machine Group :: de- and recomposition demo"
10:12naeui want to be able to do both at once - symbolic manipulation and generation and live synthesis
10:12naeuwhich is why i think the combination of clojure and supercollider to be full of potential
10:13Borkdudenaeu: of course the symbolic representation could be translated into a midi file which could be sent to a sequencer/synthesizer
10:13naeuBorkdude: I want more than just OSC/MIDI communication. I want to be able to define synths on the fly :-)
10:14Hodappdon'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:14Hodappcode-wise
10:14naeuBorkdude: this is very impressive. I'm amazed that you managed to keep the form of the original whilst only modifying the style
10:15naeuHodapp: what do you mean? Could you expand?
10:16Hodappnaeu: 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:16naeuHodapp: 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:17Borkdudenaeu: this group I was in now moved to Sheffield apparently: http://www.sheffield.ac.uk/music/staff/academic/reneetimmers/mmm
10:17sexpbot"Music mind Machine"
10:18Hodappnaeu: I haven't used supercollider at all yet, so I was more asking than saying
10:18naeuHodapp: it's worth looking at. It essentially offers a programming interface to PD-style data graphs
10:18naeuso instead of pointy-clicky-click, you can typey-type-type
10:18naeuand with Overtone you can macro-boom-expand
10:19Hodapplol... I think you can typey-type-type in Pd too but I haven't used it in awhile
10:19HodappI 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:20naeuhahahahahaha
10:23Hodappnaeu: did you ever answer if you'd used Processing at all or not?
10:27naeuHodapp: sorry, I forgot to answer - I have looked at it, but haven't used it for anything serious
10:28naeuI think it's pretty cool though
10:28HodappIt's quite neat, but I'm not much a fan of Java sometimse
10:29Hodappjust find it clumsy and verbose, though not nearly as much as C++
10:30Hodappbut 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:30Hodappand things get messy quickly when you try to throw SIMD or GPUs or clustering into the mix
10:31praptakHow 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:32naeuHodapp: do you have any opinions on the difference between Processing and Penumbra?
10:33HodappPenumbra?
10:33Borkdudepraptak: why would you want to do that?
10:34praptakWell, if it's possible I want to be able to do that :)
10:34praptakI'm just curious.
10:35naeuHodapp: http://github.com/ztellman/penumbra
10:38Hodappnaeu: unavailable
10:39naeuhmmm, i was just on it
10:39defnyeah it's there
10:39Hodapphmm, it did say "temporarily unavailable"
10:40Hodappyeah, it's up for me now
10:40Hodapppenumbra looks like it has a much more narrow focus than Processing
10:44zmilawhile github/penumbra is down one may use http://www.penumbragame.com/ :))
10:44sexpbot"The Penumbra Series"
10:46naeuI get errors in Penumbra's HEAD running the examples
10:47Hodappzmila: Penumbra is quite an awesome game.
10:48zmilaHodapp, very maybe :) but it refused to start on my laptop
10:54rlmcintyreHi 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:57Borkduderlmcintyre: sounds weird indeed
10:57rlmcintyreAn example that shows what I'm talking about is:
10:57rlmcintyre(defmacro proxy-functions-bad
10:57rlmcintyre []
10:57rlmcintyre (into
10:57rlmcintyre (list (list (symbol (str "run" "")) [] (list 'println 5)))
10:57rlmcintyre (list [] (vector Runnable ) 'proxy)))
10:57rlmcintyreIt works if you copy and paste macroexpand-1's output, but not if it is directly called.
10:58rlmcintyreI feel like this souldn't be possible at all.
10:59chouserrlmcintyre: yes, the symbol function is too permissive
10:59chouserrlmcintyre: yes, the symbol function is too permissive
11:00rlmcintyrewhat's going on though -- isn't it the same reader in both cases?
11:01chouserthe problem is the symbol you're creating prints differently than it reads.
11:01chouser,(symbol "run" "")
11:01clojurebotrun/
11:02chouser,(read-string (pr-str (symbol "run" "")))
11:02clojurebotjava.lang.RuntimeException: java.lang.Exception: Invalid token: run/
11:02nurvHi.
11:04chouserrlmcintyre: 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:05hiredman,(symbol ":foo")
11:05clojurebot:foo
11:05chouserrlmcintyre: 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:06rlmcintyrebut then this means that the homoiconicity of the language is broken w.r.t. the sumbol function?
11:06chouserrlmcintyre: http://www.assembla.com/spaces/clojure/tickets/17
11:06sexpbot"#17 - GC Issue 13: validate in (keyword s) and (symbol s) (Test) | Clojure | Assembla"
11:08chouserrlmcintyre: 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:08rlmcintyreso it's more of not catching an invalid program then
11:08rlmcintyreI see
11:08chouserwyeah
11:08chouseryeah
11:09chouserNobody promised that every possible datastructure can be printed and re-read to produce identical results.
11:09chouser,(java.util.Date.)
11:09clojurebot#<Date Mon May 10 08:14:04 PDT 2010>
11:10chouser,(read-string (pr-str (java.util.Date.)))
11:10clojurebotjava.lang.RuntimeException: java.lang.Exception: Unreadable form
11:20BorkdudeDoes Java have verbatim strings like C# or do I have to put "\\w" in regexes?
11:21Licenseraloa
11:21LicenserBorkdude: no and no
11:21hiredmanBorkdude: 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:22Borkdudehiredman: I was asking about Java, not Clojure
11:22Licenseroh I thought you were talking clojure too, I've no idea aobut java
11:23hiredmanBorkdude: well, you picked an odd place to ask
11:23Borkdudeyeh, sorry for the confusion
11:23Borkdudehiredman: I think not, since there must be some Java people in this room ;)
11:23naeuhow do i create a regexp matcher from a string?
11:23hiredmanmore in ##java
11:24hiredmanbut I do believe Licenser did answer for java
11:24hiredmanat least as far as the first no
11:24Licenserlies, all lies, I think for java it is no and yes
11:25LicenserBorkdude: 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:25Borkdudehaha
11:27BorkdudeAnonymous Javadevs?
11:27Licenseryea something like that
11:27kylesmithDoes anyone have any thoughts/experience implementing iterative algorithms with Batch systems (such as PBS)?
11:27LicenserHello everyone, please welcome Blkt to our group. Blkt do you want to share your problem with us?
11:28BorkdudeLicenser: I will only join if the classes are anonymous too ;-)
11:28LicenserBorkdude: we use proxy
11:28Licenserkylesmith: no but I think there are some examples in the sun HP-Cluster package
11:29kylesmithAck, I should have said search algorithms.
11:29kylesmithLicenser: link?
11:30Licenserkylesmith: let me dig it out
11:31Licensersince oracle bought sun all went down the tdrain there :(
11:31BlktLicenser: I actually do not have any kind of problems but I'll be glad to inform you whenever I got one :)
11:31LicenserThat is OK Blkt we all take our time untill we are ready to admit our problems
11:32Licenserkylesmith: http://gridengine.sunsource.net/ is the one thing I mean
11:32sexpbot"gridengine: Home"
11:32LicenserI think at least
11:33BorkdudeOff to the train, the place I can read some more The Joy of Clojure.
11:37kylesmithLicenser: 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:38Licenserkylesmith: I just menated that in the sge package there are some examples of algorismth
11:43kylesmithLicenser: I found the javadocs, but there isn't an sge package.
11:43Licenserhmm the sun grid engine, I downloaded it a year ago,
11:47kylesmithLicenser: I don't think the sun grid engine is what I want.
11:47LicenserI know all I was saying is that there were examples in ther that might help
11:49kylesmithI can't find the examples.
11:55chouserit would be so nice if auto-gensym worked in nested unquote/syntax-quote contexts
11:55chouserthat shouldn't be impossible, should it?
11:55chouserChousuke, hiredman: did either of you look at doing that in your readers?
12:05puredanger_so is clojure.contrib.string now the place I should look first for string-related functions in a clojure 1.2 world ?
12:06chouserpuredanger: I think that's right.
12:06lpetitpuredanger_: I guess so
12:06lpetit$mymail
12:06chouserunless those have moved to clojure.string
12:07puredangerafaict there is no clojure.string (yet)
12:16puredangerwhat'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:17technomancypuredanger: 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:18puredangerhow about filing an assembla ticket *without* a patch?
12:18technomancyactually that'd probably be fine
12:22puredangertechnomancy: done: https://www.assembla.com/spaces/clojure/support/tickets/344-reduce-docstring-args-don-t-match-docs
12:25hiredmanchouser: I did not, I know Chousuke was looking at making syntax-quote a macro, something which I have recently become interested in
12:27hiredmando you really think nesting is desired?
12:30hiredman,(squote '(A B C# (unsquote-splice [1 2 3]) C#))
12:30clojurebot(list (quote sandbox/A) (quote sandbox/B) (quote C__15399) 1 2 3 (quote C__15399))
12:32puredangerit seems to me like this should return nil rather than throw NPE: (replace-str "a" "b" nil)
12:33hiredman,(doc replace-str)
12:33clojurebotexcusez-moi
12:33puredangeropinions?
12:34puredangerto be more precise: (clojure.contrib.string/replace-str "a" "b" nil)
12:34puredangeruser=> (doc replace-str)
12:34puredanger-------------------------
12:34puredangerclojure.contrib.string/replace-str
12:34puredanger([a b s])
12:34puredanger Replaces all instances of substring a with b in s.
12:34chouserhiredman: nice
12:35hiredmanas a multimethod it works out well
12:35chouserbut yes, I'd like to `(fn [a#] ~(for [x [1 2 3]] `(a# ~x)))
12:35hiredmanwell, sure
12:36chouserthat's all I meant
12:36hiredmanI know
12:36hiredmanI just don't now that it is wise to support such a thing
12:37hiredmancould be, I am not sure though
12:37chouserI'm having trouble seeing how it would be a problem.
12:39hiredmanchouser: for must macroexpand to something that could contain a `#a somewhere right?
12:39hiredmaner
12:40hiredmana#
12:40chouserI was thinking the outer ` would register the name it picks for a# somewhere so that the inner a# could find it
12:40hiredmanright, but the for
12:41hiredmanI dunno
12:41hiredman*shrug*
12:41chouseroh, uh -- yeah, I guess so.
12:41hiredmanmonday morning
12:41chouser:-)
12:42Licenserokay something to try out: http://tryclojure.licenser.net/
12:42sexpbot"TryClojure"
12:43chouserLicenser: nice
12:43peregrine81Licenser: I get security exceptions when I try to do
12:43peregrine81(def p "Hello")
12:44peregrine81or (defn p [] (str "hello"))
12:45Licenserperegrine81: of cause, because defing things isn't allowed
12:45peregrine81Licenser: Very nice though I was looking for something like this all weekend I ended up with Lord of The Repls
12:45Licenserdefing things means storing stuff on the server, storing stuff on the server means the posibility toflood it
12:46peregrine81Licenser: how does http://lotrepls.appspot.com/ do it?
12:46sexpbot"Lord of the REPLs"
12:46chouserLicenser: I'm afraid you're storing stuff on the server anyway.
12:46hiredmanperegrine81: I imagine they let google worry about it
12:46Licenserchouser: am I? but I shouldn't for any long period - I think
12:46Licenserheh
12:46LicenserI'm not sure so, you might very well know something I don't :P
12:47Licenserlotr does not work at al for me
12:47chouserhuh. do send-off and no agent
12:47chousers/do/no/
12:47sexpbothuh. no send-off and no agent
12:47chousersexpbot: stopit
12:48Licenserchouser: how do you mean?
12:48chouserLicenser: those are disallowed fns
12:49Licenserhmm do is disallowed?
12:49Licenserna do is fine
12:49Licensersend-off and agent are
12:49chouserno, "send-off" and "agent" are disallowed
12:49chouserright
12:49LicenserI know, I write the sandbox it runs in :P
12:50peregrine81Licenser: whats the use of clojure without fns its no fun!
12:50stuartsierraDoes defrecord have a place for a doc string?
12:50Licenserperegrine81: use let :P
12:50peregrine81Licenser: it just seems there are better ways to get around it then just carpet bomb blocking it
12:51Licenserbut 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:51Licenserbut I like my carpet bombs :(
12:51peregrine81Licenser: Thats what I was thinking :)
12:51Licenserbut that means research for java and I don't like java :P
12:51chouserit'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:51chouseris there a list somewhere?
12:51peregrine81Licenser: http://www.devx.com/tips/Tip/14688
12:51sexpbot"Setting the Default Memory Limit of the JVM"
12:52Licenseroh no I know how to do it for a JVM
12:52Licenserbut I want to do it for a sandbox of the JVM
12:52chouserstuartsierra: I don't think so. I'm not sure anyone's figured out where a docstring would be stored.
12:52Licenserthe JVM itself is limited already
12:52stuartsierrachouser: ok, thanks
12:52Licenserbut doing that means 1 user can claim all the memory = bad
12:52peregrine81Licenser: my battery is going to die, sorry to run so soon :(
12:53Licenserno worries toa care peregrine81
12:53chouserstuartsierra: there's a nice options area though -- might show up there eventually
12:53chouser(defrecord Foo [a b c] :doc "Potential docstring, currently useless and harmless")
12:55stuartsierraright
13:06stuartsierrafogus: I agree with that article in principle, but I also believe the "community process" of Lisp failed decades ago.
13:06chouser"Everyone should be writing new Lisps! ... but stop whining about how it's a more modern or better Lisp"
13:07fogusstuartsierra: I don't know enough about the Lisp process it to comment
13:07chouserso writing new lisps is good as long as we claim they're only the same or worse than existing lisps?
13:07AWizzArdThis article is not worth discussing it. Now you drove some attention to it which it doesn't deserve.
13:07foguschouser: I take the opposite approach. My Lisp is the worst Lisp ever written, it's neither modern nor good
13:08stuartsierrahttp://xkcd.com/386/
13:08chousersounds like exactly what he's recommending
13:08sexpbot"xkcd: Duty Calls"
13:09fogusAWizzard: Why is it not worth discussing? Especially on a Clojure channel
13:10AWizzArdIt 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:12fogus"Well, if it works, Lisp will adopt it in a couple of decades." <- My favorite part
13:12AWizzArdyes :-)
13:13AWizzArdfogus: I find articles such as http://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html more interesting.
13:13sexpbot"Messages not Models: Clojure vs JavaFX Script: only 5x slower!"
13:15fogusI 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:17AWizzArdSo far it got 0 comments. Just a random guy, frustrated about new technologies instead of embracing them.
13:17chouserOne thing I'd like to try is to be very affirming about the investment required to learn a new language.
13:17chouseryes there are a lot of new languages all the time. yes it's hard to know which are worth any time at all.
13:18chouseryes 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:18chouseryes if you choose to learn a particular language well, it may not end up being directly useful to you anytime soon.
13:19chouserit's hard. we get that. you shouldn't feel bad for ignoring languages based on very little investigation.
13:19foguschouser: That's a perspective that I hadn't considered
13:20chouserhopefully 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:20fogusSeems incredibly ... reasonable
13:21chousermaybe 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:21chouseror "what's your current favorite language, and what about it do you like the least?"
13:23fogus#2 is my favorite interview question. :-)
13:23chouserthe 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:23chouseryet
13:29foguschouser: 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:29puredangerpersonally, I find it's most productive to make AWESOME rather than to try to combat AWFUL
13:30puredangerat least, it's more fun
13:30chouserhis 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:30Borkdudechouser: what link is this about?
13:31chouserand if everyone does that, how do we have any better idea if it's good in 20 years than we do today?
13:31chouserBorkdude: http://axisofeval.blogspot.com/2010/04/why-i-ignore-clojure.html
13:31sexpbot"The Axis Of Eval: Why I ignore Clojure"
13:31chouserat least it's short. :-)
13:32chouseranyway, 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:32chouserso trying to debate directly would most likely just harden positions.
13:33foguschouser: based on some comments elsewhere, it seems that the Python camp has come to the same conclusion
13:33chouserthe python camp regards clojure the same way? Or that's how python camp approches evangelism.
13:34fogusThe python camp has come to the same conclusions about that blog as you have 2-3 sentences before
13:34Borkdudehmm, if persistent datastructures would be good, Lisp (Common Lisp?) would adopt it in the long end? isn't that like breaking with tradition?
13:34chouseroh. huh.
13:36Borkdudeit's not clear to me what he means with Lisp. Clojure is a Lisp right?
13:36Borkdudeso how can Clojure ignore it
13:36hiredmanhe means common lisp, of course
13:37BorkdudeAnd Common Lisp would adopt immutability? I don't believe it
13:40BorkdudeObviously 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:40sexpbot"Manuel J. Simoni | Lambda the Ultimate"
13:45technomancychouser: 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:45chouserhm.
13:45chouserI should probably have rel=nofollow
13:45LauJensenchouser: wow, that was a fun/sad read
13:46chouserLauJensen: fogus found it. I'm not sure "fun/sad" is a real thing. ;-)
13:46LauJensenWhadda ya mean ?
13:46LauJensenfogus probably wrote it, just to hype up a conflict to draw more attention to your book "The Joy of ignoring Lisp"
13:46fogusI felt fun/sad once... it opened a rift in the space-time continuum.
13:46chouseryeah, like that.
13:47cemerickthat axis fellow sounds a lot like the loper fellow, after a margarita
13:47chouserheh
13:47RaynesThat loper guy was amusing.
13:47LauJensencemerick: in case you're still confused about his opening statement, it read "<ignores who="clojure">lisp</ignore>"
13:47foguscemerick: Oh yeah, I forgot about that Loper guy
13:47clojurebotclojure is the best way to learn java
13:48cemerickthe loper guy is awesome. Artful stuff.
13:58fogusBut I have to say, the blog name Axis of Eval is pretty clever.
13:58cemerickman, a scheme article on IBM DW?
13:59fogusNot only that, but Pt. 2!
13:59LicenserI find the articlele posted erlyer pretty arroant :/
13:59cemerickit's their once-a-decade lisp article
13:59fogusYou mean I have to wait 10 years for pt. 3?!
14:00cemerickheh, looks like it!
14:01tcrayfordgrrr, working out where to use protocols is confusing
14:02tcrayfordI'm writing a library that renders datastructures (doesn't matter how) in multiple ways
14:03tcrayforddo 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:03chousertcrayford: sounds like you might actually want multiple dispatch
14:03tcrayfordyeah
14:03tcrayfordie multimethods
14:03chouserright, instead of protocols
14:04tcrayfordI've started out with if statements, (am just spiking atm), but its getting ugly damn fast
14:06tcrayfordcan I get at interfaces with multimethods?
14:07tcrayfordsay I want to dispatch on wether thing implment 'Named'
14:10kotarakCan someone enlighten me, why apply holds unto the head in certain situations?
14:10kotarakI tried to understand it, but didn't see an obvious reason.
14:13stuartsierrakotarak: 'apply' will force the entire sequence
14:13stuartsierra(apply + (range 5)) becomes (+ 0 1 2 3 4)
14:13kotarakstuartsierra: no, it's lazy
14:13kotarakstuartsierra: but it holds the head.
14:13chousertcrayford: yeah
14:13stuartsierrakotarak: 'apply' is not lazy
14:14kotarak,(let [x (fn [& more] (take 5 more))] (apply x (iterate inc 1)))
14:14clojurebot(1 2 3 4 5)
14:14kotarakSeems lazy
14:14stuartsierraIt's not.
14:14technomancy,(take 1 (apply concat [[1 2 3] (iterate inc 0)]))
14:14clojurebot(1)
14:15chousertcrayford: http://paste.lisp.org/display/99039
14:15puredangertcrayford: yes, you can do that - multimethods are class hierarchy aware (see isa? and derive)
14:15kotarakstuartsierra: ok, then I don't get laziness
14:15tcrayfordchouser: many thanks
14:17chouser"foo is lazy" is frequently an oversimplification.
14:17stuartsierrakotarak: Only things which return a lazy sequence can "be lazy."
14:17chouseryou can pass a seq of infinite args via apply, so in that sense it's lazy
14:17stuartsierrachouser: what?
14:17stuartsierra,(apply + (iterate inc 0))
14:18clojurebotExecution Timed Out
14:18chouserthat fails because + is eager, not because apply is.
14:18kotarakstuartsierra: what happens depends on + not on apply
14:18stuartsierraok
14:18kotarakchouser:
14:18kotarakwoops
14:18stuartsierraNo, it happens because 'apply' realizes the entire sequence.
14:18kotarak,(let [x (fn [& more] (take 5 more))] (apply x (iterate inc 1)))
14:18clojurebot(1 2 3 4 5)
14:18chousertechnomancy showed apply used with an infinite arg seq
14:18hiredmanstuartsierra: nope
14:19stuartsierraI'd need to see that example then.
14:19kotarakapply "fails" if you run into spread in its implementation. I don't understand why.
14:19Borkdude,(apply take 1 (iterate inc))
14:19clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$iterate
14:19hiredman,(apply (constantly :foo) (repeatedly #(println :bar)))
14:19clojurebot:foo
14:19clojurebot:bar :bar
14:19hiredmancheck that out
14:19kotarak,(take 1 (apply concat [[1 2 3] (iterate inc 0)]))
14:19clojurebot(1)
14:19hiredmansort of lazy'ish
14:20stuartsierrano
14:20hiredmanyeah, it doesn't realize the entire sequence of println's
14:20stuartsierraNone of these examples convince me that 'apply' is lazy.
14:20hiredmanjust the first two, for some reason
14:20Borkdude ,,(apply take 1 (iterate inc 0))
14:21Borkdude,(apply take 1 (iterate inc 0))
14:21hiredmanBorkdude: that won't work
14:21Borkdudetyping is difficult
14:21clojurebotExecution Timed Out
14:21Borkdudehehe
14:21chouser,(letfn [(odd-args [& xs] (filter odd? xs))] (take 5 (apply odd-args (iterate inc 0))))
14:21clojurebot(1 3 5 7 9)
14:21hiredmantake takes two arguments and you are trying to give it infinite arguments
14:22chouserstuartsierra: there is apply being given an infinite arg seq and returning a lazy seq. what more do you want?
14:22stuartsierraIt's still not doing anything lazy, merely manipulating functions that are themselves lazy.
14:23stuartsierraIt cannot receive an infinite seq in the last argument position.
14:23chouseryes it can. it just did.
14:23kotarakMay 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:23chouserin what way is (apply odd-args (iterate inc 0)) not receiving an infinite seq in the last argument position?
14:24chouserkotarak: your question is harder. we'd rather just argue with stuartsierra.
14:24chouser:-D
14:24kotarakchouser: :)
14:24stuartsierraheh
14:24Borkdudehiredman: oh yeh
14:24stuartsierraok, (take 5 (apply odd-args (iterate inc 0))) bothers me
14:25stuartsierraThat works because odd-args is a function on a lazy sequence.
14:25chouserstuartsierra: yes. nobody is claiming apply can take an eager fn and somehow make it lazy
14:25stuartsierraright.
14:26stuartsierraBut the fact that it works at all seems wrong to me.
14:26chouserbut also, apply does *not* force the final seq you give it
14:26chouserthe fn might, but apply does not
14:26stuartsierraThat seems impossible to me. But obviously I am wrong.
14:26chouserstuartsierra: it certainly seemed impossible to me
14:28kotarakWell, it should conses the other args onto the front of the seq.
14:28kotaraks/should/just/
14:28sexpbotWell, it just conses the other args onto the front of the seq.
14:28kotarakIt forces only the first step with seq.
14:29stuartsierraBut this doesn't work: (apply take 5 (iterate inc 0)))
14:29chouserapply forces as many steps as needed to supply non-variatic args required by the target function
14:29stuartsierraah, yes, it's the variadic-ness that makes it work
14:30hiredmanstuartsierra: 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:30stuartsierrayse
14:30stuartsierrayes
14:30stuartsierraNow I no longer assert its impossibility.
14:31stuartsierraWe now return to your regularly scheduled programming...
14:31chouserwhich unfortunately is trying to answer kotarak's harder question
14:32kotarakOk. 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:32hiredman,(doc list*)
14:32clojurebot"([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:33chouser(apply take 5 (iterate inc 0)) is broken
14:33hiredmanthat just can't work
14:33kotarakYeah. 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:34hiredmankotarak: apply doesn't
14:34hiredmanthe helper method applyTo exists on the function
14:34chouseryeah, what I said there as a bit misleading
14:34chouserright
14:34hiredmanapply just passes the seq off
14:34chouserwhich is why it is always slower, even if the args would line up
14:35kotarakchouser: ah, ok. I'm happy again. Phew. Now back to my previous question. ;P
14:35hiredmandepends on the fn being applied I suppose
14:46edbonderror loading slime: http://pastie.org/954153
14:46edbondvoid-variable package-activated-list
14:46edbondusing git versions, not elpa
14:47Borkdudehmm this on the other hand forces the thing: (take 5 (apply #(filter odd? %&) (iterate inc 0)))
14:48stuartsierraBorkdude: I don't think #() supports var-args.
14:48hiredmandoes
14:48hiredman%&
14:48edbondlol
14:49stuartsierraOh, ok. Well I'm just wrong all over the place today.
14:49stuartsierra:P
14:50mmarczykkotarak: do you have an example of apply holding onto the head and thus causing trouble at hand...?
14:52kotarakmmarczyk: (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:53BorkdudeThis 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:53mmarczykkotarak: thanks, but... really? then I second your question (going off to see for myself)
14:55kotarakmmarczyk: I suspect that in the second case the locals are not cleared, but I don't know, why.
14:58DuneManapply does this
14:58DuneManyes
14:58BorkdudeTo keep this interesting question persistent and clear, I posted this question at SA: http://stackoverflow.com/questions/2805575/clojure-apply-and-lazy-evaluation
14:58sexpbot"Clojure apply and lazy evaluation - Stack Overflow"
14:58DuneManwhen the function that is being applied to takes [& args]
14:58DuneMan(apply (partial .....) <some infinite sequence>)
14:58DuneManI ran into that last week
14:59DuneManthough I don't recall if that was fixed by 1.2
14:59kotarakBorkdude: you should post on the google list, chances of high-quality answers are higher
14:59kotarakDuneMan: Ah. Let me check. Maybe I'm using 1.1 and look at the sources of 1.2! :/
14:59Borkdudekotarak: feel free to do it
15:00chouser1.2 has local-clearing magic in the compiler itself
15:00DuneManI fixed the apply/rest-args bug, and then found another, then upgraded to 1.2
15:00DuneManso Im not sure if 1.2 will fix it.
15:03mmarczykBorkdude: I'm not sure about your examples on SO
15:03mmarczyk#(filter odd? %&) translates -- at read time! -- to (fn* [& xs] (filter odd? xs))
15:03mmarczykso I find it hard to believe there's a difference :-)
15:04Borkdudemmarczyk: me 2
15:04Borkdude:-s
15:04mmarczykwell that's your SO question :-P
15:04kotarakHmm.. No 1.2 fails also for me.
15:05BorkdudeHmm, did I say SA? SO I mean of course
15:07Borkdudemmarczyk: if you evaluate the result of macroexpand with the #() it doesn't force
15:07mmarczykum, what do you mean, macroexpand
15:08mmarczyk,(first '#(+ %1 %2))
15:08clojurebotfn*
15:08mmarczyk,(second '#(+ %1 %2))
15:08clojurebot[p1__15467 p2__15468]
15:08mmarczyk,(nth '#(+ %1 %2) 2)
15:08clojurebot(+ p1__15472 p2__15473)
15:08Borkdude,(macroexpand '(take 5 (apply #(filter odd? %&) (iterate inc 0))))
15:08clojurebot(take 5 (apply (fn* [& rest__15477] (filter odd? rest__15477)) (iterate inc 0)))
15:08Borkdude,(take 5 (apply (fn* [& rest__15477] (filter odd? rest__15477))
15:08Borkdude (iterate inc 0)))
15:08clojurebotEOF while reading
15:08mmarczykwell there's nothing to macroexpand with take in the operator position
15:10Borkdudemmarczyk: oh yeh, just '(...) is enough
15:12mmarczykkotarak: I've changed your fn to only print the last item
15:12mmarczykkotarak: seems to work either way
15:12kotarakhmm...
15:12mmarczykkotarak: i.e. (apply print-many 0 1 2 3 4 (iterate inc 0)) and (apply print-many (iterate inc 0)) both do fine
15:12BorkdudeI'm still thinking that macroexpand is like mexpand-all
15:12mmarczykon the current HEAD, I believe
15:13mmarczykBorkdude: actually #() involves no macroexpansion
15:13mmarczykBorkdude: it gets translated into a fn* form at read time
15:13Borkdudeit is a reader macro, which will get expanded by the reader, yes I know
15:14mmarczykright, so clearly the only place where macroexpansion might happen is in the (fn ...) example
15:14mmarczykbecause fn is actually a macro
15:14Borkdudeah
15:14mmarczykbuilt on top of fn* to handle destructuring etc.
15:14mmarczykoh, in fact, you might have been referring to the differences resulting from this all along :-)
15:15mmarczyksorry, I only realised just now
15:16Borkdudemmarczyk: explain?
15:17Borkdudeeh, ah, because fn and fn* differ, you mean?
15:18mmarczykBorkdude: well, I might be misunderstanding you, but I gather you've posted that SO question with two examples which are actually the same...?
15:19mmarczyk,(macroexpand '(fn [& xs] (filter odd? xs)))
15:19clojurebot(fn* ([& xs] (filter odd? xs)))
15:19mmarczyk,'#(filter odd? %&)
15:19clojurebot(fn* [& rest__15484] (filter odd? rest__15484))
15:19DuneManbut yeah, this makes sense, doesn't it, that it would hold onto the head?
15:19mmarczykDuneMan: does it? :-)
15:20mmarczykin fact, I've just ran through 10,000,000 items of (iterate inc 0) with sth like kotarak's print-many
15:20kotarakmmarczyk: just testing with latest snapshot.
15:20DuneMan(f [& args] (let [a reduce(... (filter.... args))] (next args...)))
15:20mmarczykbut amended to only print at the end and actually execute that many iterations of the loop
15:20DuneManWhy wouldn't "args" still point tot he head there?
15:21mmarczykkotarak: ok
15:21kotarakmmarczyk: I've got probably some old snapshot here.
15:21mmarczykkotarak: I'm working with what I pulled from Git yesterday
15:21LauJensenIn terms of shell-script, is there an easy way to produce the correct classpath string for all the jars in lib/ ?
15:21BorkdudeHmm, wait, now they both just work
15:21mmarczykDuneMan: locals tend to be cleared in Clojure when the compiler can prove they won't be needed again
15:22LauJensenmmarczyk: thats old-school. Now they're cleared more agressively
15:22mmarczykLauJensen: cp=""; for jar in lib/*.jar; do $cp="$jar:$cp"; done
15:22DuneManAh, so if it weren't used anywhere except as the input to a seq-eating function then the local should be cleared?
15:22LauJensenmmarczyk: thanks
15:22mmarczykLauJensen: you mean even when the compiler can't prove that? :-)
15:22DuneManThat's sorta confusing :-)
15:22mmarczykLauJensen: yw
15:23LauJensenmmarczyk: Rich added agressive locals clearing a while ago. And at least in the beginning it was sometimes just a little bit agressive IIRC
15:23DuneManin fact, thats confusing enough that I'd almost be annoyed if it worked that way.
15:23BorkdudeHmm, 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:23mmarczykLauJensen: yeah, maybe that's the difference between what kotarak is seeing and what I'm seeing
15:23mmarczykDuneMan: :-D
15:24DuneManBecause it becomes stupid hard to tell where you're holding references
15:24LauJensenBorkdude: That has driven me nuts in the past, when SLIME forces lazy-seqs and then when you deploy, threads hang...
15:24DuneManwithout knowing the locals clearing rules
15:24mmarczykBorkdude: no worries, though you might want to remove your Q or self-answer if the problem disappeared
15:24DuneManand then, if you're doing somethign where memory actually matters (like in my code!)
15:24DuneManit becomes nigh impossible not to write head-hold bugs
15:24mmarczykBorkdude: if indeed you mean to say that it disappeared, I might be to tired to understand myself :-)
15:24Borkdudemmarczyk: I deleted it
15:25mmarczykBorkdude: right, just got the funky "not found" SO page
15:26kotarakmmarczyk: I still see it with snapshot 20100507.230258-69
15:26mmarczykBorkdude: incidentally, great question about podcasts for Clojurians
15:26mmarczykBorkdude: I hope somebody, somewhere finds the number of upvotes inspiring :-)
15:26Borkdudemmarczyk: tnx, hope that too :)
15:27mmarczykhttp://pastie.org/954219
15:28mmarczykkotarak: see above for what I'm doing
15:28mmarczykkotarak: am I missing something...?
15:28stuartsierraanybody know how to disable email notifications in Assembla?
15:29stuartsierranever mind, found it
15:29DuneManIt seems to me that local clearing, when it effects actual runtime behavior (like memory holding), should be... carefully and well defined
15:29DuneManMaybe I just don't know the rules yet, but it appears others don't as well.
15:30DuneManaffects*
15:30kotarakmmarczyk: you can save the first more. the next realises it anyway
15:30kotarakWill test
15:30mmarczykDuneMan: if it works well, you never notice, except it's easier to lose the head
15:30DuneManWell then it doesn't work well.
15:30DuneManBecause I notice it all the time.
15:30chouserDuneMan: in 1.2?
15:30DuneManyes.
15:31chouseras in, you run into code that mysteriously holds the head?
15:31mmarczykhow d'you mean?
15:31DuneManWell, yes in 1.2 if the (apply (partial...) ...) thing still does what it did before
15:31DuneManchouser: yes. Though in the last few days I've gone a long way to understanding some of those cases
15:31DuneManand now seem valid.
15:32DuneManOne issue is that library functions do this as well
15:32DuneManand its hard to know which ones will
15:32DuneMane.g. partition/partition-by will realize each whole partition in memory at some point.
15:32kotarakmmarczyk: no. fails here. -.-
15:32DuneManor will try to until your JVM crashes.
15:32DuneManif your partitions are large.
15:32mmarczykkotarak: oh bother :-(
15:32DuneManbut that's not local clearing
15:32DuneManso.
15:32mmarczykkotarak: you mean "fails" as in "crashes"?
15:33kotarakmmarczyk: OutOfMemoryError
15:33mmarczykkotarak: um, I wonder if I should try lowering the memory limit
15:34mmarczykon the other hand, why not just add to zeros to the number of iterations
15:34mmarczyk^two zeros
15:34hiredman,1e0
15:34clojurebot1.0
15:35mmarczykDuneMan: right, we talked about it the other day
15:35chouser,(apply (partial #(second %&) :skip) (iterate inc 0))
15:35clojurebot0
15:35DuneManmmarczyk: right.
15:35Crowb4rwhen does 1.2 become a stable release?
15:36DuneManSo 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:36chouserCrowb4r: coming up fast on a beta release, already essentially in feature-freeze
15:36DuneManand thus deducing the rules the compiler is using.
15:36mmarczykDuneMan: in the partition-by case, you gave the correct reason
15:36Crowb4rchouser: awesome
15:36mmarczykDuneMan: the "drop-while" closure is holding onto the head
15:37mmarczykDuneMan: wow, in fact
15:37Crowb4rSo, clojure might have just helpped me land a software dev job. :) Apperently learning a new language and playing with it constantly does that.
15:37mmarczykDuneMan: 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:37chouser(apply (partial #(last %&) :skip) (iterate inc 0)) ; does not seem to consume memory
15:38mmarczykCrowb4r: great :-)
15:38DuneManchouser: now that's interesting :-P
15:38mmarczykkotarak: right, so I got an OutOfMemoryError finally
15:38mmarczykkotarak: but it includes a message: "GC overhead limit exceeded"
15:38DuneManYes, that's what happens
15:39DuneManwhen the GC is doing too much work running over the object graph
15:39kotarakmmarczyk: For me it just says Java heap space.
15:39mmarczykkotarak: how about "things get left behind and freed, but the GC can't keep up with the pace"
15:39chouserDuneMan: we had a fairly extensive section in the book discussing accidental head-hold with examples, suggestions for solving certain cases, etc.
15:39chouserthen rhickey added the local-clearing magic to 1.2 and all our examples suddenly "just worked"
15:39DuneManchouser: Oh, maybe I should read that.
15:39kotarakmmarczyk: why does then the other apply form work, which goes just as fast?
15:39mmarczykkotarak: "and at some point it gives up"; could be pretty random
15:39DuneManOh.
15:39chouseryeah
15:39mmarczykkotarak: yeah, just realised that...
15:39chouserso we fumbled a bit trying to get something useful and I think finally just removed it.
15:39Borkdudechouser: which section is that again? I'm curious if I forgot or if I'm about to read it
15:39mmarczykkotarak: let me check if it does indeed work for me
15:40kotarakchouser: you may blog post just blew up. :)
15:40DuneManchouser: Well, a suggestion would be "These library functions will realize things even when it looks lazy... beware!"
15:40mmarczykchouser: 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:40chousersection 5.3
15:41Borkdude5.3 let me see
15:41chouserkotarak: sorry, what?
15:41Borkdudeco-incidentally that is the section where I stopped just before in the train today
15:41chouserBorkdude: heh.
15:41DuneManDoes 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:42DuneManI just find that fundamentally worrisome
15:42chouserhm, it's not quite as extensive as I rememberd.
15:42DuneManit means you have to look at the implementation of every function to figure out what the hell it will do.
15:42chousermaybe we'd already slimmed it down a bit.
15:42kotarakchouser: 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:43chouserkotarak: ah. :-) exactly.
15:43Borkdudechouser: are the versions of TjoC using a persistent datastructure? it must be still somewhere
15:43DuneManmaybe all of my concerns will go away with more experience.
15:44chouserI suppose I've rarely tried to work with lazy sequences that won't fit in memory
15:44DuneManThat is my whole use-case.
15:44DuneManterabytes of streaming data.
15:44DuneManwith many gigabyte - terabyte-sized partitions
15:45jwr7Hmm. 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:45DuneManI've been watching sawtooth memory graphs for a week :-D
15:45mmarczykkotarak: 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:45chouserDuneMan: heh
15:45mmarczykkotarak: thus the varargs version would in fact lose the head, but generate *loads* of GC work
15:45chouserjwr7: you might look at bound-fn
15:46hiredmanjwr7: good
15:46hiredmanplease write to your local library authors and tell them to stop providing apis that use binding
15:46kotarakmmarczyk: 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:47kotarakHmm.. I remember something with delay and local clearing and that it was too aggressive. Maybe it's turned off again?
15:47jwr7chouser: I know about bound-fn, but if I understand it correctly, it doesn't help much.
15:48jwr7hiredman: I just wrote to myself. I went through a pile of code and removed all dynamic variables.
15:48hiredmannice
15:48mmarczykkotarak: ouch, right
15:48BorkdudeHow about the lazy sequence (spider internet)
15:49Borkdude(spider the-web) is better maybe ;)
15:49ataggart(crawl spider the-web)
15:51Borkdude(apply crawl spider the-web)... omg, what will happen
15:51DuneManmmarczyk: I gave up on writing a really-lazy-partition and am just using my strange nested recursive-lazy-seq thing, which works :-P
15:51DuneManmaybe I'll try again sometime
15:51mmarczykDuneMan: fair enough :-)
16:44woobywould you guys consider 'ruby has open classes, protocols are like open interfaces' a valid analogy for people coming from ruby?
16:45chouserby open classes do you mean monkey-patchable
16:45chouser?
16:45kotarakwooby: ruby has monkey-patching
16:45wooby(these people being me :)
16:45cschreinerevening!
16:45woobyhallo
16:45mmarczykprotocols have no name collision issues
16:45DuneManI prefer bonobo patching, much more erotic.
16:45DuneMan*stops making comments*
16:45woobylol
16:45mmarczykin contrast to monkey-patching
16:45kotaraknono, kein bonobo, will kein bonobo sein, neinneinnein
16:46mmarczykjust to name one example of how the analogy might be less than perfect ;-)
16:46woobyi think i just need to read more code
16:46woobyanyone aware of a body of short record/protocol snippets up somewhere?
16:47cschreinerclojure.org/protocols
16:48mmarczykalso search what's currently on the index of disclojure.org for a number of links to blog posts etc. on protocols
16:48woobythank you all
16:48mmarczyksame goes for planet.clojure.in, I suppose, though you'll get full posts there
16:49cschreinerCircuit Breaker is a nice resource though
16:58mmarczykkotarak: funnily enough, (. print-many (applyTo (seq (iterate inc 0)))) just threw Java Heap Space for me
16:59kotarakthings happen to people who drink fiasco
17:00woobycan huge arg lists inadvertently blow heap?
17:00kotarakwooby: depends
17:07arohnerwooby: you can pass infinite seqs as arguments, and the function can do something to hold the head and evaluate the seq, so yes
17:08puredangerso 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:08puredangerI'm kinda shocked actually
17:08arohnerwooby: but just passing the infinite seq by itself won't blow the heap
17:08arohnerwooby: you have to hold the head & evaluate to do that
17:08DuneManarohner: And "apply" can do it for you and blow your heap in confusing ways :-)
17:09arohnerDuneMan: I don't think so
17:10DuneManarohner: Scroll back over the last couple hours for a bajillion examples.
17:10arohnerapply should only need to eval enough args to get to the & part of the args
17:10DuneManIt shouldn't happen, maybe, but it does.
17:10arohner(defn foo [& args] (println (first args)))
17:10arohner(apply foo (range))
17:10arohnerthat doesn't blow the heap
17:11arohnerDuneMan: yes, there are all kinds of ways to blow the heap by doing bad things with infinite seqs
17:11arohnerbut passing them as arguments and applying by itself won't blow the heap
17:11DuneManThat blows the heap for me
17:11DuneManwith an infinite seq
17:11arohnerare you running 1.1?
17:11DuneManI was. But, like I said, there were just a bajillion examples poste where it does it in 1.2
17:11arohnerthey're holding the head somewhere
17:12DuneManNo the apply is.
17:12DuneMansomehow
17:12arohnermy example works in 1.2
17:12DuneManThere were some examples that worked
17:12DuneMansome that didnt
17:13arohnerand my example shows that it's possible to pass an infinite seq to a function and use it, without blowing the heap
17:13kotarakarohner: sometimes, sometimes not
17:14kotarakarohner: (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:15dakroneIs 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:16kotarakdakrone: you'll have to use mixin maps, I think
17:16dakronekotarak: okay, I'll check it out, thanks
17:16dakronekotarak: speaking of protocols, any word on when vimclojure will support the right highlighting/indention for them?
17:16arohnerkotarak: why does one work and one not?
17:17kotarakdakrone: -.- soon. This weekend is a long one (Thursday public holiday) I plan to work on VC, then.
17:17arohnerkotarak: and replacing my foo example with extra args doesn't blow the heap either
17:17dakronekotarak: cool, been using the pre-release and really liking it so far. Thanks for the awesome tool :)
17:17kotarakarohner: the first form does the right thing, the second blows the heap for me.
17:18kotarakdakrone: watch out for things bypassing *out* and *err*, though.
17:18arohnerkotarak: what version are you running? my snapshot as of last week doesn't blow the heap with my example
17:18arohner(defn foo [a b c d e f g h i j k & args] (println (first args))) works just fine
17:18dakronekotarak: yea, already had some trouble with that, but not too bad to work around
17:18kotarakarohner: 20100507.230258-69
17:19kotarakdakrone: nailgun does some voodoo. I have to check in how far I can extend that.
17:20leif-pAny 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:20kotarakarohner: 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:21DuneManwell that holds the head because of (next more) (print (first more)...
17:21DuneManoh, maybe not
17:21kotarakleif-p: it's possible: a hinted symbol: `(def ~(with-meta var-name {:tag `String}) "Hello")
17:21DuneManthat doesn't seem like it should :-)
17:22kotarakDuneMan: the function itself does not hold the head
17:22arohnerkotarak: (apply print-many 1 2 3 4 5 6 7 8 9 10 (range)) doesn't blow for me
17:22kotarakarohner: maybe you need bigger n (or smaller heap)?
17:23kotarakleif-p: you must put classes in the :tag, you have to a Symbol there
17:23kotarakmust not
17:24arohnerkotarak: ok, you're right. I needed a bigger n to see it run long enough
17:25DuneManright
17:25DuneManlike... an actual infinite sequence.
17:25DuneManThis becomes really obvious is your infinite sequence is gigs of event data :-)
17:25kotarakDuneMan: (iterate inc 1) is infinity enough ;)
17:25DuneManyeah, that's a good one :-)
17:26DuneManbut integers are small :-)
17:26arohnerkotarak: (range) works now too, FYI
17:27kotarakarohner: I know, just haven't switched to 1.2 in general, yet. (Did for this test, though)
17:29leif-pkotarak: Ah, that did it. Thanks!
17:31mmarczykpuredanger: congratulations! the contrast could be interesting (I mean three way, clj / sc / j) :-)
17:32DuneManarohner:, kotarak: I will be very interested if you figure out what's going on there.
17:32mmarczykarohner: I needed to increase the number of iterations of print-many's loop quite significantly to see the problem
17:33arohnermmarczyk: yeah, I added two zeros to the the number
17:33kotarakmmarczyk: I know, I know, I have only 1G Ram...
17:33puredangermmarczyk: the talk is called "Cool Hand Duke" about how to escape from the Java prison ;)
17:33mmarczykpuredanger: cool :-)
17:34mmarczykpuredanger: do you think there might be a video of it online after the conference?
17:34puredangermmarczyk: no clue. they do record many on audio
17:35arohnerkotarak, DuneMan: I think (spread) is the culprit
17:35arohner~source apply
17:35arohnerclojurebot: help
17:35clojurebothttp://www.khanacademy.org/
17:35kotarakarohner: I think local clearing is the culprit
17:38arohnerkotarak: how so? the other arities of apply refer to the locals
17:39kotarakarohner: 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:53ndimidukclojurebot: ,(into-array ['a' 'b'])
17:53clojurebotexcusez-moi
17:53ndimidukerr
17:54kotarak_brian2_: (into-array Character/TYPE ...) or - I think - char-array
17:54_brian2_ok, thnks
17:54ndimiduk(into-array [\a \b])
17:55ndimiduk,(into-array [\a \b])
17:55clojurebot#<Character[] [Ljava.lang.Character;@65f65e>
17:55mmarczykchouser: just read "Roundoff Error and the Patriot Missile."... you guys have an *amazing* bibliography!
17:55_brian2_thanks
17:55kotarakndimiduk: that's not a char array
17:55ndimidukkotarak: you are correct.
17:56ndimiduk,(char-array [\a \b])
17:56clojurebot#<char[] [C@1d14f6a>
17:56kotarak,(seq (into-array Charactoer/Type "Hello"))
17:56clojurebotjava.lang.Exception: No such namespace: Charactoer
17:56ndimidukthat's what's nice about having a repl in irc :)
17:56kotarak,(seq (into-array Character/TYPE "Hello"))
17:56clojurebot(\H \e \l \l \o)
18:55bsteuberI'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:55sexpbot"#280 - def and defstruct should support an optional doc-string (New) | Clojure | Assembla"
18:55bsteuberwould like to hear what you guys think about this
18:55bsteubererm
18:55bsteuberfor def, not docstrings lol
19:02ninjuddis anyone here an expert on writing a custom Java classloader?
19:09woobybsteuber, like in c.c.def?
19:10woobyoh nm, that has its own 'defvar'
19:12bsteuberno, this is a patch for the builtin special operator
19:33bobbytek2yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!
19:33bobbytek2ahem, hello
19:34bobbytek2what is the main difference between clojure and scala?
19:35zakwilsonOne is Clojure and the other is Scala.
19:36zakwilsonIt'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:49bsteuberbobbytek2: I think the main difference is that clojure is better :)
19:53tomojI get the sense that scala is more liberal than clojure with state?
20:04bobbytek2does clojure have classes?
20:04bobbytek2is state really THAT evil?
20:04bobbytek2I mean, humans have state
20:05tomojso hitler had state?
20:05tomojscala is for nazis then?
20:05bobbytek2no, he actually didn't
20:06Hodappwell
20:06Hodappscala might be more liberal with state
20:06Hodappbut scalia is very conservative with it
20:06tomojd'oh
20:06zakwilson__State isn't evil, but in Clojure, it is not conflated with identity or value.
20:06Hodapptomoj: come on, that deserved at least a "heh"
20:07tomojbadly managed state is evil, I think, but that's just begging the question
20:07Hodappthis sounds like #politics, really, but I think we're staying on topic
20:08bobbytek2so let me get this straight, hitler uses scala, but had he not been a statist, he would have used clojure?
20:08bobbytek2makes sense....
20:08Hodapphmmmm
20:11zakwilsonBack 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:12bobbytek2does clojure have monads?
20:12zakwilsonAs a library
20:13bobbytek2so, can I connect to a database with clojure?
20:13bobbytek2or is that against the law?
20:13zakwilsonYes, and there's a library providing a DSL for SQL.
20:14bobbytek2I guess I am a bit confused
20:14bobbytek2is clojure pure functional?
20:14zakwilsonNo.
20:16bobbytek2why not?
20:16Hodapp...
20:17tomojwhat do you mean by "pure functional"?
20:17zakwilsonClojure 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:23maxhodakhow do you alter tha state of a java object?
20:24maxhodakfor example, if you have a class with an public instance variable int i
20:24maxhodak(. foo (.i 3)) says that there's no method 'i'
20:24maxhodakfoo/i doesn't work
20:24Hodappif Clojure is lispy enough, wouldn't it be fairly simple to implement a purely functional subset in clojure itself?
20:24maxhodaketc
20:25technomancyHodapp: you could probably undefine all non-functional parts of Clojure pretty easily
20:25tomojmaxhodak: set!
20:25Hodapptechnomancy: undefine how?
20:25mmarczyktechnomancy: not . :-)
20:26maxhodaktomoj: i don't see set! in http://richhickey.github.com/clojure/clojure.core-api.htm ?
20:26technomancymmarczyk: not until c-in-c anyway
20:26tomojmaxhodak: it's a special form
20:26tomojmaxhodak: http://clojure.org/java_interop
20:27mmarczyktechnomancy: right
20:27maxhodaktomoj: ok thanks
20:39maxhodaki need to build a list of in clojure ([L style), but i can only seem to get ISeqs
20:39maxhodaklike
20:39maxhodaknode[] <-- what i need
20:40maxhodakclojure.lang.LazySeq <-- what i get
20:45mmarczyk,(doto (java.util.ArrayList.) (.add :wibble) (.add :wobble))
20:45clojurebot#<ArrayList [:wibble, :wobble]>
21:06maxhodaki don't want an ArrayList, but a primitive list
21:06maxhodaklike the difference between Integer[] and ArrayList<Integer>
21:08pdmaxhodak: (make-array Integer/TYPE 20)
21:09pdwhere 20 is the length
21:09maxhodakpd: awesome thanks
21:09DuneMan(int-array) if you need in[]
21:09DuneManint[]
21:10maxhodakDuneMan: no it's a user-defined class
21:10DuneManah, okers
21:11maxhodakhmm
21:11maxhodakUnable to find static field: TYPE
21:11maxhodaki'll do some googling
21:11rhudson,(make-array java.net.URL 10)
21:11clojurebot#<URL[] [Ljava.net.URL;@114b607>
21:12maxhodak(removing the /TYPE did it)
21:12rhudsonInteger/TYPE is a Java hack to say int vs Integer
21:14mmarczykmaxhodak: oh, sorry, didn't get the part about [L
21:14mmarczykmaxhodak: though that is not a list, it's an array
21:15maxhodakfor a 2-d array, would you do (make-array node 4 4) ?
21:16maxhodakthere doesn't seem to be a make-array-2d
21:16rhudson,(doc make-array)
21:16clojurebot"([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:17maxhodakrhudson: my reference java code is "new node[i][]"... how would you do the unparameterized second dimension?
21:17maxhodakdim of zero?
21:19rhudsonIt's being initialized though (in Java), right?
21:37mmarczyksomething like (into-array (map into-array (partition i ...))) maybe?
23:23ravagreetings programs
23:40rlmcintyrehey guys --- why doesn't (def (symbol "some_symbol") 5) work?
23:40hiredmandef is not a function
23:41Raynes$(doc def)
23:41sexpbotDENIED!
23:41RaynesOh yeah, that wont work.
23:41Raynes,(doc def)
23:41clojurebotDENIED
23:41rlmcintyreit just says see special forms anyway
23:43Raynesrlmcintyre: Indeed. I was pointing out that it is a special form.
23:46arohner,(doc map)
23:46clojurebot"([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:46arohner,(doc def)
23:46clojurebotDENIED
23:46arohnerhuh
23:47Raynesarohner: def is a no no.
23:47Raynes$(doc map)
23:47sexpbotresult: -------------------------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:47arohnerRaynes: I should be able to call (doc def) though?
23:47RaynesNo.
23:47RaynesBecause def appears in the form.
23:47arohnerthat's broken
23:48ravadef is broken?
23:48RaynesNo, it's expected behavior.
23:48arohnerit's what *you* expect. I can call (doc def) at a normal repl and have it work
23:49RaynesA bot isn't a normal REPL. ;)
23:49RaynesI could make sexpbot allow everything in the context of doc, but I bet you _ato would find a way to break it.
23:49tomoj,'def
23:49clojurebotDENIED
23:50arohner,(doc defn)
23:50clojurebot"([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:50tomojseems pretty strange to me too
23:50hiredmanthe other thing is def is a special form, not a var
23:50hiredmanso it doesn't actually have a doc string
23:50arohnerhiredman: so? (doc def) works in a normal repl
23:51hiredmanarohner: because doc keeps a list of special forms and knows to tell you to go look at the website
23:52arohner,(macroexpand '(defn foo [] (println "a"))
23:52clojurebotEOF while reading
23:52arohner,(macroexpand '(member:defn foo [] (println "a")))
23:52clojurebot(member:defn foo [] (println "a"))
23:52arohner,(macroexpand '(member:defn foo [] (println "a")))
23:52clojurebot(member:defn foo [] (println "a"))
23:52ravaMaybe an odd question, but have any of you run into a problem clojure didn't work well to solve?
23:53arohner,(macroexpand '(defn foo [] (println "a")))
23:53clojurebotDENIED
23:53Raynesrava: Global war... Oh wait.
23:54ravaI'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:56arohnerrava: there are certain things requiring speed that clojure can't do...yet
23:57technomancyrava: it's no secret that clojure is relatively lousy for CLI scripts
23:57technomancyespecially short-running ones
23:58rhudsonrlmcintyre, 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:59ravatechnomancy: 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:59ravaits been fun cleaning up that mess