#clojure logs

2009-03-02

00:32technomancynot sure what it counts for, but Clojure just passed Scala on the Github languages count: http://github.com/languages/Clojure
00:33technomancyGithub is definitely biased towards dynamic languages, but still.
00:36replacaat less the 2%, but still :-)
00:37slashus2I can't believe that Ruby is more popular than python. I wouldn't think that would be the case.
00:37technomancyIt was beating Groovy on Friday, but no longer. They must be neck and neck.
00:38replacaslashus2: well, github was basically created by ruby folk
00:38technomancyslashus2: that's mostly because github is implemented in Ruby and the Python community isn't as excited about git.
00:38slashus2Okay, that makes sense.
00:39technomancywhereas with Clojure I think Clojure itself and contrib are very nearly the only clj projects that aren't hosted on github. =)
00:40greghgithub rocks. Despite my pythonic tendencies and having used mercurial in the past, I still prefer git
00:40technomancyis it accurate to say that metadata can be attached to vars?
00:40durka42yes
00:41technomancybut really it can be attached to any symbol or collection? it's just usually used with vars?
00:42technomancyI'm not sure I'm 100% clear on the relationship between symbols and vars.
00:42technomancya symbol by itself is just a name, but a var is the relationship between that symbol and its value in a namespace?
00:43durka42yeah, but vars also have STM connotations
00:43durka42and don't have to have a root binding
00:43durka42er, not STM, thread local bindings
00:43technomancyright; ok
00:44technomancyit's a little weird how many punctuation marks are needed to extract metadata, but I guess it makes sense when you realize what's going on.
00:44replacait's kind of awesome that you can actually find big hunks of fortran on github
00:45technomancyreplaca: there's even three projects in Self
00:46replacatechnomancy: yeah. I have to say, I love github - it represents something so much cooler than sourceforge
00:46technomancythese are good times to be a hacker. =)
00:46replaca(and sf was pretty cool in it's day)
00:46replacatechnomancy: you got that right
00:47technomancysure it's a braindead dialect, but having a Lisp in the top 10 would make me very happy. =)
00:47replacatechnomancy: I noticed you're helping your cause there :-)
00:47replacaIt is odd that Obj-C is so low, though
00:48cp2obj-c...ew
00:48replacaI would have expected there to be more sharing among the mac crowd
00:48rlbIs there anything like for-each? i.e. traverse a seq calling a function on each element, but don't build anything.
00:48technomancyreplaca: nah, they're all off hoping to make millions in a top-sekrit iphone app =P
00:48cp2,(doseq [x '(1 2 3 4 5)] (prn x))
00:48rlbI saw dorun, but I don't want to build the result seq in the first place.
00:48clojurebot1 2 3 4 5
00:48replacatechnomancy: I think you're right
00:49technomancythe whole culture surrounding the language thrives on secrecy
00:50replacatechnomancy: yeah, that's the fundamental nastiness of the mac world
00:50cp2rlb: is that what you are looking for?
00:50rlbcp2: I think that's exactly it. I misunderstood doseq's documentation. Thanks.
00:50cp2no problem
00:51technomancyspeaking of misunderstanding documentation, does anyone else think reduce's docstring could use some love?
00:51technomancy(doc reduce)
00:51clojurebotf should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of applying f to val
00:51technomancyit makes sense if you already know what reduce is, but otherwise: good luck figuring it out from that description!
00:52replacatechnomancy: It should begin: "in conjunction with map, reduce will lead the way to first order nirvana" :-)
00:52cp2technomancy: *blink*
00:52rlbI'm not sure I have it completely right yet, but it looks like clojure's going to make this easy:
00:52rlb(defn map-files [fn root]
00:52rlb (map fn (tree-seq #(.isDirectory %) #(.listFiles %) root)))
00:53rlbnice.
00:53replacaIt is actually kind of hard to grok reduce unless you're aware of the motivation
00:53technomancyit would probably be helpful to mention the intention, like "reduce accumulates a single value by calling a function on each member of a collection"
00:53durka42rlb: i recommend not naming parameters "fn"
00:53technomancynice; didn't know about tree-seq
00:54rlbdurka42: oh, wait -- I forgot that clojure uses that.
00:54replacatechnomancy: then the noobs might figure out our magic!
00:54rlbcp2: and wrt doseq --
00:54rlb(defn for-each-file [fn root]
00:54rlb (doseq [x (tree-seq #(.isDirectory %) #(.listFiles %) root)]
00:54rlb (fn x)))
00:54rlb
00:54rlbs/fn/something-else/
00:54cp2heh
00:54rlbdurka42: thanks.
00:55rlbSo far I'm consistently impressed by the various facilities clojure provides. Some of them are things I'd been thinking about myself to various degrees for a while.
00:56cp2(doc tree-seq)
00:56clojurebotReturns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree.; arglists ([branch? children root])
00:57cp2cool
00:57replacawow, that's sweet
00:57technomancytype hints provide the greatest speed boost for code that makes heavy use of numerics, correct?
00:57replacaI always feel like I'm seeing only small corners of the language in my coding
00:57brennancnot sure what you are trying to do in the previous code there but you might want to look into file-seq as well
00:57rlbI saw line-seq. Are there other lazy file readers like that (i.e. other than line or regex oriented)?
00:58rlbbrennanc: oh... heh -- obviously missed that.
00:58rlbbrennanc: thanks.
00:58technomancyreplaca: yeah, I get the feeling that just sitting down and reading through src/clj/clojure/core* would be a wise investment.
00:59replacatechnomancy: I've done a little of that, but more is good. I always need the motivation of using stuff to really get it onto my toolbelt.
00:59brennancI've been going through the Programming Clojure book and it's pretty good.
01:00brennancthis is only my second day learning lisp and it's really natural already
01:00replacaI was just thinking of inventing file-seq the other day as a way to get test fata for my pretty-printer
01:00replacanot knowing that it already existed
01:01technomancyreplaca: every time I dive into the implementation I'm surprised at how readable it is. It's a good feeling.
01:01brennancis there some kind of pretty printer?
01:01replacatechnomancy: yes, very rewarding to the fairly casual reader
01:01technomancybrennanc: someone mentioned they were working on one on the mailing list
01:01replacabrennanc: I'm building one in the flavor of common lisps - its almost ready
01:02brennanclooking for something like PHP's print_var. I think ruby has something as well but I forget the name of it.
01:02replaca*it's (I can't deal with apostrophes tonight)
01:02technomancybrennanc: probably Ruby's inspect
01:03replacait's amazing to even consider how many man years have been spent on pretty printers in the history of lisp
01:03replacaalthough clojure differs from lisp in that lists aren't the only first class data structures and that changes your approach a little bit
01:04replaca(although the core algorithms end up being about the same)
01:04technomancybrennanc: print might be good enough for you if you don't care about indentation
01:05hiredmanwell, prn
01:05technomancyright, that
01:07brennancwhen looking at nested sets it's really hard to tell what is where
01:07replacabrennanc: do you use eamcs?
01:08replaca*emacs
01:08brennanchaven
01:08brennanchaven't tried before
01:08brennancjust been using the repl with jline on the console
01:08cp2famous last words
01:09replacabrennanc: ahh, I just copy forms into a buffer and use clojure mode. I would think vim and other environments would have something similar
01:09cmvkkhmm...
01:09replacabut that's not really satisfactory, which is why I'm building a pretty printer :-)
01:09cmvkk,(defmacro get-an-atom [] (atom nil))
01:09clojurebotDENIED
01:09cmvkkheh
01:09cmvkkno defmacro
01:10cmvkkor no atom?
01:10durka42no def
01:10cmvkkwell anyway, if you define that macro and then try to call it, it gives an error.
01:10durka42,(atom nil)
01:10clojurebot#<Atom@7544a6: nil>
01:11cmvkkyou can't return anything from a macro that is unprintable maybe
01:11brennancwhat are the strengths of emacs and what is the best way to learn it?
01:11durka42well calling that macro effectively does:
01:11durka42,((atom nil))
01:11clojurebotjava.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn
01:11brennancI used to use vi all the time when I was on windows but use TextMate mostly on mac
01:11cmvkkno, that's not the error.
01:11durka42wait, no it doesn't
01:11cmvkkit's this "java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.Atom@1c99db7 (NO_SOURCE_FILE:0)"
01:11technomancybrennanc: Emacs is written in Lisp, so it's a lot more extensible than textmate.
01:11durka42yeah i see it
01:12durka42anyway if you want (get-an-atom) to expand to (atom nil) then you should quote it
01:12cmvkki don't; i wanted it to expand to an atom.
01:12technomancybrennanc: basically people have been using Emacs to write Lisp for about as long as I've been alive, so they've had a lot of time to streamline it.
01:12rlbbrennanc: I'm sure you'll hear it again, but fwiw I'd highly recommend you try emacs... esp. if you're going to hack on a lisp like language.
01:13rlb(actually I'd recommend it regardless, but...)
01:13technomancybrennanc: I wrote a screencast introducing emacs that a lot of people seem to find helpful: http://peepcode.com/products/meet-emacs
01:13replacabut I've also heard good things about textmate and I think some people are using it for clojure
01:14technomancyunfortunately textmate is abandonware, and its license prohibits its users from improving it. =\
01:14rlbAlso, emacs runs essentially everywhere.
01:14p_lEven if not in elisp form
01:14replacatechnomancy: wow, I didn't know that
01:14p_ltechnomancy: abandonware?
01:15technomancyp_l: two years ago I was trying to write a cross-editor tool that textmate didn't have the functionality to support, but they said it would be supported in Textmate 2, which was "just around the corner". nothing significant has happened in its development since then.
01:15banisterfiendtechnomancy: why didn't you release your screencast for free? :(
01:16technomancybanisterfiend: because then I wouldn't have been able to afford to spend four weeks writing it.
01:16banisterfiendare you making any money from it?
01:16technomancyI better be if I spent that much time on it. =)
01:17technomancybanisterfiend: a lot of the code that it uses is available in the Emacs Starter Kit: https://github.com/technomancy/emacs-starter-kit/tree ... you can get along decently with that and the built-in documentation if you're really short on cash.
01:19durka42(doc recur)
01:19clojurebotTitim gan �ir� ort.
01:20durka42,(doc recur)
01:20clojurebotjava.lang.Exception: Unable to resolve var: recur in this context
01:20cp2lol
01:20Raynes> Son of a bitch. Just spent 2 hours trying to figure out why (re-split #"=" f) was returning (text.txt). Turned out, I was using the wrong variable name, f was the name of the file given to the function which was slurped into a var called file. :|
01:21RaynesMinus the >
01:21cmvkkthose are the best kind of mistakes
01:21brennancI think we can all relate. :)
01:21cmvkkbecause it means your concept was sound, you just screwed up the implementation slightly
01:22cmvkkand all you have to do to fix it is switch the variable names around.
01:22cp2igh
01:22cmvkkinstead of having to retool the whole program or something.
01:22cp2i cant begin to tell you how many rage fits those have spawned :|
01:22RaynesNight guys. Happy LISPing.
01:41cmvkki wish NullPointerExceptions were worth money.
02:14lethalcodeHrm. Any way to make the clojure compiler independent of what it's compiling?
02:14lethalcodeI'm trying to compile a modified clojure/core.clj, but since it's in the classpath as required, clojure.lang.Compile is barfing.
02:14brennanclethalcode: still on it. :)
02:15brennancany luck?
02:19lethalcodebrennanc: Some. Not enough :D.
02:33brennancwhere is lazy-seq found?
02:33cmvkkyou mean in what file?
02:33brennancyeah, what do I need to include
02:34cmvkkpretty sure that's just core.clj
02:34brennancjava.lang.Exception: Unable to resolve symbol: lazy-seq in this context (NO_SOURCE_FILE:10)
02:34cmvkk,(doc lazy-seq)
02:34clojurebot"([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body."
02:34cmvkkdid you do something weird to the namespace or something?
02:35brennancnot that I'm aware of
02:35brennancuser=> (doc lazy-seq)
02:35brennancjava.lang.Exception: Unable to resolve var: lazy-seq in this context (NO_SOURCE_FILE:11)
02:35brennancjust restarted the repl, same error
02:35cmvkkare you using the old december 18th release?
02:35cmvkkbecause lazy-seq didn't exist back then.
02:36brennancI'm using the codebase that came with the programming clojure book
02:36cmvkktry this: (rest [])
02:36brennancmaybe it's old, I downloaded the new book today, let me try on the other repl environment
02:37brennancit returns nil
02:37cmvkkyeah, you're using an old version.
02:37cmvkk,(rest [])
02:37clojurebot()
02:38brennancgood to know. thanks
02:38brennancI can just replace the clojure.jar?
02:39cmvkkyou have to replace core.clj etc also
02:39cmvkkor wait
02:39cmvkkis that included in clojure.jar? actually it probably is.
02:39brennancthe book has a lot of stuff it needs to run the examples so I don't want to use the pure clojure version
02:40cmvkkright. heh, does the book talk about lazy-seq then come packaged with a version that doesn't have it?
02:41brennancI'm trying on the original version I downloaded a few days ago. same issue
02:41brennancah, must have downloaded it from the google code site
02:42brennancit says 20081217
02:42cmvkkthere aren't 'releases' available that are post lazy.
02:42brennancgonna get the svn
02:42cmvkkyou have to get an SVN release.
02:42cmvkkyeah.
02:43cmvkkhttp://people.ku.edu/~wlipe/ksowen.mp3 <-- check it out, clojure-generated guitar.
02:44cp2nice
02:45brennancwhat do you mean by clojure generated? is it playing wav's or are you outputting the sample values from some kind of synthesizer
02:46cmvkkthe latter. it's totally synthesized with just clojure, not from recording or anything.
02:46cmvkkwell, the original wav file was, anyway.
02:47brennancyou seen that book "the physics of musical instruments"?
02:47cmvkki don't think so... is it about doing this sort of thing?
02:47brennancit has mathematical models for synthesizing a bunch of instruments
02:47cmvkki'll have to look at that.
02:47brennanca bit over my head with my limited math background
02:48cmvkki'm building a clojure framework for implementing that kind of thing, but i don't know much about it myself.
02:49brennancwould be nice to have something like reason functionality but with an API
02:49cmvkkwhat's that?
02:51brennanchttp://www.youtube.com/watch?v=yl1nHaRbDiE
02:52brennanchttp://www.youtube.com/watch?v=sWi-07Ov-IE&amp;feature=related
02:52brennancit's insane the things you can do with it
02:53cmvkkwow that looks like a pretty complicated system.
02:53cmvkkcan you build songs with it?
02:53cmvkki guess you must be able to.
02:54brennancyeah, you hit tab and it flips to the back where you connect things with virtual wires like an old-school switchboard
02:54cmvkkso it's mostly about simulating a physical synthesizer i guess.
02:54brennancthat's like 5% of it
02:56brennancI have my midi keyboard hooked up to this: http://www.youtube.com/watch?v=DrgJkY9E11s
02:56brennancit's insanely realistic sounding
02:57cmvkkit's amazing what you can do digitally these days.
02:58brennancit's around 2 GB of sample data just for the pianos
02:58cmvkkthe file i linked above is about the naivest of naive implementations of that guitar algorithm, and it doesn't sound TOO terrible
02:59cmvkkso professionals can make really good sounding synth stuff
02:59cmvkkhttp://people.ku.edu/~wlipe/ksowen.txt <-- you can see it's just a low pass filter and a delay.
03:01brennancthat's pretty cool, is that using a library of some kind?
03:01cmvkkjust what i've written... plus java's Math and FileOutputStream or whatever
03:02brennancthat's pretty cool
03:03cmvkkit's slow as hell, though, and i don't know how to fix that.
03:03cmvkkthat 8 second track takes like 35 seconds to render...really slow.
03:03cmvkkclojure isn't the best for lots of quick math i guess
03:04cp2type hinting might help
03:04cp2but idunno
03:04cp2depends on your implementation
03:04cmvkki suppose so. there's a lot of (int ...) and so forth, but the way it's implemented makes it hard to infer anything.
03:04brennancare you using type hints?
03:05cmvkkit's all closures calling closures calling closures, very dynamic, which makes it hard to do that.
03:05hiredmancmvkk: are you using unchecked math?
03:05cmvkkhow do i do that?
03:05cmvkkoh, and a lot of it is floating point math, which maybe makes it slower.
03:06hiredman(find-doc "unchecked")
03:06cmvkkwow, how did I not know that existed?
03:07cmvkkthe other thing i have to do is make it concurrent, but that's going to require a major overhaul of some things
03:07brennanc(let [n (int n)])
03:07brennancforces n to be an int primitive
03:07cmvkkyeah, well, i do a lot of that
03:17zakwilsoncmvkk: coercing to int is much more useful if you're using unchecked math.
03:18cmvkkit seems so. unfortunately the large majority of the math involved is floating-point math.
03:18cmvkkthe 'waveforms' are designed to return amplitudes between 1 and -1.
03:19zakwilsonUnchecked doesn't work for floats, but you can get a speed boost with coercions and type hints.
03:20zakwilsonAre you using a profiler?
03:20cmvkkno; i should try that.
03:20cmvkki don't know much about profiling for java, but i wonder if the fact that most of the performance-intensive functions are anonymous closures would be a problem?
03:20zakwilsonI bet you'll find a lot of reflection going on somewhere.
03:21zakwilsonNo, not really. They'll have funny names, but you should be able to get some idea of what's going on.
03:21cmvkkwell i've run the thing with *warn-on-reflection* on before and i don't remember there being anything particularly alarming...but it's been a while.
03:22zakwilsonI bet the profiler turns up an obvious hot spot of some sort.
03:23cmvkkis there a program you can reccomend that works well with clojure?
03:42zakwilsoncmvkk: I had good luck with Yourkit. It's heavy and slow though.
03:43cmvkkhmm, i'll look into that. thanks.
03:51stuhoodcmvkk: jrat has worked reasonably well for me (but i haven't tried any others): http://jrat.sourceforge.net/
04:57lisppaste8djpowell pasted "type hinting" at http://paste.lisp.org/display/76352
04:58djpowellI get reflection warnings here. Is it something to do with the char array?
04:59jdzdjpowell: what's with the dangling parens?
04:59djpoweller, dunno - is that a lisp faux pas?
05:00leafwdjpowell: don't use parens like you would use { } in java/c++
05:01lisppaste8jdz annotated #76352 "proper formatting" at http://paste.lisp.org/display/76352#1
05:01lisppaste8leafw annotated #76352 "untitled" at http://paste.lisp.org/display/76352#2
05:03djpowellyou don't need #^StringBuffer - constructor calls infer the result type
05:04djpowellit seems that make-array should do the same
05:04leafwdjpowell: interesting, didn't know that one. Is it new, or was it always there?
05:04djpowell(btw - I never knew about chars)
05:04djpowellno always there
05:04leafwok
05:04djpowelllots of things do inference, eg catch infers the exception type
05:04leafwI think they are all supported (after I "complained"): ints, doubles, chars, ...
05:05djpowell(def x cs (make-array Character/TYPE 100))
05:06djpowelloops wrong windows :)
05:10djpowell'(source make-array)
05:10djpowell,(source make-array)
05:10clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
05:11djpowellthe code for make-array looks suspiciously int-y
05:11leafwdjpowell: about array types, see Compiler.java:816 http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=clojure/.git;a=blob;f=src/jvm/clojure/lang/Compiler.java;h=846b9d2f0811abe0f5e6fe34007aa812180750dc;hb=12a79925ad0b92240870a8efc4363129dd0eaf52#l816
05:13djpowellhmm, could make-array do that for you though... I'll fire up the debugger and try to find out what's going on
05:14leafwmake-array does that: no warning on reflection with make-array.
05:14leafwby the way, can one specify the type of a returned object, in the function declaration?
05:14djpowellit doesn't work in my example though - I get a reflection warning if I don't type hint the returned make-array
05:15leafware you up to date?
05:15leafwhum true!
05:15leafwI wasn't looking at stdout
05:15leafwsorry
05:16leafwactually it's the (StringBuffer.) which doesn't do it. make-array does.
05:16leafwwrong again
05:16leafwit's the fact that the .append call can't be mapped ... so indeed, make-array is not tagging.
05:17AWizzArdclojurebot: max people
05:17clojurebotmax people is 149
05:33djpowellah, I suppose the compiler can't necessarily know the type of your array at compile-time, whereas it can with the constructor form, so if you make arrays of a fixed type you need to hint them
05:58lisppaste8djpowell annotated #76352 "untitled" at http://paste.lisp.org/display/76352#3
05:58djpowellHmm, the #^chars notation works on local declarations, but doesn't work at the function level for some reason
06:08banisterfiendclojurebot: !ban AWizzArd
06:08clojurebotExcuse me?
06:08banisterfiendclojurebot: !kick-ban AWizzArd
06:08clojurebotGabh mo leithsc�al?
06:12lisppaste8djpowell annotated #76352 "untitled" at http://paste.lisp.org/display/76352#4
06:14leafwdjpowell: so you've found a missing feature--chars support was added recently, relative to doubles, ints.
07:04djpowellI'd never realised that #^"[C" was valid syntax, till I saw it in core.clj
07:19Holcxjodjpowell: Well, it's not exactly pretty nor clear, is it? Is there some function that translates some more verbose but more readable description into this internal Java format?
07:20djpowellNoo, I agree, i think #^chars should work on functions
07:21djpowellHolcxjo: ints, doubles, etc work for other types, but chars only works in a let, not on a defn
07:24HolcxjoWell, I was thinking more generally -- what if you want to declare some non-standard type? I was thinking something like #^[Array com.some.package.SomeClass]
07:25Holcxjorather than #^"[jcom.some.package.SomeClass" -- or whatever the Java mangling of that type is
07:26djpowellYeah, that would be useful
07:27Chouserarray-of: http://groups.google.com/group/clojure/msg/0e3438dfd241d8ef
07:28ChouserBut I'm only mentioning that, not recommending it.
07:36HolcxjoChouser: Indeed. Something a bit more general would be nice... :-)
07:36HolcxjoBTW: Why is #= not mentioned on http://clojure.org/reader#toc2 ?
07:36HolcxjoDeliberate or oversight?
07:37rhickeyHolcxjo: Deliberate
07:38AWizzArdbtw, what is #= good for?
07:39HolcxjoRead-time evaluation AFAIK
07:59ChouserI think the most stable description is that #= is a mechanism used by 'print-dup' to otherwise unprinted details to 'read'.
08:04cemerickdjpowell: on what line is #^"[C"?
08:08Holcxjo,(doc print-dup)
08:08clojurebot"; "
08:08HolcxjoVery verbose that doc string. :-)
08:08cemerickI'd like to see #= grow into a generalized serialization mechanism. You can already get there if you stub out fns to handle construction edge cases, but that feels very much like a temporary hack.
08:09djpowellcemerick: it is used in make-array in core.clj
08:10djpowellcemerick: you can put it after a defn to declare the return type of the function to be an array, but it seems a bit hacky
08:11cemerickhuh, it must be in a different rev then what I have locally. I've got a #^"[I" there.
08:12leafwthe y combinator in arc and in java: http://arcfn.com/2009/03/y-combinator-in-arc-and-java.html
08:13leafwhaven't seen a clojure version yet -- can't be so hard, can it.
08:13cemerickInteresting, though. I'm hoping for ways to define signatures in gen-class that include array and parameterized types. Maybe a String found in a gen-class could be interpreted as necessary; e.g. "[I", "List<String>", etc
08:13djpowellcemerick: sorry, yeah it is [I, i got the idea of using [C after seeing [I
08:14djpowellcemerick: (that part of make-array seems a bit quirky)
09:31lenst(defn Y [r] (#(% %) #(r (fn [x] ((% %) x)))))
09:35clojurebotsvn rev 1318; fixed header comment
10:00hiredman~max people?
10:00clojurebotmax people is 149
10:02leafwhiredman and AWizzArd keep asking ~max people ... I wonder why
10:08jdzto annoy people?
10:09kotarakto check the conjecture, that (max people) * 10 = members of the google group
10:10jdzwell, anybody can talk privately to bots if they want
10:37gnuvinceAnybody read "Head First Java"?
10:38ChouserI now believe that the similarities between doseq and for are not caused by an underlying similarity in implementation.
10:38Chouserthey code that could have in common is so small compared to the code that must differ.
10:41rhickeyChouser: interesting, but makes sense
10:42gnuvinceChouser: hmmmr?
10:50ChouserThe parsing of the binding vector could be the same, and the code produced by :let is the same.
10:51Chouserboth have a similar loop-seq-recur form for each nested level
10:52Chouserbut that's it. 'for' has other extra stuff per nested level. the code produces for :when and :while are different
10:52Chousereven more damaging to any attempt to factor out commonality is that each need different kinds of information about sub-nested levels
10:53Chouserdoseq needs to understand where the tail positions are, such that it can inser 'recur', while 'for' doesn't care at all.
10:53Chouserbut 'for' needs to have access to the sub-seq (if any) for each level, while 'doseq' does not.
10:55Chouserand finally, 'doseq' is required sooner in core.clj, and so can't use destrucutring, while 'for' is sufficiently more complex that destructuring helps reduce clutter quite a bit.
10:57Chouserbut that means it's a significant feature that 'for' and 'doseq' have such a similar interface. They provide an useful abstraction between lazy and imerative iteration.
10:57Chouserimperative
10:57Chousergnuvince: you asked. :-)
10:59Lau_of_DKHey guys - Any Java wiz's around?
10:59gnuvinceChouser: I still don't understand your point. What, different functions do different things?
11:02Chouserdifferent macros with nearly identical (relatively complex) interfaces that do conceptually very similar things require almost completely different implementations.
11:06brianhLau: wouldn't
11:08brianhsry bout that... let me try again. wouldn't say i'm a wiz, but you might get lucky. shoot!
11:14Lau_of_DKbrianh: http://www.jmonkeyengine.com/jmeforum/index.php?topic=6870.0 The second linke jME2.zip can you get those to compile ?
11:15brianhLau: i can try. give me a few... ;)
11:16Lau_of_DKTake all the fews you want :)
11:24brianhLua: k just got the svn. interesting side note. The guy who started jMonkey (Mark Powwell) used to work on the project I'm on now.
11:25Lau_of_DKCool - Which project is that?
11:25brianhLua: this gives me an excuse to see where he's taken it :)
11:26Lau_of_DKhttp://gpwiki.org/forums/viewtopic.php?t=3351
11:26Lau_of_DKHe's come quite far
11:26brianhLua: we do some simulation stuff. nothing too fancy
11:27Lau_of_DKk - btw, its Lau, not Lua - thats a scripting language
11:29brianhLau: sorry (it's Monday AM for me)
11:30zakwilsonI like Lua! Oh, and Lau seems like an OK guy too.
11:30Lau_of_DKno probs :) Did you catch the link with the pics ?
11:30Lau_of_DK:)
11:31brianhLau: yes. pretty nice.
11:33Lau_of_DKbrianh: Im not too hot with Java, but is it possible to compile those files into a little .jar that I can just import?
11:35brianhLau: don't see why you couldn't.
11:36Lau_of_DKoh - I cant because I dont know how, but I was hoping you could :)
11:40brianhLau: i don't do to much jarring by hand anymore (Eclipse has made me terribly lazy). just google jarring for cmd line instructions
11:40brianhLau: here's one: http://www3.ntu.edu.sg/home/ehchua/programming/java/J9d_Jar.html
11:41Lau_of_DKok, so thats packaging, did you work out how to compile?
11:42brianhLau: not yet. trying to get all the dependencies resolved in the main jmonkey project (swt & gl)
11:44Lau_of_DKk, cool
12:05brianhLau: sorry bout the delay. had an interruption. anyway, looks like that zip file is missing the com.gibbon.jme package to me
12:06Lau_of_DKbrianh: no probs - thats sounds possible, is it available somewhere?
12:07brianhLau: maybe try looking in the first zip in case he did a delta only between jME1 & jME2 (or just google 4 it)
12:08Lau_of_DKTheres nothing in the first, google will take some time
12:09Lau_of_DKTypical - Its written by some 19 year old kid who was in such a hurry that the project is now useless... :)
12:11brianhLau: probably. I'm sure I've never done that myself! ;)
12:12zakwilsonCode done in a hurry that's now useless? Like this? http://paste.lisp.org/display/76132
12:12zakwilson(yes, that's real code from something I'm being paid to fix)
12:13brianhzak: be careful please. you almost sent me into an epileptic seizure!
12:14zakwilsonI actually *have* sent someone in to an epileptic seizure.
12:14zakwilsonThough I did it with a strobing LED panel, not a printf call.
12:17zakwilsonBut something makes me think they get submissions like that several times a day.
12:24djpowellThe epl says that I can redistribute the clojure object code as part of a product under a commercial license. Presumably the object code is just the .jar file? So I don't need to redistribute clojure's readme.txt, but I do need to add an EPL compatible license, and I'd have to state that clojure.jar was copyright Rich Hickey somewhere?
12:27zakwilsondjpowell: Yes, that's my reading of the EPL, but IANAL. There's a FAQ page for the EPL that might answer your question.
12:31djpowellzakwilson: yeah I read the FAQ. It is quite a complicated license. I'd expected the FAQ to include some boiler-plate text illustrating what a compatable license would look like, but I can't find anything anywhere.
12:32djpowellIt isn't clear who 'The Contributors' would be defined as in a compatable license in the case where you weren't distributing any patches to clojure.
12:35djpowellI guess if it is straight from rich, then 'the contributors', would just be rich.
13:12Chousercgrand: are you around? would you have any objection to merging javadoc and repl-utils into the same namespace?
13:24__marius__in java/clojure, is there any way to have a "wildcard" classpath, eg. point it to a directory so that any jar i have in there gets added?
13:25__marius__i see you can add /*, but that seems to do the expansion invocation time
13:26ChouserI have -Djava.ext.dirs=/usr/share/java:$HOME/.clojure/classpaths on my java command line
13:26Chouserthat finds all the .jar's that Ubuntu installs in /usr/share/java
13:26hiredmanI have added some stuff to my .zshrc to try and manage my classpath
13:27Chouserand I put symlinks in ./clojure/classpaths to other .jar places that ubuntu doesn't know about, like clojure-contrib/src
13:27__marius__Chouser: cool, that's exactly what i'm looking for, thanks!
13:28hiredman http://gist.github.com/72895
13:30danlarkinI modified stephen's clj bash script to search for .jars and .clj source trees in ~/clojure/src
13:30danlarkinmy CLASSPATH ends up being huge but I don't have to mess with anything to install a new library, just drop it in the directory
13:33ChouserI had been using stephen's script, but upon further reading of the java docs, I don't see any reason to avoid java.ext.dirs instead.
13:53Lau_of_D`Good evening gents
13:55durka42good afternoon Lau
13:56danlarkinhiya lau
13:57Lau_of_D`danlarkin: Madison on Github yet?
13:57Lau_of_D`durka42: durka durka :)
13:58durka42:)
13:58danlarkinLau_of_D`: I thought I should write some basic tests before I put it up
14:08Lau_of_DKWonder who that guy was
14:09Lau_of_DKoh.. the blessing of multiple desktops
14:09ayrnieu--! SOME JERK IS STEALING MY NAME
14:10ayrnieu/msg #nickserv ghost ayrnieu
14:10Lau_of_DKhuh.. Someone would actually steal 'ayrnieu' ? :)
14:11ayrnieuI'll have you know that millions of gaelic afficionados would love to have my name.
14:11Lau_of_DKdoes that mean millions of 'garlic addicts' ?
14:11ayrnieu... I'm not addicted to garlic anymore.
14:11Lau_of_DKoh ok
14:12WizardofWestmarcwhy would you ever want to become NOT addicted to garlic?
14:14ayrnieuWizard - it's delicious, and good for you, and you taste its goodness for hours after each session, but spiteful, hateful people will complain.
14:14Lau_of_DKI say let them
14:24danlarkinLau will you write my tests for me please?
14:28Lau_of_DKNo!
14:28Lau_of_DKAre you seriously asking for help, or are you just complaining?
14:28Lau_of_DKBarkin' larkin' ?
14:31danlarkinhaha little bit of both
14:32Lau_of_DKTo be honest, I think you'd want someone who has a little more experience with Django than me (I have nil) ?
14:32danlarkinbut what better way to learn than writing tests
14:32danlarkin:-D
14:35Lau_of_DKThats true - If you can wait until I get a little more functionality into this game of mine (ie. 10 - 12 effects, music, fixed huge terrains, texture splatting and music), then I'd actually be happy to help
14:38cmvkkare you writing a specific game Lau, or just a physics simulator/renderer?
14:40Lau_of_DKcmvkk: I writing a game for small kids, who just appreciate slamming the keyboard, jerking the mouse, and watch the computer do stuff in response. (this is for my own 2 year old) - So Im going to have a 3d landscape which you'll be flown around in :)
14:40RaynesDoes Clojure have a logical negation operator like ! in Java?
14:40Lau_of_DK(doc not)
14:40clojurebotReturns true if x is logical false, false otherwise.; arglists ([x])
14:40RaynesAwesome.
14:41RaynesThanks.
14:41Lau_of_DKGnarly
14:41Lau_of_DKnp
14:41durka42(doc not=)
14:41clojurebotSame as (not (= obj1 obj2)); arglists ([x] [x y] [x y & more])
14:42RaynesThat's neat.
14:42RaynesHandy.
14:55danlarkinLau_of_DK: sure I'd appreciate your help of course
14:57Lau_of_DKAlright, I'll let you know once its done
14:57Lau_of_DKI like the name "Madison Square Clabango"
15:01danlarkinclabango sounds like an STD
15:48yonatan__hello
15:48yonatan__did anything happen to lazy-cons?
15:48kotarakyonatan__: yes. it's gone. lazy-cons is dead, long live lazy-seq.
15:48yonatan__which does the same thing?
15:48kotarakhttp://clojure.org/lazy
15:49Lau_of_DKyonatan__: cons does what lazy-cons did
15:49yonatan__caches results?
15:50kotarak(lazy-cons foo bar) is now basically (lazy-seq (cons foo bar))
15:50kotarakBut more details are at the above link.
15:50yonatan__ok, thanks.
16:19Lau_of_DKIn Java, when you declare a public abstract someClass somename() - What are you doing?
16:19cmvkkis it...declaring an abstract method that returns someClass?
16:20cmvkki think that's what it is.
16:21Lau_of_DKIs this just to avoid "someClass someInstance = new someClass();" ? So you can instead type somename() ?
16:22cmvkkunless i'm not understanding the context, somename() would be a method name, not a class name.
16:23cmvkksomeClass would be the return value of the method.
16:23cmvkkthe class of the return value, i mean.
16:23cmvkkthere's no definition, right? it's a method without a definition.
16:23Lau_of_DKExactly
16:23Lau_of_DK public abstract TerraView getView();
16:23cmvkkit's an abstract method, those are used in abstract classes.
16:24Lau_of_DK TerraView tv;
16:24Lau_of_DK tv = getView();
16:24cmvkkabstract classes are classes that you can't instantiate (because some of their methods have no definition)
16:24cmvkkwhat you're supposed to do is extend them, and then define those methods in the subclass.
16:24cmvkkso you need to be looking into the subclasses of that class to find a definition for that method.
16:26Lau_of_DKIs this a way of avoiding statics?
16:27cmvkki don't know; i think it's just a way of providing a general superclass for some stuff when there's no general method to do some things
16:27cmvkkbut why it's used instead of an interface (which does the same sort of thing?) i'm not sure.
16:27Lau_of_DKI wonder if this will be tricky to reach from Clojure
16:32BrackiYou use that to implement the Strategy Pattern e.g.
16:32Lau_of_DKhuh?
16:33BrackiHave an abstract class that implements some method. The method will call the abstract method which you must provide.
16:36Lau_of_DKBut getView is not defined anyway
16:36Lau_of_DKanywhere
16:37hiredmanit must be defined somewhere
16:37hiredmanor else it is uncallable
16:37Lau_of_DKThen its defined in the superclass
16:54Chouserif a method is abstract, there must be a subclass provdied by the library or by yourself that extends the class and provides a definition for that method.
16:55Lau_of_DKSo its likely its tucked away in the super somewhere?
16:55Chouserno, you probably are expected to privide it in your own subclass.
16:56Lau_of_DKBut Im looking through a test which supposedly demos this class, which is being extended
16:56Chouserhow does it instantiate the class?
16:58nullman`i'm looking for a recomended way to remove duplicate integers from an ordered vector (e.g. [1 2 2 3 3 3 4] => [1 2 3 4])
16:59durka42,(distinct [1 2 2 3 3 3 4])
16:59clojurebot(1 2 3 4)
16:59nullman`hehe, i didn't find that one in the api docs! thanks
16:59cmvkkdoes distinct run faster on ordered input?
16:59durka42although, that doesn't return vector and there might be a faster way if you know it's sorted...
17:01nullman`speed is not an issue, it happens once at the end of a function (and the list size is always small)
17:01durka42cmvkk: i don't think so, i checks every element against all the ones it's seen before
17:02durka42~source distinct
17:03hiredmanhuh
17:03hiredmanthat is not correct
17:03hiredmandamn
17:04cmvkkheh
17:04Chousukeclose enough :P
17:04cmvkkactually yeah. it puts the def nicely in the middle of the page.
17:04durka42,^#'distinct
17:04clojurebot{:ns #<Namespace clojure.core>, :name distinct, :file "core.clj", :line 2983, :arglists ([coll]), :doc "Returns a lazy sequence of the elements of coll with duplicates removed"}
17:05durka42clojurebot's build is a tiny bit out of date
17:06hiredmanwell, the revision clojurebot thinks it is running, is not what it is infact running
17:07cmvkkit left out of shame.
17:10hiredman~def distinct
17:14Raynesnot= should be /= :(
17:15Lau_of_DKeww
17:15cmvkki thought it was !=
17:15RaynesIt should be /anything/ but not=
17:15Chouserwhy?
17:15RaynesBecause not= is ugly.
17:16cmvkkit's probably the most intuitive to people who aren't used to something else.
17:16cmvkksince it's actually (not (= ...))
17:16RaynesWell, too late for a name change anyways.
17:16RaynesBut, ick.
17:17Lau_of_DKRaynes: Youre not a true Lisper, I BANISH THEE!
17:18cmvkk...wait, is it not= in other lisps too?
17:18RaynesLau_of_DK: CL defines /=. That's why I said it should be /=.
17:18RaynesI just don't like the not= look of it.
17:18Lau_of_DKyea CL is really hot these days, lets implement everything from it into Clojure
17:18RaynesBut, if I'm the only one ^_^.
17:18Lau_of_DK(oops, I was sarcastic again)
17:18ayrnieunot= is pretty startling. Maybe it tests the equality of different kinds of knots.
17:19ChousukeI think /= would be problematic. / is not allowed in unqualifiedsymbols (except /)
17:19Chousukewith a space.
17:19Chousuke:P
17:19cmvkkthat's true too.
17:19ayrnieuLau - I especially enjoy childish CL bashing when it's in the context of something CL gets right.
17:19Chousukebut if you ask me, not= is better than /=
17:20Lau_of_DKChousuke: Do you think /= is better than not= ?
17:20ayrnieu<> also a decent name.
17:20RaynesLau_of_DK: I just said I don't like the name, and was saying it should have probably been /= since that's what it is in CL. I didn't say we should implement everything from CL.
17:20ChousukeLau_of_DK: I just said the opposite.
17:20Lau_of_DKNo Chousuke, you said "if you ask me", so I did
17:20RaynesAnything but not= would be good.
17:20ChousukeLau_of_DK: :P
17:20Lau_of_DKI think not= is great
17:20RaynesOf course you do.
17:20cmvkkwhat was wrong with != ? didn't it used to be !=
17:21ChousukeI don't see the problem with not= :/
17:21RaynesIt doesn't matter, it's too late for a name change anyways.
17:21Chousukeit's easy to read
17:21cmvkkI like not= too.
17:21Chousukeas opposed to /= that doesn't really say anything
17:21Chousukeit's just slash-equal,
17:21Raynesnot= is ugly, just my opinion. If one person thinks it's ugly then it doesn't matter. -_-
17:21ayrnieuthis is also the problem with + - * /
17:21RaynesI don't even care.
17:21cmvkkyeah i totally wouldn't understand /=. i would think it was the same as C /=
17:22ChouserI very rarely use not=
17:22ChouserI prefer if-not and when-not
17:23cmvkkoh i didn't know those existed. actually what's the point of any of this?
17:23ayrnieuunless is a good name for whe-not
17:23cmvkkhow hard is it to add (not ...) when needed?
17:23ayrnieucmvkk - the grander point is that it isn't enough to throw the old ways to the wind when you have people in your community for whom any part of the status quo is an old way worth defending.
17:24cmvkkwell yeah, sure
17:24Chousukeayrnieu: I think when-not is clearer than unless though
17:24cmvkkoh man, coming from perl, i miss 'unless'...
17:24Chousukeayrnieu: unless is more elegant but when-not is just impossible to misunderstand.
17:25ayrnieuChousuke - this is why I never write functions. I'm just adding to the conceptual burden of any reader.
17:25Chousukehm?
17:25cmvkkahaha
17:25ayrnieucmvkk - so write it. Clojure has defmacro
17:26cmvkkno no, i don't actually care enough about any of this. not= and when-not are fine.
17:26ayrnieu(you can even write a do-like that notices infix if/unless , although that woud be horrid.)
17:26Chousuke(defmacro unless [& body] `(when-not ~@body)); :P
17:26cmvkksaying things like "i miss unless" is mostly idle chatting without any purpose...
17:26ayrnieucmvkk... you don't care about how you write your own program?
17:27cmvkknot enough to use nonstandard functions for things for which there are standard functions.
17:28RaynesChouser: Those ideas for wall papers are nice, make one in 1440x900 :>
17:28ChouserRaynes: which?
17:28RaynesThe lambda one.
17:29RaynesI got Cajun Train Mix :D
17:33Chouserhttp://groups.google.com/group/clojure/web/clojure-wallpaper-03-1440x900.png
17:33durka42dead link
17:33Chouserhttp://clojure.googlegroups.com/web/clojure-wallpaper-03-1440x900.png
17:34durka42sorry, i wasn't logged in
17:34durka42why does google do the "found - click link to continue" thing
17:34Chousermy guess is to prevent general image hosting
17:35cmvkkthey don't want you to embed it in your webpage somewhere else.
17:35durka42ah, that makes sense
17:36durka42but a meta refresh tag can't be that much trouble
17:37duncanmhow do i load a jar file into the repl?
17:38durka42you can use import as long as it's on the classpath
17:38durka42(doc import)
17:38clojurebotimport-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly.; arglists ([& import-symbols-or-lists])
17:38durka42that's not a very helpful doc at all
17:39durka42(import '[java.io File FileInputStream])
17:39Chouserif it's on the classpath, you don't need to import
17:39Chouseractually, you never have to import.
17:39duncanmChouser: how do i add something to the classpath?
17:39duncanmadd-classpath
17:40Chouserduncanm: on the java command line, with -cp
17:40Chouseryou can try add-classpath, but it's not well supported.
17:41duncanmChouser: i'm using a bash script for running clojure
17:41duncanmChouser: is it a bad idea to add pwd to the classpath?
17:41Chouserit's probably ok.
17:42hiredmanduncanm: adding pwd to the classpath will not let you use the jars in the pwd
17:42Chouserhiredman: good point
17:42hiredman(incase you were going to do that)
17:42duncanmhmm
17:43hiredmanjars have to be in the classpath
17:46cmvkkwait, why doesn't that work? if the jar is in pwd and pwd is in the class path, then...?
17:47hiredmana jar is like a sub-directory
17:48hiredmanif foo/ is in your PATH, foo/bar/ is not
17:48hiredmanif foo/ is in your CLASSPATH, foo/bar.jar is not
17:48cmvkkso: just having a jar in a directory that's in the classpath doesn't add the jar to your classpath.
17:48cmvkkyou have to add the jar itself to the classpath.
17:49hiredmancorrect
17:49cmvkkhmmmm
17:49hiredmanunless you use stull like ext.dirs or whatever
17:50hiredmanstuff
18:13WizardofWestmarcahhh, netsplits
18:13bitbcktnoising ones, even
18:14ayrnieu(people don't die, they've just connected to a schismatic server)
18:14cmvkki always imagine people talking in a big room, then suddenly the room cracks in half and the other side floats away across a giant chasm.
18:14clojurebotsvn rev 1319; use openConnection().getLastModified() only for non-jars
18:24duncanmwhat does it mean when i see this error (java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:4)) ?
18:25hiredman~jdoc ExceptionInInitializerError
18:27duncanmhiredman: does that usually mean i'm not loading a class file somewhere?
18:28hiredmanduncanm: dunno
18:28mbanathis might seem stupid, i apologise if it is; but is it possible to somehow run emacs on the jvm
18:28hiredmanyou would have to port it
18:28duncanmmbana: there was a project called jemacs a few years ago
18:29hiredmanor use a jvm x86 emulator
18:29mbanahow different is clojure from, say, emacs lisp?
18:29hiredmanit would be easier to just start from scratch
18:29hiredmanmbana: very
18:29hiredmanand emacs is not all elisp
18:30cmvkki like the idea of a java x86 emulator. you could run arbitrary layers of it and java alternating.
18:30hiredman:(
18:31hiredmantaking a performance hit every time
18:31mbanai'd fed up of applications shipping with lame editors, especially academics ones, e.g., alloy from MIT
18:33hiredmanmbana: there are at least two editors written in clojure, but they are both still in the early stages
18:39rhickeyThanks to Chouser, (for [x (range 10) :let [x2 (* x x)] y (range 100) :when (< y x2)] [y x2]) now works!
18:39clojurebotsvn rev 1320; added :let option to for and doseq, order-sensitivity for options, [issue 88], patch from Chouser
18:41RaynesI need a new firefox theme.
19:30duncanmis there a clojure-helpers library where people are gathering convenience functions to be used with Clojure?
19:30ayrnieuclojure.contrib._
19:36RaynesSomeone should totally fix issue 82.
19:48keithbHow can I find out which version of Clojure I'm running?
19:48ayrnieuyou can't.
19:49keithbIs there any reason why I should consider *not* upgrading to the most recent version?
19:49ayrnieucd ~/clojure/src/dir; svn up # oh, I was on that version.
19:49ayrnieukeithb - not at present.
19:49duncanmin C#, there's a nice syntax @"C:\temp" which is very handy for writing pathnames in Windows
19:49duncanmit'd be nice in clojure's reader can do something similar
19:50duncanms/in/if/
19:50ayrnieuduncanm - clojure doesn't have read macros, but you only need a (w32 "c:/temp") that translates the /
19:50duncanmwhat's w32?
19:51ayrnieuduncanm - clojure doesn't have read macros, but you only need a (pick-some-name "c:/temp") that translates the /
19:51keithbduncanm, what are you trying to do? You can specify a path with forward slashes in Clojure (Java), and the runtime will convert them as necessary.
19:51duncanmoh
20:03keithbayrnieu, thanks.
20:08slashus2Raynes: Is this correct? http://pastebin.com/d38671ee1
20:09ayrnieu(.readLine *in*) ; please consider http://paste.lisp.org/new/clojure
20:10Raynespaste.pocoo.org > both of those.
20:10ayrnieu,(sort (map #(.getName %) (.getMethods (class *in*))))
20:10clojurebot("atLineStart" "close" "equals" "getClass" "getLineNumber" "hashCode" "mark" "markSupported" "notify" "notifyAll" "read" "read" "read" "read" "readLine" "ready" "reset" "skip" "toString" "unread" "unread" "unread" "wait" "wait" "wait")
20:11RaynesAnd what ayrnieu said. There might be a reason Rich has it as BufferedReader. I personally used an if statement in my version.
20:11lisppaste8slashus2 pasted "read-line" at http://paste.lisp.org/display/76392
20:12slashus2My version is a little faster than (.readLine *in*)
20:13lisppaste8slashus2 annotated #76392 "difference" at http://paste.lisp.org/display/76392#1
20:14lisppaste8Rayne@acidrayne.net pasted "read-line" at http://paste.lisp.org/display/76393
20:15slashus2That is much more flexible, and has good performance.
20:15RaynesI believe it's the same thing a guy proposed on the group.
20:16slashus2Someone make a patch?
20:17RaynesNo one has done anything to fix it.
20:17Raynes"read-line" at http://paste.lisp.org/display/76393 <- is what I was referring to.
20:18slashus2Chouser: What do you think?
20:19Chouserslashus2: my opinion doesn't matter :-)
20:19RaynesThe reason I made mine the way I did is I figure there might have been a reason that Rich used BufferedReader.
20:19Chouserone of the benefits of not being rhickey.
20:20ayrnieuclojure seems amenable to some static dispatch. It already has type annotations, it already has compiler support for these; it could have functions that say to the compiler "if it's asserted that my arguments have these types, use this code" -- with even "if my arguments don't have any of these types, complain right away."
20:20slashus2rhickey: Is there a reason that BufferedReader was used in read-line?
20:20ChouserI believe the Repl used to set up *in* as a BufferedReader
20:21ChouserIt may have changed to what it is now when the Repl was re-written in Clojure instead of Java.
20:22RaynesThen it was most likely a mistake on rhickey's part and slashus2's version is better than mine :(.
21:09Chouserread-line stopped working at svn rev 1229
21:10ChouserJan 24 removes many reflection warnings from clojure.core files
21:11scgilardireflection was being used to good effect in read-line: both LineNumberingPushbackReader (the default for *in*) and BufferedReader support readLine. With reflection, either works. With a type hint in favor of BufferedReader, LNPBR is not an acceptable argument.
21:17scgilardiChouser: nice job on the "for" and "doseq" additions. I saw an article from the Haskell guys on supporting "order by" "group by" and "limit" in comprehensions based on those operations in SQL. It sounded useful. The papers on some of this often move quickly into some heavy theory quickly.
21:17Chouserhm.. interesting.
21:18scgilardi"comprehensive comprehensions" (for your googling pleasure)
21:20Chouserdoseq and for are now arranged such that extra keyword features should be easier to add.
21:21scgilardicool. I'll go take a look
21:21ChouserI don't know about 'order by' though. ;-)
21:23scgilardiI would think "group by" would be the scarier
21:30lisppaste8Rayne@acidrayne.net pasted ":|" at http://paste.lisp.org/display/76397
21:32hiredmanre-find doesn't always return a seq
21:32hiredmansometimes it returns a string
21:32hiredmanwhich means your destructuring sometimes converts a string into a seq of characters
21:32durka42wouldn't :order-by and :group-by just be calls to sort and group-by?
21:33hiredman,(re-find #"foo" "foo")
21:33hiredmanpp
21:33clojurebot"foo"
21:33hiredmaner
21:33hiredmanor maybe not
21:33hiredmanthat is re-split not re-find
21:34hiredmanwhat is the advantage of re-split over String's .split?
21:35Chouserit takes a Pattern instead of a String.
21:35hiredman,(.toString #"foo")
21:35clojurebot"foo"
21:36Rayneshiredman: Thanks.
21:39Drakesonhow can I create a stand-alone swank instance in clojure so that I can later connect to it?
21:40Drakesonactually, can I just use the normal M-x slime, and then do something to detach from the running clojure instance, and then later reconnect to it?
21:48scgilardiDrakeson: in googling, I seem some folks using "screen" for that. Leaving the emacs running and then detaching and re-attaching from the whole terminal session. (I don't know whether or not there's a more slime-specific way.)
22:00Drakesonscgilardi: I know all that. what I want is the clojure equivalent of (asdf:oos 'asdf:load-op :swank)(setf swank:*use-dedicated-output-stream* nil)(swank:create-server)
22:08scgilardidurka42: it seems likely that something like group-by and sort-by would be called. in the paper there is also the option to further process the groups that would be produced by group-by via something like reduce: the sum of individual salaries, grouped by department which produces one sum per department.
22:09durka42seems like at this point we start in on the CL loop macro debate
22:10scgilardijust pointing it out as interesting
22:11durka42it does sound interesting and powerful
22:11durka42but also cryptic
22:12scgilardithe corresponding concepts in SQL are very commonly used and would read similarly.
22:12durka42you can do that reduce thing in sql?
22:13scgilardiyes. there's an example here: http://www.w3schools.com/sql/sql_groupby.asp
22:15durka42ah, i sort of remember doing that
22:17RaynesIf anyone has any clue how to fix the function I posted, let me know :|.
22:18scgilardihave you looked at what re-split is returning?
22:18RaynesYes.
22:18durka42Raynes: want to paste example input?
22:18RaynesOne moment.
22:19scgilardiI tried (re-split #" = " "a = b c = d") -> ("a" "b c" "d") which doesn't look like what you want (even if there's a newline between b and c)
22:19Rayneshttp://paste.lisp.org/display/76398
22:20Raynesthat returns ("foo" "bar" "bar" "foo")
22:21hiredman,(doc re-replit)
22:21clojurebotjava.lang.Exception: Unable to resolve var: re-replit in this context
22:21hiredman,(doc re-resplit)
22:21clojurebotjava.lang.Exception: Unable to resolve var: re-resplit in this context
22:21RaynesIt's in contrib.
22:21hiredmanah
22:21RaynesI'm using (.split ..) now.
22:21RaynesDoes the same thing anyways.
22:21RaynesWas just messing with re-split.
22:22hiredmanhmmm
22:22hiredman[a b] is not going to do what you think it does there
22:22RaynesI can't figure out any way to do it differently :|
22:23hiredman,(doseq [[a b] '("foo" "bar")] (println a b))
22:23clojurebotf o b a
22:23durka42you need to operate on separate lines
22:23hiredman(apply hash-map '("foo" "bar" "bar "foo"))
22:24hiredman,(apply hash-map '("foo" "bar" "bar "foo"))
22:24clojurebotEOF while reading string
22:24hiredman,(apply hash-map '("foo" "bar" "bar" "foo"))
22:24clojurebot{"foo" "bar", "bar" "foo"}
22:24hiredmanbah
22:24durka42(doc line-seq)
22:24clojurebotReturns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.; arglists ([rdr])
22:24RaynesI do believe you just fixed mah problem.
22:24scgilardialso when you conj into keyvm, you probably want [a b] rather than a b. a b would be appropriate for assoc, not conj
22:24RaynesI forgot about hash-map.
22:24hiredman,(conj {} :a :b)
22:25clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword
22:25Raynesx_x
22:25hiredman,(conj {} [:a :b])
22:25clojurebot{:a :b}
22:25hiredmanah ha
22:25RaynesI wish NullPointerExceptions were worth money.
22:26cmvkki know!
22:29DrakesonI have clojure-contrib. Is there a nice recipe to make a repl more endurable? (a plain "java clojure.main.Repl" kinda sucks)
22:29hiredmanrlwrap
22:29twism,(re-split #" = " "a = b c = d")
22:29clojurebotjava.lang.Exception: Unable to resolve symbol: re-split in this context
22:29Drakesonhiredman: does it give you completion?
22:29hiredmanwhere in contrib is re-split?
22:29hiredmanDrakeson: I think it can
22:30Chouserclojure.contrib.str-utils
22:30hiredmanbut I've never done it
22:30hiredman,(require '[clojure.contrib.str-utils :as s])
22:30clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
22:31hiredman,(s/re-split #" = " "a = b c = d")
22:31clojurebot("a" "b c" "d")
22:37lisppaste8Chouser annotated #76397 "re-seq and reduce" at http://paste.lisp.org/display/76397#1
22:38ChouserRaynes ^^^
22:38hiredmanI am sure you meant to use ^ and $ in that regex
22:39hiredmanwell, I am
22:39RaynesWas my function really /that/ bad?
22:39Chouserdo you have an example where mine fails but ^ and $ fixes it?
22:40RaynesMan, I should just give up. Everytime I show someone a function I write in Clojure they end up rewriting it completely. :|
22:40Chouser:-( don't give up!
22:41RaynesWell shit. I can't write a single function that isn't hideous. @_@.
22:41cmvkkalso that doesn't mean yours is wrong, there's often a lot of ways to do something.
22:41hiredmanI would find one, but I am rebuilding all of freebsd on my wind atm so doing anything that involves starting the jvm is not going to happen
22:41RaynesBut his is so pretty.
22:41Drakesonwhate is clojure.contrib.repl_utils for? can I get a usable readline out of it?
22:41RaynesChouser: Thanks ^_^. I can just use hash-map anyways though.
22:42hiredmanDrakeson: if you want a java readline, there is jline, but rlwrap is better
22:42hiredmanjline does some unicode mangling
22:56DrakesonI run: "rlwrap java clojure.lang.Repl", but "(de<TAB><TAB><TAB>" only gives me frustration :p
22:56Drakesondoes jline provide any symbol completion?
22:56hiredmanyou have to set up completion
22:56hiredmanfor rlwrap
22:56hiredmanI have never done it, but others here have
22:57hiredmanI suggest taking a look at the manpage
22:58durka42there's a clj.sh script somewhere
23:00opeckojoDrakeson: i got rlwrap working by following the instructions here, http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_rlwrap
23:04te_Just got back from Daniel Dennett lecture -- some incredible insights into computer science
23:04te_believe it or not
23:05durka42what was he lecturing on?
23:06tehmm well, he explained how creationists have a top-down approach, whereas evolution is the bubble up
23:07tebut then he proceeded to give the means of combination for the bubble up
23:07tethe way things bubble up
23:08tehe described us as a combination of trillions of tiny robots, robots that interact in ways that they are not conscious of
23:08Drakesonopeckojo: cool, thanks
23:08tebut i began thinking about clojure/lisp/etc. in that framework
23:09teand i began thinking about metadata as ways of expressing the reason why a block of code might be executed
23:10tethe "design space" is increased in utility when blocks of code interact in a way that is fit
23:10teim probably rambling by now, but i think he really gave a sort of roadmap for AI programming
23:11tedurka42: does that answer your question? ;)
23:11durka42i think so
23:12durka42cognitive science is fasinating
23:12tedurka42: could i run something by you?
23:13durka42code or philosophy? ;)
23:13tea bit of both tbh
23:13tethis is a bit of pseudocode that i dreamed up:
23:14durka42~paste
23:14clojurebotlisppaste8, url
23:14lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
23:14te[(+ (a 1)) {meta: greater, add, 1}]
23:14te[(+ (a 2)) {meta: greater, add, 2}]
23:15teThe user asks: "How can I add 2 to 1?"
23:15teI know there are a lot of little what-ifs and what-have-yous in this example, but some combination of the above two functions produces 3.
23:16tebrute forcing their combination is just mutating and generating both sequences based on their metadata
23:16durka42so we need an AI that can write/understand comments :)
23:16teexactly
23:16te:)
23:17tebut i mean, if you define the initial set of designs possible in a way that is accurate enough to promote desired states
23:17tethen you should be able to set it down and let it go wild, no?
23:17tefor instance, one of those functions might pass on metadata that proved to be fit to provide the correct answer
23:17durka42isn't this sort of the idea behind prolog
23:18tein this case, '1', 'and', '2' would have been instrumental in providing the correct answer
23:18durka42right
23:18teso that would be fit data
23:18tethe return value might be valid metadata,
23:19tedurka42: i dont know anything about prolog
23:19teim just fascinated by the idea of combination of code based on "fit" metadata
23:21durka42it's a cool concept
23:21durka42then again do we want our machines knowing how to write clojure?
23:21durka42that might be too much power
23:21durka42;)
23:22tehaha, touche
23:22tedurka42: did you have a lot of epiphanies when you first learned a lisp-ish language?
23:23tei truly feel like my brain has bent into a different shape just by meditating on what lisp lets you do
23:23durka42i don't really know if there were epiphany points
23:23durka42i remember when lambda and map and especially reduce just made my brain hurt
23:23durka42but now they make so much sense
23:23durka42...usually
23:23teim still trying to get map and lambda
23:24durka42i don't understand monads
23:24tei guess im just fascinated by what is possible when you consider code as data
23:24tethe parentheses also provide this clarity that ive never really seen in other languages
23:25teMyThing.do.this.other.thing.now.please?.please
23:25Drakesondoes swank in clojure has something equivalent to (setf swank:*use-dedicated-output-stream* nil) ?
23:27tedurka42: I'm just thinking that the parens do an excellent job of compartmentalizing code blocks
23:27durka42it's true
23:28teit also is in the same vein of something that humans who have a 5th grade math education have been brought up to understand, even if the effects of these parentheses are not equivalent
23:28tethere is something "right" about using parentheses, trying to put my finger on it
23:29tethere's something ambiguous about doing it to every "part" that seems natural, like the way we put spaces in sentences
23:30tethose spaces exist to improve readability, give a context for other symbols to express meaning, etc.
23:37durka42i have to go
23:37durka42but i think te needs a blog
23:37durka42(is that the web 2.0 equivalent of "i would like to subscribe to your newsletter"?)
23:42RaynesIs there a Clojure function that takes a string and returns the string with x removed?
23:51slashus2Raynes: Just use replace? (.replace "hello" "h" "")
23:51RaynesWorks for me.
23:52RaynesThanks.
23:55durka42,(.replace "hello" "l" "")
23:55clojurebot"heo"
23:55durka42~jdoc String