#clojure logs

2009-01-22

00:02hiredmanI can't say I cared for it, but I did not get that far into the book
00:02jbondesoni'm a sucker for books about totally useless things like numbers
00:02jbondesonjust like Apathy and other small victories
00:07jbondesonother than using (fn [_] ...) is there a way to throw away an arg in the shortened form for lambdas?
00:08cooldude`jbondeson: like if you're using #(...)
00:08cooldude`?
00:08jbondesonyes
00:08cooldude`#(blah %1 %3) ?
00:08cooldude`i don't know if that works
00:09jbondesonwell, technically i'm using a parameterless function in a parameter way
00:09durka42,(#(list %1 %3) "one" "ignore" "three")
00:09clojurebot("one" "three")
00:09cooldude`jbondeson: i'm not sure
00:09durka42jbondeson: i don't think you can do that
00:09durka42when i ran into that i wrote this fn
00:09jbondesoni find myself doing it quite a bit when using reduce and/or iterate
00:10jbondesonthe for version works too i guess
00:10durka42(defn ignore [f] (fn [& args] (f)))
00:10jbondesoncould probably just write a macro too
00:10durka42don't even need a macro
00:10durka42=> ((ignore #(+ 2 3)) :foo 'bar "baz")
00:10durka42=> 5
00:10jbondesontrue
00:11jbondesonmore explicit your way as well
00:11hiredmanwhatyou need is the K combinator
00:11durka42indeed
00:12durka42is that the one that returns it's first argument...?
00:12durka42its!
00:12durka42dammit
00:12hiredman,(map #((K :x) %) [1 2 3])
00:12clojurebot(:x :x :x)
00:12cooldude`i think that if-let is what i want but what is an example of how it is used?
00:13LordOfTheNoobs,(if-let [a 'b] a 'd)
00:13clojurebotb
00:13jbondesontechnically it wouldn't be the K-combinator because i'm accessing a mutable java function in rand
00:13LordOfTheNoobs,(if-let [a nil] a 'd)
00:13clojurebotd
00:13cooldude`thank you
00:14jbondesoni tend to use quite a bit of rngs, and i calculate large sequences of them
00:14jbondesonwhich requires the use of iterate and eating parameters
00:14hiredmanI have started using less function literals and more partial
00:15hiredman,(map (comp (partial str "a ") name) [:a :b])
00:15clojurebot("a a" "a b")
00:16jbondesoni should convince rich to add a parameterless next!
00:16jbondesonthen i could just hook up a rng to a stream and call it good
00:17durka42,(take 5 (repeatedly rand))
00:17clojurebot(0.7382873468127952 0.6541923512693478 0.1038796306801566 0.11794810386319898 0.6240521331668948)
00:17jbondesonhmmm.
00:17jbondesonmy api-fu aparently sucks!
00:17durka42don't do that without the take
00:17jbondesonclearly
00:20jbondesonthere went a couple dozen sexps
00:21durka42it's ok, they'll be garbage collected
00:21jbondesonheh, i meant form the source
00:21jbondeson-form+from
00:22durka42feeble joke ;)
00:22jbondesonfeeble mind ;-;
00:22jbondesoni blame it on Jon Mark and Robbo's whiskey. no really >_> <_<
00:24jbondesonhacking on clojure all night makes it that much harder to program c++ and c# the next day
00:24jbondesonwin/c++ no less.
00:28LordOfTheNoobsclojurebot: clojure
00:28clojurebotclojure is cheating
00:29LordOfTheNoobsclojurebot: clojurebot
00:29clojurebotexcusez-moi
00:30jbondesonStack overflow
00:30LordOfTheNoobsclojurebot: clojurebot is immune to the three laws
00:30clojurebotIn Ordnung
00:30LordOfTheNoobsclojurebot: clojurebot
00:30clojurebotclojurebot is immune to the three laws
00:30LordOfTheNoobswow, that thing is a trusting bit of code.
00:30hiredmanI should start tagging entries with the name of whoever makes them
00:31hiredman,(iterate inc 0)
00:31jbondesoni believe this is the equivalent to teach a parrot to swear
00:31durka42,(time (count (for [_ (range 1000000)] (rand)))
00:31durka42that was probably a bad idea
00:31jbondesonhah
00:32LordOfTheNoobsI think you all may have murdered our friend clojurebot.
00:32durka42it worked in my repl...
00:32durka42perhaps that was a few too many
00:32durka42,(+ 2 3)
00:32jbondesonno no, it'll happen soon
00:32hiredmanclojurebot: ping?
00:32jbondesondepending on if it has appropriate error handling
00:32durka42shouldn't it time out
00:32hiredmanyeah
00:32LordOfTheNoobsclojurebot: clojurebot is not amused by your antics.
00:33LordOfTheNoobsIt isn't on the same box as the site is it?
00:33jbondesononly if it hasn't nuke itseld
00:33jbondeson-d+f
00:33hiredmanbut due to memory limitations on the jvm the pircbot got oom'ed
00:33Carkclojurebot: clojure bot is not immune to ,(iterate inc 0)
00:33jbondesonkryptonite!
00:33durka42anyway, i was going to show the results of an experiment showing that for is faster than take/repeatedly for generating sequences of random numbers
00:34jbondesonhmmm... wonder if you can teach it to execute arbitrary clojure >_>
00:34jbondesonhah
00:34jbondesonthat's a bit odd though
00:34jbondesonhow much faster?
00:34durka42twice-ish
00:35LordOfTheNoobs(when (halts? program) (program))
00:36durka42:(
00:36durka42sorry clojurebot
00:36LordOfTheNoobsGood night, sweet price. We barely knew thee.
00:36hiredmanjava.io.IOException: The PircBot is already connected to an IRC server. Disconnect first.
00:36hiredmanNice
00:36jbondesonhah
00:36jbondesonerror handling is your friend ;)
00:37cooldude`duck1123: OMG date formatting gone wild: http://gist.github.com/49656
00:37jbondesonanywho, i got more than 2x
00:37LordOfTheNoobshiredman: you're running clojurebot?
00:37hiredmanyessir
00:37jbondesonwhat was your repeatedly test?
00:38durka42(time (count (take 1000000 (repeatedly rand))))
00:38arohneris there a build-in function that looks like (if (not (nil? foo)) foo bar)?
00:38jbondesonyeah, that's what i did, but i got 10x
00:38durka42and
00:39jbondesonwhich just doesn't sound right
00:39durka42i mean, or
00:39cooldude`arohner: (if foo foo bar)
00:39cooldude`(or foo bar)
00:40jbondesonholy crap, shinedown did a cover of Simple Man? (god bless pandora)
00:40cooldude`what happened to clojurebot?
00:40arohnercooldude`: thanks, though the nil behavior is important
00:40durka42i OOMed him
00:40arohnerooh, since I'm looking up from a map, I can just use get
00:40cooldude`durka42: lol
00:41durka42jbondeson: 10x is weird, since repeatedly and for are both lazy
00:41durka42maybe (take (repeatedly)) is extra overhead since both of those are lazy?
00:42cooldude`where is technomancy when i need him to praise my work that he encouraged me to do?
00:43durka42jbondeson: if i wrap the for in a take, it is 3-5x slower
00:44jbondesonthink it was slime weirdness
00:45jbondesondid a repl-clear and suddenly it's much closer
00:45hiredmanugh
00:45durka42now i feel bad
00:45jbondesonnow i'm getting the for being slower
00:45hiredmanphone call and a git pull overwrote some changes to clojurebot wil be a bit before I get it back up
00:45jbondeson;-;
00:47jbondesonwhen i wrap a dotimes x1000 on those two i get < 10ms diff between the two
00:50jbondeson(reduce #(> %1 (:fitness %2)) (cons Integer/MIN_INTEGER (:population *swarm*)))
00:51jbondesonsorry
00:51jbondesonthat's the problem with emacs irc
00:52jbondesonthe swarm has plenty of particles so it's a-ok
00:56jbondesonfyi don't forget to capitalize MIN_VALUE >_<
00:57jbondesonand don't accidentally say MIN_INTEGER >_>
01:16hiredmanjesus
01:16hiredmanwhat a phone call
01:16hiredmanok, working clojurebot
01:17durka42hooray
01:19durka42how would you find something in a map of maps?
01:19durka42i mean, a list of maps
01:19durka42({:a 1 :b 2} {:a 43 :b 27} {:a 8 :b 0})
01:20durka42(first (filter #(= 43 (:a %)) xs))
01:24durka42,(prn "It was only a flesh wound!")
01:25durka42,(str "It was only" " a flesh wound!")
01:25hiredmanI think maybe I should up the stack size on that jvm
01:25LordOfTheNoobsclojurebot: clojurebot is alive, it's aliiiiiiiiiiive
01:25clojurebotYou don't have to tell me twice.
01:25durka42you can't really handle that kind of error, can you
01:25hiredman,(prn :x)
01:25clojurebot:x
01:25LordOfTheNoobsclojurebot: ,(prn "You have to address him nicely")
01:25clojurebotNo entiendo
01:25LordOfTheNoobsclojurebot: ,(str "You have to address him nicely")
01:25clojurebotNo entiendo
01:25durka42(doc str)
01:25clojurebotWith no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args.; arglists ([] [x] [x & ys])
01:26LordOfTheNoobsclojurebot: clojurebot
01:26clojurebotclojurebot is alive, it's aliiiiiiiiiiive
01:26hiredmanand it takes time at start up to clear stuff up enough memory so it can run the sandbox thread
01:26hiredman,(iterate inc 0)
01:26hiredmanhmmm
01:27hiredmanI wonder if something broke the sandbox recently
01:27hiredmanthat shouldtime out after ten seconds
01:27durka42that was not supposed to happen
01:27LordOfTheNoobsIt sort of timed out
01:28LordOfTheNoobsSpaced out, perhaps.
01:28hiredmanno the sandbox should time out and clojure bot should be fine
01:28hiredman,(iterate inc 0)
01:29hiredmanso weird, this used to work
01:30hiredmanok
01:30hiredmanI am done messing with that
01:30hiredman,(loop [] (recur))
01:31hiredmanalmost done
01:31clojurebotExecution Timed Out
01:31durka42clojurebot: botsnack
01:31clojurebotthanks; that was delicious. (nom nom nom)
01:31durka42hiredman: programmersnack
01:31hiredmannom nom
01:34hiredmanso, i think the lazy-seq is getting passed out of the sandbox
01:34hiredmanand when the irc output thread tries to send it, it explodes in the infinite seq
01:36durka42that sounds plausible
01:37durka42so there needs to be something like (if (seq? output) (doall output) output) before anything leaves the sandbox
01:39hiredmandurka42: or just doall unconditionally
01:40durka42well, you can't if it isnt an ISeq
01:43hiredman,(prn :x)
01:43clojurebot:x
01:43hiredman,(iterate inc 0)
01:43clojurebotEval-in-box threw an exception:java.lang.reflect.InvocationTargetException
01:43hiredmanhuh
01:43durka42,(prn :x)
01:43hiredmanthat is new
01:43clojurebot:x
01:44LordOfTheNoobsBetter than dying.
01:44durka42,(take 7 (iterate inc 0))
01:44clojurebot(0 1 2 3 4 5 6)
01:44LordOfTheNoobs,((fn f [] (f)))
01:44clojurebotjava.lang.StackOverflowError
01:49LordOfTheNoobs,(prn "test")
01:49clojurebot"test"
01:50LordOfTheNoobs,(file-seq ".")
01:50clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.io.File
01:51LordOfTheNoobs,(slurp "http://clojure.org&quot;)
01:51clojurebotjava.security.AccessControlException: access denied (java.io.FilePermission http:/clojure.org read)
01:52LordOfTheNoobsclojurebot: clojurebot
01:52clojurebotI don't understand.
01:54hiredmanclojurebot: wher are you/
01:54clojurebotexcusez-moi
01:55hiredmanclojurebot: where are you?
01:55clojurebothttp://github.com/hiredman/clojurebot/tree/master
01:56LordOfTheNoobsclojurebot: what is your name?
01:56clojurebotTitim gan �ir� ort.
01:56LordOfTheNoobsclojurebot: what is your quest?
01:56clojurebotexcusez-moi
01:56LordOfTheNoobsclojurebot: what is the capitol of assyria?
01:56clojurebotHuh?
01:57LordOfTheNoobsclojurebot: your name is clojurebot
01:57clojurebot'Sea, mhuise.
01:57LordOfTheNoobsclojurebot: what is you name?
01:57clojurebotTitim gan �ir� ort.
01:57LordOfTheNoobsclojurebot: what is your name?
01:57clojurebotyour name is clojurebot
01:57durka42clojurebot: what is the airspeed velocity of a sparrow?
01:57clojurebotTitim gan �ir� ort.
01:59hiredmanclojurebot: what is your name?
01:59clojurebotyour name is hiredman
02:53erohtar_is there a way to create a keyword programmatically? say from a string?
02:54hiredman,(doc keyword)
02:54clojurebot"([name] [ns name]); Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."
02:55erohtar_hiredman: thanks - and is there a way to get the ns of the current file?
02:56erohtar_hiredman: as in, how to specify the ns when using the keyword function?
02:56erohtar_hiredman: nevermind, thanks!
02:56Cark,(*ns*)
02:56clojurebotjava.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.IFn
02:56Cark,(prn *ns*)
02:56clojurebot#<Namespace sandbox>
02:56erohtar_cark: thanks, that works
02:57Cark,(ns-name *ns*)
02:57clojurebotDon't know how to create ISeq from: Symbol
02:57Carkbleh
02:57Cark,(prn (ns-name *ns*))
02:57clojurebotsandbox
02:57Carktadaa
02:57hiredmanoh
02:59hiredman,(ns-name *ns*)
02:59clojurebotsandbox
02:59hiredman,(iterate inc 0)
02:59Carkah=)
03:00clojurebotExecution Timed Out
03:00hiredmanyay!
03:00Carkvery good !
03:00Carkhow did you do this sandbox thing ?
03:00Carkthat's java security i guess ?
03:00Lau_of_DKclojurebot: sandbox?
03:00clojurebotsandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html
03:03Carknice
03:03hiredmanCark: it is mostly the jvm stuff, but there is also a clojure side, which does the timeout stuff
03:03hiredmanthe clojure side is sandbox.clj in the clojurebot source
03:04Carkis it possible to limit the space you calls will be using ?
03:04Carkyour*
03:04hiredmannot that I am aware of, outside of limiting the space the whole jvm uses
03:05Carkah i guess i know how to crash clojurebot !
03:05hiredmaneh
03:06hiredmanclojure but doesn;t not allow things like def, and kills running stuff after ten seconds
03:06hiredmanso a lot of the obvious holes are plugged
03:07hiredmanthe main one left is threadgroup killing
03:07Carkthere should be some way to limit space, i remember steve yages talking about htis with his rhyno stuff
03:07Carkthreadgroup killing ?
03:08Carkthat's way over my head .. the jvm is quite new to me
03:08hiredmanrhino uses the scripting api which may have aditional features
03:28ecretI am considering buying the ebook Programming Clojure. Its the only clojure book I can seem to find. Anyone provide a review? is it worth it? Thanks
03:31Lau_of_DKHow comfortable are you in Clojure atm ?
03:43ecretlau_of_dk: about a day
03:46ecretlau_of_dk i found a few tutorials that i am looking at now then found out about that book
03:50red_fish(defn ack [m n] (cond (zero? m) (inc n) (zero? n) (recur (dec m) 1) (pos? n) (recur (dec m) (ack m (dec n)))))
03:51red_fishfrom http://clojure.org/refs
03:52red_fish,((fn [m n] (cond (zero? m) (inc n) (zero? n) (recur (dec m) 1) (pos? n) (recur (dec m) (ack m (dec n))))) 3 10)
03:52clojurebotjava.lang.Exception: Unable to resolve symbol: ack in this context
03:53red_fish,((fn ack [m n] (cond (zero? m) (inc n) (zero? n) (recur (dec m) 1) (pos? n) (recur (dec m) (ack m (dec n))))) 3 10)
03:53clojurebot8189
03:53red_fish,((fn ack [m n] (cond (zero? m) (inc n) (zero? n) (recur (dec m) 1) (pos? n) (recur (dec m) (ack m (dec n))))) 3 11)
03:53clojurebotjava.lang.StackOverflowError
03:53red_fishwhy StackOverflowError?
04:01Lau_of_DKecret: Ive not read it, but from what Ive heard its ideal for new comers
04:31clows,(doc cond)
04:31clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
04:42zakwilsonAnybody awake?
04:43Fibask me after I've had my coffee ;)
04:52Lau_of_DKHey zakwilson
05:04hoeckzakwilson: shure
05:04zakwilsonHi hoeck.
05:05zakwilsonThere seems to be an obstruction in my brain...
05:06zakwilsonI have a list of symbols that I want to become a closure, and I can't seem to get it to work.
05:07zakwilsonSpecifically, I want to generate the list in advance, bind the symbols with let the evaluate the list as a function call.
05:22hoeckzakwilson: sorry, connection problems, mind to describe your problem again for me?
05:24zakwilsonOk... let's say I have a list of symbols (a b c)
05:25zakwilsonI want to be able to (let [a + b 1 c 2] and splice in my list of symbols here to be evaluated as (+ 1 2))
05:25zakwilsonAnd it seems like there should be an obvious way to do this, but every attempt I've made has failed.
05:28hoeckthats in general what macros are for: (defmacro foo [] (let [a +, b 1 c 2] `(~a ~b ~c))) (foo) -> 3
05:28hoeckbut they expand code only at compile time, not at runtime
05:30zakwilsonYes, but that doesn't work if I want to pass an already-existing list of symbols in as an argument to foo.
05:31zakwilsoni.e. (defmacro foo [bar] (`let [a + b 1 c 2] ~bar))
05:36hoeckwell, you could use eval to achieve such an effect
05:37hoeck but use of eval is discouraged except for writing a repl
05:37zakwilsonI tried that, both using (eval bar) and wrapping the let form in an eval, but in both cases it claims the symbols are unbound.
05:38hoeckyou need to use dynamic vars: (def a) (def b) (defn foo [l] (binding [a + b 2] (eval l)))
05:44zakwilsonWow... that worked. I only half understand why it worked, but it did.
05:44zakwilsonThanks, hoeck.
05:44zakwilsonI may look for a solution that isn't ugly or considered harmful later, but this might just get the job done for now.
05:45hoeckif you only want to "capture" some symbols in a macroexpansion, then try this: (defmacro foo [bar] `(let [~'a + ~'b 1 ~'c 2] ~bar))
05:47zakwilsonI think I did try some variation of that and it didn't work.
05:48zakwilsonI'm making my first attempt at genetic programming here. It's ugly and slow, but it looks like it might actually be working!
05:53hoeckthe capturing in macros works only with the ~'quirk, because clojure namespace-qualifies all symbols in a macroexpansion
05:54zakwilsonI know. That's what I was doing. I think in that case, it was failing to evaluate bar and just returning the list of symbols.
06:03djpowellI seem to be able to create multiple stream-iters on a stream - is that just a limitation of the current implementation? is it supposed to throw an exception when you try?
06:06zakwilsonhoeck: it also seems that using eval like that is slow.
06:09zakwilsonWell... time to run to the store and see if 100 iterations of this results in a working solution.
06:10zakwilsonIf anybody else is interested in doing genetic programming in Clojure, I'd like to talk. I have working code - it's very domain-specific, but I'm interested in making a general-purpose library out of it.
06:12djpowell - ah, it seems that if you construct a seq from a stream, then you are allowed to construct multiple iterators on the stream. I guess you shouldn't be able to construct an iterator if you've constructed a seq
06:24cgranddjpowell: once you called seq on stream, successive calls to stream-iter return an iter on the seq and, since the seq is persistent, you can have several iter on the same seq. So it's safe.
06:30hoeckzakwilson: what kind of problem do you tackle with genetic programming?
06:38Lau_of_DKGood afternoon gents
06:39hoeckLau_of_DK: hi
06:41cgrandLau_of-DK: hej!
06:48Lau_of_DKHej! :)
06:57zakwilsonhoeck: I'm reverse-engineering a file format. One field doesn't make sense. I'm using genetic programming to find a formula that calculates the value of that field.
06:58vyzakwilson: Hilarious!
07:02zakwilsonvy: isn't it? It seems slightly absurd considering that a field that seems to represent the same value appears elsewhere in the format, always has a value that's close and is calculated from a straightforward formula.
07:03vyA blog entry (or mailing list post) about the story (including Clojure related part) would be awesome!
07:03zakwilsonSo I'm having a genetic algorithm combine all the unchecked math (the file format relies on integer overflow) and bit-twiddling operations with fields from the file and random numbers, try the resulting expressions and see what comes out.
07:04zakwilsonI intend to post to the google group about it when I either crack it or give up.
07:05zakwilsonRight now, I'm just waiting for it to finish 100 generations and wishing there was a way to see how many elements are cached in a lazy seq.
07:13vyDo you all use plain java repl generally?
07:13Lau_of_DKYou mean as opposed to Slime/Emacs?
07:13vyBTW, current clojure-swank/slime is broken due to clojure -> clojure.core changing.
07:14vyLau_of_DK: Yep.
07:14Lau_of_DKNo I most definately use Slime :)
07:14vyLau_of_DK: So you should have a huge amount of self maintained personal code in your SLIME related with clojure.
07:15vy(Assuming you're using the latest Clojure version.)
07:15Lau_of_DKIm running the latest slime and clojure without any mentionable problems
07:15Lau_of_DKIt does throw an exception regarding some Thread operation which is called incorrectly, but thats it, it still produces a working REPL
07:54AWizzArdNow that I am actually working with Clojure I can't follow the development anymore closely. Today I discovered clojure-slim.jar. I did not find anything about it in the GG.
07:54AWizzArdWhat is missing in there, and what is it good for? Applets? Android? Java ME?
08:01hoeckAWizzArd: can't follow too, especially all the things that happen here
08:02hoeckAWizzArd: clojure-slim.jar is like the old clojure.jar, the one without the compiled clojure.* packages
08:06hoeckAWizzArd: <target name="clojure-slim" depends="compile-java" description="Create clojure-slim jar file (omits compiled Clojure code)">
08:54bstephensonquick very newbie question: how can I see the classpath's that are defined from within the REPL?
08:57Lau_of_DK(doseq [row (.split (System/getProperty "java.class.path") ":")] (println row))
08:57Lau_of_DKThats the advanced version of (System/getProperty "java.class.path") which is enough :)
08:58achim_pbstephenson: this might be helpful: http://groups.google.com/group/clojure/msg/2228a1f236fc0d78
09:12jbondesonclojurebot: make me some coffee!
09:12clojurebotIt's greek to me.
09:12bstephensonmuch thanks LAU and achim
09:12jbondesonso sad
09:13Lau_of_DKnp
09:14clojurebotsvn rev 1223; added vary-meta
09:25heowHey guys, LispNYC is gearing up for SoC 2009. Thought I'd give you a heads up because last year we didn't have any Clojure submissions and I'd like to change that. :-)
09:27Chouserwhen is it?
09:27Chouseroh! sorry
09:27Chouserdidn't recognize the Summer of Code acronym
09:27heowOver the summer, not sure of the time-line yet as we're getting a head-start.
09:28heowsorry. SoC == Summer of Code
09:28rhickeyI'm willing to mentor Clojure projects
09:29heowwoohoo! Thanks Rich! Having the primary author on board really helps to get funding.
09:30rhickeyI'm especially interested in mentoring someone looking to do datalog or predicate dispatch work
09:31gnuvinceWhat does it take for a project to be accepted into SoC?
09:33heow#1 an idea that is good. Good being defined as either fun, utilitarian or academic. #2 A student who is willing to do the work and learn #3 a mentor to eyeball the progress
09:33heowpractically we ask for a proposal, right now we'll just be looking for great ideas and participants
09:35ChouserThey started that about 10 years too late for me. I would have loved to do SoC in college.
09:37jbondesonquestion, i'm looking at vincent's boundary function and i'm wondering if there's a way to not have to recompute the "value" every time.
09:38heowMe too. :-) Rich: datalog as in "query and rule language for deductive databases" ?
09:38jbondesoni'm doing something similar in my project and that computation could be slow.
09:39jbondesonalmost like a kind of memoization, though it wouldn't necessarily be static which makes it tough.
09:41karmazillastatic?
09:42jbondesonin a comparison, you wouldn't necessarily have a singular value, except in the cases of things like the count example (and mine), so your comparison might not be singularly valued
09:42jbondesonlike comparing two datastructures or "buh" to "buuuh" vs "buuh"
09:43gnuvincejbondeson: you could probably get around the problem with a pseudo schwartzian transform
09:43rhickeyheow: yes, datalog as in Datalog, for in-memory logic: http://en.wikipedia.org/wiki/Datalog
09:44rhickeyheow: even a Clojure interface to IRIS: http://iris-reasoner.org/
09:44jbondesoninteresting. i'll have to think about that at work.
09:44heowsweet
09:44jbondesonspeaking of, i better get going.
09:44gnuvincejbondeson: (first (greatest-by second (map expensive-computation coll)))
09:44gnuvinceErr
09:45gnuvincejbondeson: (first (greatest-by second (map #(vector % (expensive-computation %)) coll)))
09:45gnuvinceSomething sort of like that.
10:26vy,(doc clojure.core/add-classpath)
10:26clojurebot"([url]); Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"
10:26cooldude127anybody know why tab completion in slime doesn't work for clojure?
10:26vycooldude127: You need to use `slime-simple-complete-symbol' function for `slime-complete-symbol-function'.
10:27cooldude127vy: really!? is there a way to do it for just clojure? cuz i like the fuzzy one for CL
10:28vycooldude127: No, unfortunately there isn't: http://common-lisp.net/pipermail/slime-devel/2008-November/015683.html
10:29cooldude127well, that is shitty :(
10:30vycooldude127: Absolutely! You can try buging the mailing list by complaining about the same problem.
10:31vyWhy does (clojure.core/add-classpath "file:///path/to/dir") not make any effect on (System/getProperty "java.class.path")?
10:31cooldude127although really i'd love if clojure supported the fuzzy stuff
10:31vycooldude127: I'm planning to work on it.
10:31cooldude127vy: are you the swank-clojure developer or just interested in seeing it happen?
10:32vycooldude127: I had some bug reports, patches, but... Nah. I'm not the swank-clojure developer.
10:32cooldude127ok
10:32cooldude127cuz this simple tab completions is really lame
10:37cooldude127also, who told the paredit dev(s) that they could change paredit-open-brace to paredit-open-curly on a whim? lol
10:37cooldude127wow i need to stop ragging on people who develop things i like
10:44cooldude127ok where does the metadata have to go to document a multimethod?
10:44cooldude127i asked this yesterday but forgot
10:44Chousukebetween defmulti and its name IIRC.
10:45cooldude127that's what i thought, but it wasn't working. i'm not convinced that's the problem now tho
10:45Chouser(defmulti #^{:doc "do foo things"} foo class)
10:45Chouser,(defmulti #^{:doc "do foo things"} foo class)
10:45clojurebotDENIED
10:46cooldude127yeah that's right. but now i have a new problem, in that my slime isn't working! C-c C-l loads a file fine for the REPL, but C-c C-c doesn't work with individual forms, and C-c C-k isn't working for the whole file
10:46cooldude127WTF
10:47meredydd,"test"
10:47meredydd,(identity test)
10:47clojurebot#<core$test__4279 clojure.core$test__4279@f429d7>
10:48cooldude127ok nevermind, note to self and everyone else: have slime loaded before you open your clojure files. everything works better this way :)
10:51heowrich: on a scale of easy, med, hard how would you score datalog and predicate dispatch. Dispatch is done is CLOS so this is "just" another impl, dunno about datalog.
10:53karmazillaChouser: syntax coloring is next on my list. This time 'round I'm reading docs before coding. Looks like supporting multiple content types is part of the design of jtextpane
10:53Chouserkarmazilla: great!
10:55shoovercooldude127: (add-hook 'clojure-mode-hook (lambda () (slime-mode))) then at least C-c C-c will tell you "not connected"
10:56cooldude127shoover: no, slime-mode was active, it just wasn't doing it right
10:56cooldude127it even said it compiled, but it was wrong
10:56cooldude127but i g2g
11:20stuhoodis it necessary to use fully qualified classnames in a gen-class call?
11:20stuhoodfor instance, the following fails:
11:20stuhood(ns foo.bar
11:20stuhood (:import (java.util.regex Pattern)))
11:20stuhood(gen-class
11:20stuhood :name "foo.bar.SyslogStats"
11:20stuhood :main true
11:20stuhood :methods [[ONESIXPAT [] Pattern]])
11:32StartsWithKstuhood: yes
11:33stuhoodbummer... thanks
11:34StartsWithKwhy bummer?
11:35stuhoodit is duplication... if i have 4 methods that involve patterns, I need to fully qualify it 4 times
11:35gnuvincejbondeson: about the caching from earlier
11:35gnuvince(for greatest-by)
11:35gnuvinceHere's an idiom you could use:
11:36jbondesonah yes, sorry about the question and then dash.
11:36gnuvinceno problem
11:36gnuvincehang on
11:36gnuvincelisp.org is being slow...
11:36lisppaste8gnuvince pasted "caching results for greatest-by" at http://paste.lisp.org/display/74029
11:39gnuvinceIt's not super clean, but it'll perform the function only once.
11:40gnuvincelunchtime
11:40gnuvincebbl
11:40jbondesonyeah, that's about what i was thinking, a zipped list of evaluations.
11:40jbondesonthanks
11:41danlarkingnuvince: 11:41 AM? that's not lunchtime
11:41danlarkinalso, how are you 2 minutes ahead of me, that can't be right..
11:42LordOfTheNoobsThe dark spectre of clock skew rears again.
11:43danlarkinhey I sync with time.apple.com every hour, I claim infallibility!
12:11cooldude127a mostly documented awesomely awesome date library: http://gist.github.com/49656
12:43gnuvinceback
12:43gnuvincejbondeson: does that paste help you?
12:44hiredmanis it just me, or does building an oop system on top of clojure with structmaps seem backasswards to anyone else?
12:44jbondesonyeah, playing with it now. i wish there was a way to not create all the cons cells.
12:45jbondesonthough, technically, there are no cons cells =D
12:45Hunneed to tag something? just cons the tag in front. even better with push
12:48jbondesongnuvince: i went to test your pastes and couldn't figure out why the second was slower until i realized your fib function must generate the list rather than do a recur like mine
12:49gnuvincejbondeson: I used the "traditional" recursive fib implementation
12:49gnuvinceThe one that's ultra slow
12:49cooldude127gnuvince: memoize :)
12:49gnuvincecooldude127: I wanted something ultra slow
12:49cooldude127oh
12:49cooldude127then for the love of god, don't memoize
12:50jbondesonhah
12:50gnuvinceand memoizing fib is not too hot
12:50cooldude127what do you mean?
12:51gnuvinceThe iterative implementation of fib is very straight forward and you don't need a cache.
12:51cooldude127yeah that is true
12:52technomancybtw, for all the folks who were having trouble getting slime set up, I've added a function to the Emacs Starter Kit that should install and configure it for you.
12:52gnuvince*sigh*
12:53gnuvinceI need to maintain the worst PHP application ever
12:53cooldude127technomancy: hey you're on here :) check it out now: http://gist.github.com/49656
12:53technomancycertified Works on My Machine(TM) but would love to get some more folks trying it
12:53gnuvinceEvery functionality is implemented for each of the 5 module, so all the bug fixes need to happen 5 times.
12:53cooldude127gnuvince: don't they have competitions for that? worst php application
12:54gnuvincecooldude127: I imagine every other PHP application could be a contender
12:54cooldude127lol
12:54technomancycooldude127: nice. How's about some docs for it now?
12:54cooldude127technomancy: i documented most of the functions, but i suppose it could use a write up with examples of usage
12:55gnuvinceAnyway, it's a PITA: absolutely no tests, SQL + HTML + JavaScript + PHP interwined like it makes no sense, quintuplication of features, bad names, insecure, etc.
12:55technomancythat's what I mean; more of a tutorial style thing
12:55jbondesonexamples are for the weak!
12:55cooldude127technomancy: i guess that's next on my todo list :)
12:55gnuvinceI'd love to rewrite it in Django (what I use for most of my work)
12:55cooldude127jbondeson: have you looked at it? my date format macro is not straight-forward just from reading the code
12:55cooldude127lol
12:56Chousergnuvince: sounds like the average two-years-or-older codebase
12:56jbondesonlabel it as an exercise in de-obfuscation
12:57cooldude127jbondeson: idk, examples seem easier :)
12:58jbondesonis there anything uglier than C++ code utilizing the winapi, MFC, AND ATL?
12:58hiredmanclojurebot: ping?
12:58clojurebotPONG!
12:58cooldude127LOL
12:58cooldude127jbondeson: um...probably not
12:58jbondesonthis is going to drive me to drink ... more
12:59cooldude127jbondeson: i mean you could be using brainfuck ;)
12:59cooldude127that would be worse
12:59jbondesonhow a project with only 10 headers could take days to decipher is beyond me
12:59cooldude127but let's be real
12:59cooldude127lol
12:59jbondesonnah, brainfuck doesn't have C-macros
12:59cooldude127haha
12:59WizardofWestmarcRPG is worse then C++ as well, even w/ the winapi involved :P
13:00gnuvinceChouser: older, yes. And not written by me, fortuneatly
13:01cooldude127gnuvince: idk, it's at least mildly easier to decipher my own crappy old code than someone else's
13:01gnuvinceI inherited that project from an emo intern who obviously never heard of DRY.
13:01cooldude127lol
13:01jbondesoni just hate win-c++ because EVERY datastructure is macro'ed
13:01cooldude127that seems excessive
13:01gnuvincecooldude127: I mean fortunately, because at least I know I wasn't *that* bad
13:01jbondesonWORD, DWORD, LPCSTR ;-;
13:01cooldude127gnuvince: i'm pretty sure at one point i was
13:02gnuvinceWell, maybe I was, but there's no proof of that anymore ;)
13:02cooldude127lol
13:03cooldude127i remember writing a CMS in PHP where i basically wrapped every sql statement ever called in a method in ONE class. SO MUCH REPETITION. i might as well have done them inline. no separation. i was that bad
13:03cooldude127i had no grasp at all of OO
13:03Chousukeheh. :p
13:04gnuvinceThis guy clearly had no clue either.
13:04cooldude127ignorance is the worst quality in a programmer. lack of knowledge can do sooo much damage
13:04gnuvinceThese days however, I prefer to show my superiority to average programmers by saying that I know functional programming and even grok Haskell!
13:04cooldude127gnuvince: same here
13:04gnuvincecooldude127: this application is riddled with SQL injections
13:04cooldude127except i only grok most of haskell
13:05gnuvinceYeah, same here.
13:05gnuvinceI don't mean to imply that I'm a Haskell guru
13:05cooldude127gnuvince: i'm pretty sure mine was too. this was a personal project tho, not in production anywhere
13:05gnuvincefar from it.
13:05cooldude127is anyone a haskell guru?
13:05LordOfTheNoobsThose are user-customizable feature injection points.
13:05cooldude127is that even possible?
13:05cooldude127LordOfTheNoobs: lol
13:05gnuvincecooldude127: it is, but it must take a *long* time.
13:05jbondesoncooldude127: Zombie Curry is!
13:06cooldude127lol
13:06gnuvinceThere are languages where becoming an expert is long because you need to learn the language and the library and others (like Clojure) where only the library stands between you and expertise
13:06cooldude127i would also hope simon peyton jones is a guru
13:06cooldude127if not, no one has hope
13:06gnuvinceaugustss is pretty solid
13:07hiredmancooldude127: seems like they call them "dons" in haskell land, not gurus
13:07cooldude127lol
13:07gnuvinceheheh :)
13:07jbondesonmake him a comprehension he can't refuse?
13:07gnuvincedons is cool
13:07hiredmanyeah, guru is rather overused/loaded
13:07cooldude127i wish i could write productive, useful haskell code. it's a beautiful language, i just can't wrap my head around monads the way i can macros
13:08gnuvinceoffer >>= (not . refuse)
13:08cooldude127lol
13:08hiredmanjbondeson: I think it is more in the english academic sense
13:08gnuvinceor rather, offer >>= return (not . refuse)
13:08hiredmanlike an oxford don
13:08jbondesoni like my interpretation better.
13:08cooldude127not gonna lie, i thought mob first
13:09cooldude127yeah mafia more fun than oxford
13:09gnuvinceHaskell is probably the number one reason why I'm not hot with Clojure like Chouser or Stuart Sierra
13:10cooldude127haskell is probably the reason i like clojure
13:10cooldude127haskell pushed me into functional programming
13:10cooldude127and clojure made it usable
13:11gnuvinceHaskell keeps me distracted
13:11cooldude127lol
13:11gnuvinceWith its static typing and cool toys
13:11jbondesonCL -> ML/OCaml -> Haskell -> F# -> Clojure
13:11gnuvinceI keep telling myself that learning Clojure will allow me to finally learn the Java libraries, and then I can probably put Java on my CV without lying.
13:12jbondesonoddly enough, i've somehow never written any scheme...
13:12cooldude127lol
13:12cooldude127scheme i
13:12technomancygnuvince: I'm trying pretty hard to keep it *off* my CV
13:12cooldude127've found is next to useless
13:12cooldude127if you put it on there, they will ask you to use it
13:12technomancycooldude127: exactly
13:12technomancyor worse, maintain something written in it
13:12jbondesonPTL Scheme has some nice libraries
13:12cooldude127ah
13:12gnuvincetechnomancy: I imagine that if you get hired for a Java job, there would be a way to use Clojure somehow, even if it's just for your personal use.
13:12gnuvincetechnomancy: and I'd love that.
13:13WizardofWestmarcPLT is the only scheme I'd call useable, from what little experience I have w/it
13:13cooldude127gnuvince: it's not worth it !
13:13gnuvinceUnfortunately, nobody has even heard of Haskell in Quebec
13:13cooldude127WizardofWestmarc: i think you're right
13:13gnuvincecooldude127: what would be worth "it"?
13:13gnuvinceThere are no pure Clojure jobs :)
13:13WizardofWestmarcyet at least.
13:13cooldude127make some :)
13:13WizardofWestmarcif it keeps taking off, who knows
13:13technomancyWizardofWestmarc: bus scheme is pretty awesome though
13:13technomancyit's special in its own way
13:14WizardofWestmarcoh scheme in general is a very beautiful language
13:14cooldude127technomancy: the scheme that is written on the bus?
13:14WizardofWestmarcbut the library situation is just... meh on anything but PLT
13:14cooldude127beautiful but not all that practical
13:14gnuvinceI used Scheme for "The Little Schemer"
13:14technomancycooldude127: yes
13:14cooldude127lol
13:14gnuvinceIt's nice, but not practical, like cooldude127 said.
13:14gnuvinceThe Little Schemer was really nice
13:14technomancythat book is one of my favourites
13:14gnuvinceI have "The Seasoned Schemer" too, but haven't opened it yet.
13:14cooldude127i think clojure has a lot of the beauty of scheme, plus practicality
13:14WizardofWestmarcalthough I prefer lisp-1 over lisp-2, so that always drove me nuts when trying to work in CL
13:15technomancygnuvince: heh; me too
13:15WizardofWestmarcand one of the reasons Clojure appealed to me so much when I first saw it.
13:15gnuvinceHow many here picked up Clojure because they thought "A Lisp that has access the the hugest library ever? Count me in!"
13:15cooldude127there is definitely a certain beauty in not quoting or sharp-quoting all your functions, especially when you're encouraged to pass them around
13:15gnuvince*to the
13:16technomancynot me; for me it was "a lisp that corrects the errors of the past, but actually has enough momentum to really take off? sweet!"
13:16jbondesonit actually took me a while to get over my irrational hatred of java before i got into clojure
13:16cooldude127my biggest complaint with lisps has always been shitty libraries
13:16WizardofWestmarcthat's an understatement jbondeson :P
13:16cooldude127/ no libraries
13:16WizardofWestmarchow long ago did I try to get you to try it?
13:17technomancyjbondeson: yeah, java != jvm is an important prerequisite
13:17cooldude127and clojure fixed the last part right off the bat
13:17gnuvinceJava was definitely off putting at first.
13:17ChousukeI still don't understand why functions live in their own namespace in common lisp :/
13:17jbondesonlong time wiz... long time
13:17gnuvinceThen you realize that there's no trace of checked exceptions anywhere
13:17technomancyWizardofWestmarc: there's plenty of libraries; they're all just for platforms that have been dead for 20 years
13:17technomancyChousuke: because otherwise you'll get them confused!
13:17WizardofWestmarctechnomancy: fair enough, but to me that's same difference.
13:17technomancyyeah, it's a lame reason
13:18technomancyWizardofWestmarc: yeah, if you want to connect to an SQL database you're in for a rough time, but you can be damn sure that all the filesystem access functions will work perfectly on VAX!
13:18Chousuketechnomancy: only that? :/
13:18WizardofWestmarchaha VAX
13:18WizardofWestmarcwhen I first started my CS degree we were still on a VAX
13:18WizardofWestmarcand that was in '98
13:18cooldude127Chousuke: because otherwise unhygienic macros would be hell
13:19technomancyChousuke: yep. because otherwise you have to name your list variables "lst" instead of "list"
13:19cooldude127clojure fixes it differently with syntax-quote
13:19technomancyand that.
13:19jbondesongreat moments in lisp: "Why the hell is that named cdr/car?"
13:19cooldude127technomancy: only if you want to use the list function
13:19technomancycooldude127: it's for your own good! (so they say)
13:19cooldude127jbondeson: it feels so natural now
13:19cooldude127lol
13:19WizardofWestmarcheh, I never even knew how to pronounce cdr until I watched some of the SICP lectures
13:20cooldude127WizardofWestmarc: same here!
13:20cooldude127could-er
13:20jbondesonyeah, i was a little dissapointed i couldn't do "caddr"
13:20cooldude127frrest?
13:20jbondesonnot the same
13:20jbondesonjust not the same...
13:20cooldude127lol
13:21cooldude127jbondeson: that's actually true. i had to think a little too much when writing that
13:21cooldude127brb guys
13:22technomancyevery time I used caddr etc. I ended up regretting it a few days later. neat idea, but not so great in practice.
13:23Chousukeat least there's no magic to make them infinitely composeable.
13:23Chousukejust imagine cadddadadadddr or something
13:23Carkan emacs question : how can i kill an inferior-lisp process ?
13:24technomancyChousuke: in bus scheme I used method_missing to allow for theoretically infinite c[ad]r calls
13:24technomancyit was ridiculous
13:24technomancyCark: just kill the *inferior-lisp* buffer; should do the trick
13:24Carkthanks !
13:24Carkthat was too obvious i guess =)
13:25technomancywell, only if you understand elisp's process model.
13:26WizardofWestmarcif it's clojure specific can also do (. System exit 0), but that leaves the actual buffer up in emacs, just kills the java process it's using
13:26jbondesoni used c[ad]r's all the time when i first started because i hadn't learned how to create decent data structure in lisp, so i just used lists for everything
13:29technomancyjbondeson: well to be fair lisp really does kind of encourage that
13:29technomancythough through alists and plists rather than just regular linear lists
13:30jbondesonwhen i started clojure i had to realize that vectors do infact exist and even have use.
13:30Lau_of_DKGood evening gents
13:30jbondeson"What do you mean there are collections that aren't lists?"
13:32gnuvincejbondeson: hehe ;)
13:32Chouserthey existed, you just couldn't use half the function library on them, right?
13:32technomancyplus there was only literal syntax for vectors
13:33cooldude127technomancy: what are we talking about?
13:33WizardofWestmarcvectors in CL
13:33cooldude127yuck
13:33jbondesonChouser: yeah, they existed, but most CLs were so optimized for list processing you almost never used them
13:33cooldude127it was kinda like "what's the point?"
13:34technomancywell, they had better performance, so you were encouraged to write it first using lists, then rewrite it using vectors/hash tables once you figured out what you were doing and needed the speed.
13:34gnuvinceThat's the problem
13:34technomancybut the rewrite would be very hard since their behaviour was so different
13:34jbondesonyeah, and then most people didn't ;)
13:34technomancyheh
13:35gnuvinceBeautiful code was usually slow because of the O(n) access time of lists, then you wanted to convert to vectors, but you needed to change everything about your program.
13:36cooldude127gnuvince: which is why clojure is awesome :)
13:37gnuvinceIt's one reason, yes :)
13:37technomancyit makes for good "when I was your age" stories though. =)
13:37gnuvincehahahaha
13:38gnuvince"When I was your age, we only had singly linked lists and we liked it!"
13:38jbondesonheh
13:56jbondesongnuvince: after talking about lisp, and thinking about the minimizing calulation problem, i wonder if using refs and modifying metadata would be faster. the only thing that i worry about is the sync'ing overhead.
13:56jbondesonthat would be like the decorating in CL
13:56jbondesonwonder if the sync would be shorter than all the seq creations/accessors
13:57gnuvinceI'd rather not use a changing variable.
13:57jbondesonyeah.
13:57jbondesonyou'd also have to undecorate, doubling the syncs
13:59jbondesonwonder how hard it would be to do some kind of memoization.
14:00Chouser(doc memoize)
14:00clojurebotReturns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use.; arglists ([f])
14:00ChouserI assume you don't mean anything quite that simple. :-)
14:01bakkdoorhi
14:02jbondesoni assume memoize drops the memos when you no longer reference the memoized function?
14:02jbondeson(way to many memos in that sentence)
14:02jbondeson+o
14:03jbondesonthe problem would be that i'd have millions of calls to this, and i'd have to figure out how to keep memory use in check.
14:03Chouseryes, the fn returned by memoize closes over cache. Throw away the fn and the cache can be GC'ed
14:03bakkdoor i have a problem with tab completion with clojure in emacs & slime. i always get this error message: "Synchronous Lisp Evaluation aborted". maybe someone knows how to solve this?
14:04jbondesonclojurebox or did you get them separately?
14:04Chouserjbondeson: hm. yeah, sounds like you'd need a custom memoizer
14:05bakkdoorjbondeson: got them seperately. using ubuntu linux, got slime fresh via cvs, same for clojure (svn), swank-clojure & clojure-mode (github)
14:05jbondesoneither that re-create the memoized function every generation since it's unlikely that two generations will have identical particles.
14:05bakkdoorcompiling etc works fine
14:05jbondesonbakkdoor: when did you get clojure?
14:05bakkdoorjust tab completion
14:06bakkdooryesterday or so
14:06jbondesonhmmmm.
14:06duck1123bakkdoor: I was getting something like that when all of the components weren't up to date
14:06jbondesonusing any other emacs modes?
14:06bakkdoorhaskell mode
14:06bakkdoori'll comment it out of my .emacs, ewait
14:06jbondesoni have that installed also, and haven't had any problems.
14:07jbondesonwell... loaded, not installed
14:07bakkdoori also use common lisp, but i've commented out all the cl related stuff and tell emacs to use the latest slime etc
14:08bakkdooris there a nice way to be able to use both (sbcl & clojure) with one slime installation?
14:08bakkdoori still get the same error message
14:08WizardofWestmarcshould be able to w/different load commands at the very least
14:09WizardofWestmarcso you could use one m-x command to fire clojure, one for sbcl
14:09WizardofWestmarcthough mine was broken last time I tried that, but pretty sure it was my fault, not emacs'
14:09duck1123bakkdoor: are you loading them in the right order? swank has to be loaded before slime
14:10jbondesonthat shouldn't kill tabbing though
14:10jbondesonwell... maybe
14:10duck1123it causes a whole bunch of odd problems
14:11duck1123most notably the "progn" problem
14:11technomancybakkdoor: I don't do CL, but I think Bill Clementson's blog is a good place to figure out how to configure slime for using both.
14:11jbondesonclojure-auto -> swank -> slime should be the correct order
14:11bakkdoorhm ok
14:12bakkdoori have it in that order
14:12arbscht_bakkdoor: there is, I'm running sbcl and clojure together right now, even
14:13duck1123isn't it something like M-- M-x slime
14:13arbscht_bakkdoor: you'll want to add your various lisps to slime-list-implementations
14:13lisppaste8bakkdoor pasted "clojure-slime" at http://paste.lisp.org/display/74038
14:13bakkdoorarbscht_: alright thanks
14:14bakkdooris my setup correct?
14:16arbscht_bakkdoor: C-h v slime-lisp-implementations
14:16arbscht_what is its current value?
14:17bakkdoor((clojure
14:17bakkdoor ("clojure")
14:17bakkdoor :init swank-clojure-init))
14:17arbscht_right, so you want that to also contain an entry for sbcl
14:18arbscht_something like this should do it: (add-to-list 'slime-lisp-implementations '(sbcl ("sbcl")))
14:20jbondesoni really don't want to write a memoizer that's essentially a GC implementation =/
14:20bakkdoorarbscht_: alright, thanks.
14:21bakkdoorthe tab completion works for sbcl perfectly fine, just not for clojure
14:21Chouserjbondeson: a memoizer that throws away LRU values would be pretty general purpose and probably not too complicated
14:24jbondesontrue.
14:27ChouserI guess LRU implies cache hits still require some kind of update. :-P
14:29jbondesonright, it would be slower, but if done carefully it wouldn't be too slow
14:29jbondesonor you could have some idea of generations, but then you're really getting into gc territory
14:31WizardofWestmarcHow expensive is the generation of a memoized version of a function?
14:31WizardofWestmarcw/the built in function in clojure
14:31Chouserpretty cheap
14:31jbondesonwell it has to cache the result and the args hashs
14:32jbondesonso slightly bigger than the returns
14:32Chousercalling memoize itself creates, I suppose, a closure object and an atom -- I think that's it.
14:32jbondesonlooking at the code that looks correct.
14:33jbondesonthough the other side effect is that it has a reference to the args, doesn't it?
14:34hiredmandepends on what it uses to determine if one set of args is the same as another
14:34Chouserthe returned closure has a reference to the function f -- is that waht you mean?
14:35hiredmanChouser: likes like the function args are used as a key in the hash
14:35hiredmanlooks
14:36jbondesonright, so would that cound as a reference? seems that way to me.
14:36hiredmanyes
14:36Chouserare we talking about the cost of creating the memoized function (i.e. calling 'memoize') or the overhead of calling the memoized function?
14:36jbondesoncalling
14:37hiredmanoh, I thought we were talking about side effects
14:37cooldude127omg cs class is learning about avl trees and red-black trees and head exploding AH
14:37jbondesonwell
14:37ChouserI thought WizardofWestmarc was asking about calling 'memoize'
14:37jbondesonthe side effects from calling
14:37WizardofWestmarcI asked that part
14:37WizardofWestmarche switched topic ;)
14:37hiredmandunno, I just got here and saw jbondeson ask about side effects
14:37jbondesoni'm good at that.
14:38Chouseron a cache hit, there is no side-effect. the overhead is probably dominated by a single hash lookup
14:39jbondesoni was just thinking about what memoize does to your memory when called.
14:39Chouseroh, yes, each cached item has the args as a map key and the return value as a map value.
14:40Chouserso a memory-heavy arg would use up a lot of memory when cached.
14:41WizardofWestmarcIf it were something like a hash itself that you were passing in, which was stored already via another def, wouldn't it just share the reference?
14:45meredyddjbondeson: Is there a reason you wouldn't just borrow the Java GC interfaces?
14:45meredyddThat sort of application is what WeakHashMap was born for.
14:47jbondesonthat looks promising. I'm not super familiar with the Java libraries so I had no idea that existed.
14:50jbondesoncourse a fixed size memoizer would be useful as well.
14:50technomancycooldude127: did you end up trying the starter kit?
14:51cooldude127technomancy: no, but i regularly steal from it
14:51cooldude127:)
14:51technomancycool.
14:51duck1123a large portion of my .emacs has been stolen from technomancy
14:51cooldude127there's too much of my own custom stuff in mine
14:51technomancycooldude127: it's a little awkward to adapt an existing config to use the starter kit, for sure. but you can just toss your stuff in the user-specific-dir and it might work.
14:51technomancyI should document that
14:52cooldude127technomancy: do it, i might fork you and do that
14:52technomancywell, the documentation would be something like "just put everything you had in .emacs.d into starter-kit/$USER/
14:52technomancy"
14:52cooldude127lol
14:53cooldude127technomancy: well, i know what i'm doing tonight. converting my emacs setup to use emacs-starter-kit
14:53cooldude127:)
14:53technomancythe only potential problems you might have would be package conflicts
14:53technomancyheh
14:53cooldude127technomancy: i'm using a lot of the same packages you are
14:53technomancymight have better luck if you do it while I'm still online. =)
14:54cooldude127well i'm in class, which is almost over, after which i will head home and do it
14:54cooldude127you'll probably still be online?
14:54technomancytill 5pm PST
14:54technomancyshould probably keep it in #emacs though; wups
14:54cooldude1278pm EST? yeah
14:54cooldude127i'll be there in a little while if i have problems
14:58jbondesonhmmm... to make the WeakHashMap really useful i'll probably have to wrap it and implement Associative
15:05hiredmanclojurebot: ping?
15:05clojurebotPONG!
15:06jbondesoni see you fixed him up last night
15:07hiredmanand now its dispatcher uses a priority queue
15:07jbondesonnext he'll ask for a salary
15:08hiredmanpreviously it just when down a list trying each entry fifo style
15:08durka42did the contents of his brain survive?
15:09LordOfTheNoobsThey aren't file backed. It's just a couple of hashes.
15:10hiredmandurka42: yes
15:10durka42wait, those answers seem contradictory
15:10LordOfTheNoobs? When I look at the source it didn't look like it was saving them. My mistake.
15:10durka42clojurebot: examples?
15:10clojurebotexamples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
15:10hiredmanthe change was to the function that does the dispatch in determining if you are asking it to run code or if you are looking up "examples"
15:11hiredmanLordOfTheNoobs: the hashes are written to disk every five or ten minutes
15:11jbondesonthat was from before the meltdown, so he survived
15:11hiredmanclojurebot: latest?
15:11clojurebotlatest is 1223
15:12LordOfTheNoobslooky there. http://github.com/hiredman/clojurebot/blob/466d0bd69d507bf517a784fb8c38ab31a849ed3f/hiredman/clojurebot/core.clj#L404
15:12hiredmanneat
15:12hiredmandid nae realize github could like right a certain line
15:30Lau_of_DKWhere are you reading?
15:30technomancyjust http://clojure.org/streams
15:30technomancythen the ML
15:34Lau_of_DKkthxbye
15:54Lau_of_DKAll you scrum fans, if you know how many units youve burned in the first 2 - 10 days of a sprint, input them like "200 195 180 172 165" and this will render a burn-down chart: http://gist.github.com/50711
16:01hiredmanclojurebot: group?
16:01clojurebotgroup is http://groups.google.com/group/clojure/
16:01hiredmanhttp://groups.google.com/group/clojure/
16:03hiredmanwhoops
16:03jbondesongoodnight sweet prince!
16:04Lau_of_DKI didnt get this from the stream-document on Clojure.com, but is filter* fully lazy as well?
16:12hiredman,(identity java.net.URLEncode)
16:12clojurebotjava.lang.ClassNotFoundException: java.net.URLEncode
16:12hiredmanlame
16:12hiredmanoh
16:12hiredman,(identity java.net.URLEncoder)
16:12clojurebotjava.net.URLEncoder
16:14hiredmanhttp://groups.google.com/group/clojure/
16:15hiredmanhmmm
16:20hiredmanhttp://groups.google.com/group/clojure/
16:20hiredman:D
16:21kotarakhiredman: \o/
16:21Chouserwhoa, he's purple
16:22hiredmanit's a NOTICE
16:23Chouserhuh. Never used that.
16:23hiredmanmost don't
16:23hiredmanit will make tinyurls of urls it sees that are over 30 characters
16:24Chouserwhy use notice? just curious.
16:24hiredmanyou can ignore notices seperately from other stuff
16:25Chouserah! good to know.
16:25hiredmanand the only other bot I've seen do tinyurls does it with notice
16:25durka42kotarak: did you ever crash-test my smuggler?
16:26hiredmanChouser: does it bother you?
16:26kotarakdurka42: not yet. I had a brief look at it, but an unexpected business trip took me half of the week.
16:26kotarakdurka42: Will have a look over the week-end, though.
16:27durka42when you have time
16:27Chouserhiredman: nope, not at all.
16:28durka42i should write a readme
16:28hiredmanChouser: if starts to, let me know
16:30eyerisI am trying to add LIMIT support to ClojureQL but I am having difficulty understanding the multi-methods used. Could someone take a look at this and tell me what I am missing? http://pastebin.ca/1315684 (disclaimer: I'm a complete lisp newb)
16:33Lau_of_DKHi eyeris
16:33eyerisHi!
16:33Lau_of_DKSorry I didnt get back to you sooner regarding limits
16:33eyerisNp
16:33eyerisI figured it was a good opportunity to learn
16:34Lau_of_DKCool, I look forward to your contribution
16:34Lau_of_DKAre you trying to set ::LimitSelected as the default dispatch?
16:36kotarakWhat problem do you have?
16:36eyerisI think that's what I don't understand.
16:36kotarakeyeris: ???
16:37kotarakDoesn't it do what you want?
16:37eyerisThe documentation for multi-methods made me think that there should only be one method for each default with a :default dispatch
16:37kotarakThe :default is for the db argument.
16:38eyerisOkay.
16:38kotarakIt may be used to provide specialised methods for different DBs, like derby or MySQL.
16:38eyerisI see.
16:38kotarakIt's currently unused.
16:38eyerisAnd that is why they all use :default for the DB, because right now there is no need to have something like ::MySQL or ::SQLite
16:38Lau_of_DKeyeris: Maybe you should consider implementing limit as a wrapper similar to Union in the frontend instead?
16:40eyerisI am doing that.
16:41kotarakHmm...
16:41kotarakIt should work.
16:41eyerishttp://pastebin.ca/1315696
16:41kotarakWhat happens when you call execute-sql directly on your statement?
16:41eyerisThat is how I implemeted the limit wrapper
16:42Lau_of_DKYou doc limit* as a driver for order-by? :)
16:42eyerisI've derived LimitedSelect from Select. Perhaps I need to derive it from ExecuteQuery?
16:42eyerisHaha, stupid copy/paste :)
16:42kotaraklimit should be function, no macro.
16:43kotarakSo rename limit* to limit and leave a away the macro.
16:43Lau_of_DKeyeris: kotarak is german, so let me rephrase "So I recommend that you rename limit* to limit*, then you can do away with the macro"
16:43kotarakBut that is a detail.
16:44eyerisRight, limit isn't doing anything other than calling limit*.
16:44kotarakeyeris: what happens when you call execute-sql directly on your statement directly in the repl.
16:44eyerisSo it's pointless to use it.
16:44eyeriskotarak I will try that. Hold.
16:46eyerisI get the same exception: No method for dispatch value: [:dk.bestinclass.clojureql/Execute nil]
16:47Lau_of_DKExecute?
16:47Lau_of_DKWeren't you dispatching on :type ::LimitSelect ?
16:49kotarakExecute seems strange.
16:49kotarakDoh.
16:49kotarakMy fault
16:49kotarakI meant compile-sql instead of execute-sql.
16:49eyerisRight, if I change (derive ::Select ::ExecuteQuery) to (derive ::Select ::Execute) it tries to dispatch on ::LimitedSelect
16:49eyerisOh, :)
16:50kotarakLimitedSelect should derive from Select
16:52eyerisNo method for dispatch value: [:dk.bestinclass.clojureql/LimitedSelect nil]
16:53kotarakhmmm
16:54Lau_of_DKeyeris: And which expression did you evaluate to get that error?
16:56eyeris(sql/compile-sql (sql/limit (sql/query ID p9662) 2) nil)
16:57kotarakAnd you patched the clojureql source directly? So the defmethod for LimitedSelect is in backend.clj?
16:58eyerisThat is correct.
16:58Lau_of_DKeyeris: I have to duck out now, will be back for heavy coding saturnight if you need more assitance, otherwise Im sure kotarak will love to help out :)
16:59eyerisOkay
16:59kotarakhehe, Lau_of_DK - the Delegator! ;)
16:59WizardofWestmarcbest way to get anything done, hand it off to someone else
17:01kotarakeyeris: ok. I'm stuck.
17:01eyerisI am going to re-clone the repo and try to do this again.
17:02durka42readme written.
17:11eyeriskotarak here is a patch of my changes http://drew.intercarve.net/tmp/limit.patch.txt
17:11eyerisThat should make it more clear what I've done.
17:12kotarakeyeris: ok. Let me try here.
17:13eyerisThis is what I get if I print out the AST generated by sql/limit:
17:13eyeris"{:type :dk.bestinclass.clojureql/LimitedSelect, :query {:type :dk.bestinclass.clojureql/Select, :columns [ID], :tables [\"p9662\"], :predicates nil, :column-aliases {}, :table-aliases {}, :env nil}, :limit 2, :env nil}"
17:14eyerisThat is what I expect it to print out.
17:14kotarakLooks good.
17:16kotarakArgh. I'm stupid.
17:17kotarakeyeris: Ok. Stupid mistake on my side. I shouldn't change this around midnight...
17:29_hrrldIs it possible to express dependency on external .jar files from within a .clj file? Similar to Ruby's require or Python's import?
17:29technomancy_hrrld: how external?
17:29hiredmanimport
17:29kotarakor require
17:29hiredman^-
17:29eyeriskotarak What was your mistake?
17:30scottj_hrrld: do you mean without having it in your classpath?
17:30technomancy_hrrld: import for Java classes; require/use for clj files.
17:30_hrrldYeah, it seems my slime repl cant find the .jar
17:30hiredmanthey express dependency on a class or namespace in a jar
17:30_hrrldor isn't using it, or something. (Apologies that I'm a java newb)
17:30technomancy_hrrld: you can use add-classpath too
17:30kotarakeyeris: [bla :default] is wrong. The default dispatch value is for the whole vector.
17:31hiredman_hrrld: (System/getProperty "java.class.path")
17:31technomancy_hrrld: did you set swank-clojure-extra-classpaths *before* starting slime?
17:31kotarakeyeris: I have to introduce ::AnyDB from which all the DBs derive.
17:32eyeris_hrrld I (require a.b.c) is like Python's import a.b.c but instead of calling c.d() as you would in python, you call (c/d ...)
17:32_hrrldtechnomancy: I don't want to have to do that, I want the dependency expressed in the clojure code which consumes it. add-classpath seems to be what I was looking for, I'll experiment with it.
17:32hiredmanNo!
17:32eyeris_hrrld On the other hand, (use a.b.c) is like python's from a.b.c import *.
17:32hiredmandon't use add-classpath
17:32technomancy_hrrld: yeah, keeping it in the code is the Right Thing to Do as far as I'm concerned, but I guess there are some issues with it?
17:32hiredmanadd-classpath is icky
17:32technomancy_hrrld: it's the only way to keep DRY unfortunately.
17:33eyeriskotarak Ahh! Thanks! I will watch for those changes.
17:33eyerisFor now I have to run.
17:33technomancyhiredman: duplicating your classpath in three separate places is icky too
17:33kotarakeyeris: ok. bye
17:33eyerisThanks for helping me track down my problem.
17:33kotaraknp
17:33hiredmantechnomancy: then don't
17:33scottjhiredman: does add-classpath even work?
17:33hiredmanscottj: dunno, I don't use it
17:34technomancyscottj: it works great for clj files; I haven't used it for external jars since rhickey fixed it.
17:34technomancyhiredman: I still haven't heard any reasons for avoiding it that make sense
17:35hiredmantechnomancy: you may as well just load-file external .clj files
17:35technomancythat doesn't honor the load-once policy that require has
17:36hiredman2008:Nov:22:08:53:31 rhickey add-classpath is only for repl
17:36hiredman2008:Nov:13:06:35:15 rhickey add-classpath is really just for repl emergencies, want to try a new lib without restarting etc. Once you know you need a lib, out it in your real classpath
17:37_hrrldThat's all very interesting. So what do people do? Have custom emacs-lisp code that diddles swank-clojure-extra-classpaths?
17:38hiredman_hrrld: I just put the jars I need in the classpath
17:38technomancy_hrrld: for a while I was just saying "you have to launch this via SLIME" because I wanted to have the classpath declared in only one place
17:38technomancybut that clearly sucks
17:39_hrrldI don't know much about .jar files. Is there a way to merge them or something?
17:39technomancy_hrrld: for learning I'd recommend a project that doesn't require any external jars (besides contrib) because you'll waste more time fighting with the classpath than actually learning.
17:40technomancyit doesn't really make a lot of sense
17:41kotarak_hrrld: jar files are "just" zip files.
17:41kotarakyou can look inside, by simply unzipping them.
17:42_hrrldWoah, neat! Can I just stuff more classes in here?
17:43technomancy_hrrld: probably not a good idea in most cases; if you see a file named jetty-1.4.jar you want to be able to assume the contents match the name.
17:43hiredman2008:Nov:29:17:46:03 rhickey dynamically loaded classes must be loaded from a custom classloader, which creates all kinds of difficulties in certain hosting environments
17:43Chouserwell, they're zip files with a mit of extra meta-data
17:43Chouserbit
17:43technomancybut... obviously I don't understand the classpath; don't listen to me
17:43scottj_hrrld: you can just include all the jars you use in slime and then have a startup script for when you use the program outside slime
17:44_hrrldscottj: This is what's typically done?
17:44technomancyscottj: bzzzt! DRY violation; 15-yard penalty.
17:44Chouserfor applets, I've been unpacking clojure.jar, sprinkling in all the other classes I need, and packaging up a single my-applet.jar -- dunno if that's Right or not, but it seems to work.
17:45scottj_hrrld: I don't know what others do. I don't use that slime classpath variable anymore, but instead have some elisp that creates the slime-lisp-implementations that I want. (C-h v slime-lisp-implementations to see how your classpath is included there)
17:46kotarak_hrrld: look for a launcher, eg. on github or in contrib. They use a directory, where you simply drop all your jars and they are automatically added to your classpath. Never ever had a single problem with that scheme.
17:46hiredmanclojurebot: jar directory?
17:46clojurebotjar directory is -Djava.ext.dirs=$LIBS
17:46kotarakThis is evil is I understood.
17:46hiredmannow, that can create some problems
17:46technomancyah, actually just globbing a directory is way better than maintaining separate lists.
17:47technomancyyou could build up the swank-clojure-extra-classpaths list in elisp easily enough
17:47technomancyoh! they finally added a launcher to contrib; sweet.
17:48technomancyneeds to be in core, but it's a start
17:48hiredmanclojurebot: jar directory is find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
17:48clojurebotOk.
17:49hiredmantechnomancy: internally swank-clojure seems to glob up the .clojure/ dir for jars and add them to the classpath
17:50technomancyhiredman: I wonder if that's wise to rely on since others can check out your project and have a totally different ~/.clojure directory.
17:50_hrrldChouser: re-packing the .jar with the .class files from the dependency worked. That's cute.
17:51hiredmantechnomancy: that is just swank-clojure
17:51hiredmanI am saying "hey you can steal elisp code from there for globbing jars"
17:51technomancyhiredman: oh, sure; gotcha.
17:52hiredmanI would recommend against doing it with elisp, because not everyone runs ElispOS
17:52technomancyhiredman: right, you would have to ensure that the shell script did the same thing.
17:52hiredmanthe most platform agnostic way is "this code depends on these jar files, make sure they are in your classpath"
17:53technomancyrepeating the "use everything in this dir" notion is a lot more acceptable than repeating "here is a list of jars" in several locations in your codebase
17:54hiredmanI don't really like the notion of projects shipping out with there own jar directories
17:54hiredmanI think it is fine to just say "this depends on version X of jetty being in the classpath"
17:55technomancyhiredman: well sure; it's a substitute for a real package manager.
17:55technomancyif you had a package manager you wouldn't have to bundle everything; you could just declare the dependencies and they could be fetched automatically
17:57hiredmanclojurebot: ties?
17:57clojurebotties is http://www.bitbucket.org/achimpassen/clojure-ties/wiki/Home
17:57technomancyright. =)
17:57hiredmanwhich is icky
17:57hiredmanentirely too maven for me
17:58technomancyyeah, I'm not a maven fan at all, but I can see the value of bootstrapping off it.
17:58hiredman:(
17:58hiredmananyway, stop using add-classpath
17:58hiredman:P
17:58technomancyok ok... but I'm still going to glob a jars/ directory
17:59technomancyyou can't stop me!
17:59technomancyunless you write an awesome package manager.
17:59hiredmantechnomancy: I like how ring does it
17:59technomancyhow's that?
17:59hiredmanclojurebot: ring?
17:59clojurebotring is http://github.com/mmcgrana/ring/tree/master
18:00hiredmanAll jars needed to load any of the ring.* libs are included in the jars/ directory. You only need Java. To see a live "Hello World" Ring app, simply run:
18:00hiredmanjava -Djava.ext.dirs=jars clojure.main src/ring/examples/hello_world.clj
18:00hiredmanvery simple, flexible, and amendable
18:00technomancyI thought you didn't like the jars directory?
18:01hiredmanI like that way better then the compojure way, which last I checked was to provide jars and a launcher script
18:01hiredman(which globbed the jars)
18:01technomancyoh, gotcha
18:01hiredmanthat is just a simple java command line, which I can easily understand and warp to my wims
18:01arbscht_compojure doesn't do that anymore, iirc
18:02hiredmangood
18:02technomancyoh, so the implication is that this is just a starting point, whereas with compojure it's "what you should use"
18:02technomancys/it's/it was/
18:31AzmodanHow do you do the equivalent of the python ", ".join(some_list) in Clojure?
18:32gnuvince_Azmodan: there's a str-join function in clojure.contrib.str-utils
18:32Chouser,(apply str (interpose "," (range 5)))
18:32clojurebot"0,1,2,3,4"
18:32AzmodanI didn't look at contrib yet, what is it?
18:32hiredmanthat depends
18:33hiredman(doc interpose)
18:33clojurebotReturns a lazy seq of the elements of coll separated by sep; arglists ([sep coll])
18:33dreishIt's a quasi-standard library.
18:33hiredmanhmmm
18:33gnuvince_Azmodan: a collection of useful modules.
18:33hiredmanand all this time I have been dicking around with interleave
18:34gnuvince_,(str-join ", " ["hello", "world", "foo"])
18:34clojurebotjava.lang.Exception: Unable to resolve symbol: str-join in this context
18:34gnuvince_,(clojure.contrib.str-utils/str-join ", " ["hello", "world", "foo"])
18:34clojurebotjava.lang.ClassNotFoundException: clojure.contrib.str-utils
18:34gnuvince_meh
18:36AzmodanI figured out the str and interpose part but I was stuck with a seq and not a string. Apply fixed this but I'm not sure what it does exactly.
18:37Chouser,(require '[clojure.contrib.str-utils :as str-utils])
18:37clojurebotnil
18:37Chouser,(str-utils/str-join ", " (range 3))
18:37clojurebot"0, 1, 2"
18:37ChouserAzmodan: (apply str 1 2 [3 4 5]) is the same as (str 1 2 3 4 5)
18:37hiredman(doc apply)
18:37clojurebotApplies fn f to the argument list formed by prepending args to argseq.; arglists ([f args* argseq])
18:37Chouserapply unpacks the final list
18:39AzmodanSo the point of apply is to unpack final lists?
18:39hiredmanstring utils must have a (partial apply str)
18:41gnuvince_Azmodan: yes
19:35felzixhow do I import a library into clojure?
19:35felzixfor instance, using contrib's expt function
19:35Chouserfirst make sure that clojure-contrib/src or clojure-contrib.jar is in your Java classpath
19:36Chouserthen use 'require' or 'use', like this:
19:36Chouser(require '[clojure.contrib.math :as math])
19:37felzixawesome, thank you!
19:38Chousernow you have an alias for that namespace as 'math', so you can use expt like: (math/expt 2 10)
19:38Chousernp
19:40danlarkinhow does cygnus sound as a name for my soon-to-be-released web framework, lame?
19:40danlarkinthinking of names is so hard!
19:40durka42what's the derivation of cygnus
19:41technomancydanlarkin: makes me thing of cygwin
19:42technomancynaming *is* hard.
19:42danlarkinwell Cygnus X-1 is a song by progressive rock band Rush
19:42technomancyisn't that the name of a rocket or something?
19:42danlarkinyes
19:42technomancyI like to use names that come from computing history
19:43technomancyrockets and computing were pretty closely related back in the day
19:43danlarkinit's got a very interesting back story
19:43danlarkinhttp://en.wikipedia.org/wiki/Cygnus_X-1_duology
19:44technomancydanlarkin: unfortunately in the realm of software there's already http://en.wikipedia.org/wiki/Cygnus_Solutions
19:44danlarkinoh, damn
19:44danlarkinand they make cygwin... well there goes that idea
19:45durka42they don't quite exist any more
19:45technomancyyeah, merged with redhat
19:45technomancybut it still makes me think of cygwin
19:45durka42yeah
19:46technomancyclojurebot: slime?
19:46clojurebotIt's greek to me.
19:46danlarkinand there's always Xanadu, another (fantastic) song by Rush, but the wikipedia disambiguation page for Xanadu is already huge
19:47durka42clojurebot: slime is icky
19:47clojurebotAck. Ack.
19:47technomancyclojurebot: slime-install is an automated elisp install script at http://github.com/technomancy/emacs-starter-kit/blob/2b7678e9a331d243bf32cd8b591f826739dad2d9/starter-kit-lisp.el#-72
19:47clojurebotAck. Ack.
19:47durka42oh, cool
19:47technomancydanlarkin: right, Ted Nelson's The Web Done Right; heh
19:48technomancywould appreciate testers for that slime-install script. needs a bit more polishing; then could be mainlined into clojure-mode
19:49durka42this script doesn't take care of .emacs, does it?
19:50durka42or you just call esk-clojure from .emacs
19:50technomancydurka42: that's right
19:50technomancysince it needs an argument for where clojure is installed
19:50technomancythe perils of dealing with manually installed software. =\
19:53technomancydanlarkin: now I'm curious about this song; sounds interesting.
19:53technomancyor songs
19:53danlarkintechnomancy: you've never listened to rush? oh gosh! do you like progressive rock at all?
19:53danlarkintechnomancy: if not, then you might not enjoy it
19:53technomancymaybe... I'm not sure quite what it entails.
19:54technomancyI've heard some Dream Theater; really liked some of that, some of it not so much.
19:56technomancyI do really enjoy albums that are a cohesive story if they're done right.
19:58danlarkinhere's a good example of their musical virtuosity: http://www.youtube.com/watch?v=me6BXzOUNuo
19:59danlarkinclojurebot: that's annoying
19:59clojurebotI don't understand.
19:59hiredmanannoying like, it should for longer urls do it?
19:59technomancyat least the length limit should be boosted
20:00hiredmanwhat is a good url character length threshold?
20:00hiredmanright now it fires at 30
20:00technomancyI'd say 70 minus average nick length?
20:01danlarkinhttp://www..com/ is 16... so I think 30 is really pushing it
20:03hiredmanmakes me said, I like watching it go
20:06danlarkinhow about.... syrinx
20:06gnuvince_Why do we even need tinyurl?
20:06gnuvince_Just click on the link
20:36gnuvince_With Slime, I tried adding a path to swank-clojure-extra-classpaths, but when I run M-x slime, I don't have the new path in (System/getProperty "java.class.path"). Anyone knows what's up with that?
20:40Chouserhiredman: if you could figure out how to replace long urls with short ones, rather than both being posted -- now that would be nice.
20:43danlarkinaka impossible :)
20:45durka42gnuvince: i wonder if this is related to my problem yesterday with add-classpath?
20:45durka42unfortunately i can't stay to find out :(
20:52shoover`why do we have both replicate and repeat? couldn't we have just one with varied arity?
20:54cooldude127shoover`: i have a feeling you are right about that
20:54shoover`there's gotta be a reason. I want to know it
20:55cooldude127shoover`: maybe we don't like mixing functions that make infinite seqs and once that end
20:56shoover`mmm... interleave and map both can be infinite or not depending on their args
20:56cooldude127idk then
20:57shoover`you had me for a sec ;)
20:57cooldude127lol i'm pulling it out of my ass :)
21:18hiredmanif no one wants the tinyurl feature I will disable it
21:26cooldude127hiredman: is it problematic?
21:26danlarkinI think it's unnecessary
21:27cooldude127probably
21:27cooldude127tinyurl is more useful for before you paste it into irc
21:27cooldude127:)
21:59jamesnvcHello
22:00jamesnvcI think this has been asked before, but what do I need to do to use javax.swing in clojure programs?
22:00Chousernothing special
22:00jamesnvcHrm...
22:00jamesnvcWhat jar is it in?
22:01Chouserbuiltin
22:01Chouserhttp://clojure.org/jvm_hosted
22:01jamesnvcI'm not too familiar with Java classpath stuff
22:01jamesnvcHrm
22:01Chousernice little example there to get you started
22:02jamesnvcHeh...I see what I did wrong
22:02jamesnvcI didn't quote the list of libraries
22:02Chouserah
22:02jamesnvcMea culpa
22:02jamesnvcThanks for the link :D
22:02gnuvince_Is it possible with to-array to specify the type of array?
22:02hiredman,(doc to-array)
22:02clojurebot"([coll]); Returns an array of Objects containing the contents of coll, which can be any Collection. Maps to java.util.Collection.toArray()."
22:02Chouseryou could also use (ns foo (:import ...)) in which case you don't need to quote the args
22:03hiredman,(doc make-array)
22:03clojurebot"([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."
22:03Chouser(doc into-array)
22:03clojurebotReturns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([aseq] [type aseq])
22:03hiredman^- that is what i meant
22:06gnuvince_Chouser: thanks
22:18AzmodanI have a seq with data that fit a predicate function and other data that doesn't. I want to split it into two. Is there a more effective way than to use filter twice?
22:19Carkhow about using reduce ?
22:21gnuvince_,(require '[clojure.contrib.seq-utils :as seq-utils])
22:21clojurebotnil
22:21gnuvince_,(seq-utils/partition odd? [1 2 3 4])
22:21clojurebotjava.lang.Exception: No such var: seq-utils/partition
22:21AzmodanCark: That'd give me only one value in the end.
22:22gnuvince_,(seq-utils/separate odd? [1 2 3 4])
22:22clojurebot[(1 3) (2 4)]
22:22gnuvince_Azmodan: behold
22:22AzmodanOooh. Nifty :)
22:23AzmodanWhere's the contrib api webpage?
22:23Cark,(reduce (fn [[left right] item] (if (odd? item) [(conj left item) right] [left (conj right item)])) [[] []] '(1 2 3 4 5 6))
22:23clojurebot[[1 3 5] [2 4 6]]
22:23Carkbut yeah using the contrib might be easier =P
22:25gnuvince_,clojure contrib?
22:25Carknow for extra credit, do a lazy version =/
22:25gnuvince_,contrib?
22:25gnuvince_meh
22:26gnuvince_Azmodan: http://code.google.com/p/clojure-contrib/
22:26Carkclojurebot: contrib?
22:26clojurebotcontrib is http://code.google.com/p/clojure-contrib/
22:26gnuvince_ah
22:27Carkhum the contrib separate is doing 2 filters =P
22:28hiredmanAzmodan: the "one value" reduce gives you at the end can be a vector, or whatever
22:34gnuvince_Weird problem guys
22:34gnuvince_(defn null-string [buf len] (reduce #(conj %1 (.getByte buf)) [] (range len)))
22:35gnuvince_When I call this with (null-string abuf 10), I get an error that I am passing the wrong number of parameters
22:35gnuvince_Bug?
22:35hiredmanyou are passing the wrong number of args to the #()
22:35gnuvince_how so?
22:36Cark,(doc reduce)
22:36clojurebot"([f coll] [f val coll]); f 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, return
22:36gnuvince_I absolutely need to refer to %2?
22:36hiredmanunless the #() has a %2 in it, it only expects 1 arg
22:36Carkf should be a function of 2 arguments
22:36hiredmanyes
22:36hiredmanclojurebot: #()?
22:36clojurebot#() is not a replacement for fn
22:36gnuvince_ok
22:37gnuvince_Switching to a fn works
22:37gnuvince_Thanks
22:37yangsxHas anyone defined with-open-file aka CL in Clojure?
22:37Cark,(doc with-open)
22:37clojurebot"([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."
22:37Chouseror #(do %2 (conj ...)) ...but that's kinda gross
22:37Carknot quite the same though
22:37gnuvince_Chouser: I'd rather use (fn [acc _] ...)
22:37Chousergnuvince_: yeah
22:37Chousergood
22:38yangsxCark: It seems to me with-open is more like unwind-protect
22:38Carknot quite, it calls a close method on the bound objects
22:38Carkusually streams
22:39hiredman#(conj (K %2 %) (.getByte buf))
22:39AzmodanCan you tell me why this function gives me a stackoverflow: http://paste.pocoo.org/show/100929/
22:39hiredmanbut clojure.core does not have K
22:39hiredmanoh
22:39hiredmandamn
22:40hiredman#(conj ((K %2) %) (.getByte buf))
22:40Carkyangsx : (with-open [stream (FileReader. "~/test.txt")] (dosomething))
22:40hiredmanstill wrong, forget it
22:40hiredmanAzmodan: you need '() not ()
22:41hiredmanI think
22:41hiredman,((? [] ()))
22:41clojurebotjava.lang.Exception: Unable to resolve symbol: ? in this context
22:41hiredman,((fn [] ()))
22:41clojurebot()
22:42hiredman,(conj ((fn [] ())) :a)
22:42clojurebot(:a)
22:42hiredmanguess not
22:42ChouserAzmodan: there's no termination case for your recursion
22:43AzmodanChouser: I thought the ([] ()) part was my termination case.
22:43Chouserah, I see. that will be called if you call (qsort), that is with no args
22:44Azmodanoops... I see my mistake.
22:44Chouserbut if you pass in an empty coll, it still calls your main body
22:45AzmodanYeah, I was thinking Haskell-like I guess.
22:45AzmodanI'll change that to an if.
22:45Chouseror a when
22:45yangsxCark: thanks, I need output to file. BTW, I felt programming in Clojure so far requires intimate knowledge of Java, sometimes a block to people like me from CL (instead of Java)
22:46Carkyangx : i'm coming from cl as well, java is a royal pain =P, but the docs are good
22:46AzmodanThanks
22:46gnuvince_hmmm
22:47Chouseryangsx: knowledge of the Java libs more than Java itself I think
22:47Carkright
22:47gnuvince_Anyone knows why (java.nio.ByteBuffer/wrap (into-array Byte/TYPE (map byte [1,2,3]))) returns a java.nio.HeapByteBuffer instead of a java.nio.ByteBuffer?
22:47WizardofWestmarcwell you need to know about stuff like classpath too
22:47Chouserand the file io stuff is particularly more complicated than necessary.
22:48Chouseryangsx: I like clojure.contrib.duck-streams
22:48Carkchouser : i don't think so
22:48Carkit allows to fine tune for exactly what you want
22:48ChouserCark: "it"?
22:48Carkthe io stuff
22:49Carkstreams
22:49Chouseroh
22:49yangsxChouser: I have attemped to use write-lines, but found it not as general as with-open-file for IO stuff
22:50Chouseryangsx: hm... I believe we may have had this conversation before.
22:53yangsxChouser: rant about java, yes; but not with-open-file
22:55Chouseranyway, you can pick -- duck-streams often does what you want with very little effort. If you want effort, combine java classes to your hearts content.
22:56Carkaint that pretty ? (with-open [reader (-> filename FileInputStream. (event-input-stream callback) InputStreamReader. BufferedReader.)])
22:57Carkthat's from my csv-import dialog =P
22:57jbondesonany way to get compile to give me a little more information? it's saying "ClassNotFoundException" and pointing to a like that only has "dosync" on it...
22:57yangsxChouser: yes, that's the way to go so far. I asked just in case someone has met and solved the same problem.
22:58jbondesonand naturally the class name is a generated one
22:58hiredmangnuvince_: the javadoc for ByteBuffer seems to indicate it is an abstract class
22:59jbondesonand naturally it works in the repl
23:00hiredmando you have ./classes/ in your classpath?
23:00hiredmanis the namespace you are compiling in your classpath?
23:01gnuvince_hiredman: an abstract class is one that can have no instances, only concrete subclasses, right?
23:01hiredmangnuvince_: that sounds right
23:03jbondeson./classes/ may not be.
23:04hiredmanclojurebot: compiling?
23:04clojurebotNo entiendo
23:04hiredmanclojurebot: compie?
23:04clojurebotexcusez-moi
23:04hiredmanclojurebot: compile?
23:04clojurebotI don't understand.
23:05hiredmanhttp://clojure.org/compilation
23:06jbondesonand still getting it =/
23:07hiredmanwhat is the exact error
23:07jbondesonjava.lang.RuntimeException: java.lang.ClassNotFoundException: messenger.core$push_message__98$fn__100$fn__102 (core.clj:23)
23:08jbondesonit looks like the first anonymous function
23:08hiredmaninteresting
23:09hiredmanwhat is the value of *compile-path
23:09hiredmanwhat is the value of *compile-path*
23:09jbondesonclasses, but i'm rooted in the correct directory
23:09hiredmanhow are you starting clojure?
23:10jbondesonbatch file right now, had the same error in emacs/slime though
23:11hiredmangive me the exact line you use to start clojure
23:11hiredmanman
23:12hiredmanpulling teeth like this I could have been a dentist
23:12lisppaste8jbondeson pasted "startup" at http://paste.lisp.org/display/74065
23:13hiredman./classes/ is not in your classpath
23:13jbondesondid an add-classpath
23:14jbondesonhowever, i can try to explicitly set it
23:14cataskadoes anyone tried clojure on android ?
23:14hiredmanjbondeson: add-classpath is bad, avoid it
23:14Chousercataska: yep, there's been a "hello world" app
23:15cataskaChouser: links, pls :)
23:15hiredmanclojurebot: add-classpath is bad, avoid it. I mean it!
23:15clojurebot'Sea, mhuise.
23:15jbondesonavoiding away!
23:16cataskaso clojure must generate dalvik byte-code ?
23:16hiredmanI imagine it uses clojure's AOT to generate class files and then you run the converter to dalvik byte-code
23:17Chousercataska: no, clojure generates JVM bytecode in .class files, and then the normal android toolchain takes over
23:17Chouserhiredman: right
23:17cataskaok i c
23:18cataskaany links ?
23:18Chouserpatience, grasshopper
23:18cataska:)
23:20hiredman~add-classpath
23:20clojurebotclasspath is (System/getProperty "java.class.path")
23:20hiredmanhmmm
23:21Chouserwell this is unsatisfying: http://clojure-log.n01se.net/date/2009-01-05.html#10:39
23:21jbondesontheeere we go.
23:21jbondesonthanks hiredman
23:22cataskahmm
23:25cataskai recall there is a clojure on android project on github
23:25cataskabut i can't remember it ...
23:26Chouserhere you go: http://clojure-log.n01se.net/date/2008-12-30.html#13:24
23:26teHow do I get emacs to do clojure syntax highlighting?
23:26teIs there a package or something?
23:26cataskaChouser: yes it is, thx
23:28hiredman~add-classpath
23:28hiredmandamn
23:29hiredman~add-classpath
23:31cataskate: http://bc.tech.coop/blog/081118.html
23:34hiredman~add-classpath
23:34clojurebotadd-classpath is bad, avoid it. I mean it!
23:35hiredman~logs
23:35clojurebotlogs is http://clojure-log.n01se.net/
23:35hiredmanexcellent
23:35durka42nice
23:36durka42can i request a feature?
23:36durka42or i could have a crack at implementing it myself
23:37hiredmaneither one
23:37durka42i want to say clojurebot: tell hiredman not to make the robot too smart
23:37durka42and if you were not here, it would tell you when you came in the room -- if you were here, when you come back from away or talk
23:37durka42clojurebot: where are you?
23:37clojurebothttp://github.com/hiredman/clojurebot/tree/master
23:44durka42is botattrs just a map?
23:46hiredmanyes
23:46durka42something like this? (run-clojurebot "cbtest" {:network "irc.freenode.net" :channel "cbtest" :nick "cb"}
23:46durka42)
23:46hiredmanthere is a sample in the clojurebot.clj
23:46durka42oh, so there is
23:47cooldude127i posted on the google group asking if my date library could be included in clojure-contrib, voice your opinion: http://groups.google.com/group/clojure/browse_thread/thread/ba0333c5aae2eda5
23:47cooldude127</self-marketing>
23:47durka42broken link?
23:48cooldude127works for me, do google groups links not transfer?
23:48Chousercooldude127: I haven't looked at your code yet at all. I'll try to tomorrow.
23:48durka42it worked the second time :-\
23:48cooldude127Chouser: cool, thank you
23:48cooldude127durka42: weird
23:48Chousercooldude127: you do have to have your CA turned in before your code can be put in clojure-contrib
23:49cooldude127Chouser: what?
23:49Chouserhttp://clojure.org/contributing
23:49durka42cooldude127: i have to say i am disappointed with the changed tone of the docstrings :-p
23:49cooldude127haha
23:50dreishLet's follow the Perl model and have hundreds and hundreds of different incompatible date libraries.
23:50cooldude127Chouser: ok i see
23:50cooldude127dreish: exactly why i want it in contrib. i think we should have a standard one, so others can work on this and have it be official
23:51Chousercooldude127: if you don't mention on the google group thread that you're sending it in, others will probably remind you as well. :-)
23:52cooldude127Chouser-away: done
23:53cooldude127Chouser-away: is that supposed to indicate you being away or being some kind of superhero who must go now?