#clojure logs

2009-03-12

00:06RaynesMec: Why would you do such a thing to learn Clojure. No body does that shit in real life. :|
00:06Mecboredom
00:06cooldude127these vimclojure rainbow parentheses are really trippy
00:07RaynesMec: Same reason I did the first problem last night :D
00:07RaynesMec: Could I see your implementation of Problem 1?
00:09durka42you guys should use the wiki
00:11durka42~euler
00:11clojureboteuler is http://clojure-euler.wikispaces.com/
00:11cooldude127interesting
00:12Raynes,(time (rem 3 3))
00:12clojurebot0
00:12clojurebot"Elapsed time: 0.121 msecs"
00:12Raynes,(time (mod 3 3))
00:12clojurebot0
00:12clojurebot"Elapsed time: 0.152 msecs"
00:12RaynesMec: ^
00:12RaynesIn this case, rem wins by a hair.
00:13Meclol
00:13durka42that's a thin hair
00:13RaynesA very thin hair.
00:13Mec,(time (rem 23523 235))
00:13clojurebot23
00:13clojurebot"Elapsed time: 0.115 msecs"
00:13durka42it would be hard to split that hair
00:13cooldude127less time?
00:13Mec,(time (mod 23523 235))
00:13clojurebot23
00:13clojurebot"Elapsed time: 0.158 msecs"
00:13RaynesRem wins!
00:13RaynesWeeee
00:13Mecso it is
00:14Meci dunno why but when i see rem i dont think remainder
00:14cooldude127remove?
00:14Mecya
00:14Raynes(doc remove)
00:14clojurebotReturns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects.; arglists ([pred coll])
00:14durka42i mean, you would expect rem to win. mod calls rem and then does some checks
00:14cooldude127what kind of checks?
00:14Mecso is remove the opposite of filter?
00:14Raynescooldude127: Cooldude checks.
00:14cooldude127lol
00:14cooldude127Mec: i think so
00:15durka42whether it should switch the sign
00:15durka42~source omd
00:15durka42~source mod
00:15cooldude127,(rem -3 3)
00:15clojurebot0
00:15cooldude127,(rem -3 2)
00:15clojurebot-1
00:15Raynes~source remove
00:15cooldude127,(mod -3 2)
00:15clojurebot1
00:15durka42,(mod -3 2)
00:15cooldude127oh i see
00:15clojurebot1
00:15durka42there's a discussion somewhere
00:15Raynes~source filter
00:16cooldude127so basically if you know the sign is gonna be positive or you don't care, you should use rem?
00:16Raynesdurka42: Stop being smarter than me.
00:16RaynesFilter is defined directly above remove. Should of looked.
00:17cmvkknow now, what is the clojurebot even for then?
00:17cmvkkafter all, you could just open your own copy of core.clj and do a search.
00:17RaynesMec: remove calls filter and complements the predicate to do the opposite of what filter normally does.
00:17Raynes,(complement true)
00:17clojurebot#<core$complement__3478$fn__3480 clojure.core$complement__3478$fn__3480@189acb5>
00:18RaynesO.O
00:18cmvkkheh
00:18cooldude127cmvkk: don't you know some people here don't even use their own repl? they just use clojurebot
00:18Mec,((complement true))
00:18clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
00:18Mecmeh
00:18durka42,((complement true) (= 42 42))
00:18Mecim stuck on this lcm problem :x
00:18clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
00:18durka42oh, duh
00:18cooldude127complement needs a function
00:18cooldude127:)
00:18durka42,((complement =) 42 42)
00:18clojurebotfalse
00:18RaynesOh duh.
00:19replacaI have a weakness for absurdly complex constructions that show the obvious:
00:19replaca,(map count (map #(.getParameterTypes %) (filter #(= (.getName %) "invoke") (.getMethods clojure.lang.IFn))))
00:19clojurebot(1 2 3 4 5 6 7 8 9 10 0 12 13 14 15 16 17 18 19 20 21 11)
00:19cooldude127haha
00:20cooldude127the ordering there is kinda odd
00:20replacainteresting, clojurebot gets a different order than my REPL
00:20replacamy REPL shows 0 to 21 in order
00:20durka42mine too
00:20cmvkkif you keep going, will it do (... 32 22 ...) ?
00:21replacamaybe clojurebot is on a different Java or clojure version
00:21lisppaste8Rayne annotated #76793 "fixed towers-of-hanoi to take large input - abuses trampoline" at http://paste.lisp.org/display/76793#2
00:21replacano, that's all there are
00:21replacait's all the arities of invoke
00:21cmvkkoh
00:21replacaor "the 22 names of IFn"
00:21replaca:) brb
00:21cmvkkwait, is that how multiple arities are done? by creating a possibility for every single arity?
00:22Mecyup
00:22cooldude127replaca: i get the same order as clojurebot
00:22durka42Raynes: trampoline AND recur?
00:22durka42the mind boggles
00:22cooldude127cmvkk: up to a point. then it uses a varargs one
00:22cmvkkand what's the ceiling on that?
00:22cmvkki want to make a function with a thousand arguments.
00:22Mecreplaca: what does that do?
00:23cooldude127cmvkk: you can
00:23durka42Raynes: wait, does that work. i would think the do throws away the #()
00:23Raynesdurka42: I would of had to redesign the whole thing to use a loop .. recur so I just trampolined the bitch.
00:23RaynesWorks great.
00:23cmvkkcan i make one with a hundred billion arguments?
00:23RaynesTested it with 10000 discs.
00:23cmvkkmemory permitting
00:23cooldude127cmvkk: technically nothing stopping you
00:23cmvkkexcellent.
00:24cooldude127cmvkk: the first twenty are just an optimization
00:24cmvkki don't want it to package the args as a vector behind the scenes either.
00:24cmvkkevery argument gets its own special place on the stack.
00:24durka42Raynes: the #() does nothing
00:25durka42,(do 1 2 3)
00:25clojurebot3
00:25cooldude127cmvkk: oh, then probably not
00:25cmvkk:(
00:26cooldude127cmvkk: clojure functions are java objects, so unless you define 100 billion versions of invoke, you're going to resort to an array at some point
00:26durka42The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification.
00:26durka42you can always use apply
00:27RaynesOh... I never actually /tested/ to see if the output was correct...
00:27RaynesFuck.
00:27cmvkktime to calculate how much disk space I would need to store a clojure file with a function definition of arity 100-billion.
00:27durka42well, i don't know if it's correct
00:27durka42but it's the same without the closure
00:28RaynesI'm not sure how to convert it to a loop and recur, and I really don't feel like thinking about it right now so I'll save this one for later :\
00:30cooldude127yay for putting things off!
00:31RaynesThere should totally be a recur for non-tail recursion.
00:31cooldude127Raynes: isn't that what just calling the function is?
00:31Raynescooldude127: Yes, but I needs the optimization. Damn you JVM.
00:32cooldude127Raynes: what would be optimized there? if it's not tail?
00:32RaynesIt still blows the stack. Like I said, I need to rewrite it to use a loop-recur.
00:32cooldude127yeah probably
00:33Raynescooldude127: In case you didn't notice I was joking about the recur for non-tail recursion :p
00:33cooldude127Raynes: oh my bad lol
00:33RaynesAnd not probably, it's certainly. Unless I'm missing something.
00:33cooldude127yeah that's correct. i've been spending too much time in java world
00:34RaynesThis would be so easy with TCO.
00:34cooldude127Raynes: without TCO, you should just be able to replace the tail call with recur and be done
00:37replacaok, back
00:38replacaMec: it shows all the different numbers of arguments that you get with invoke
00:38replacabut as cooldude127 points out, it does more via varargs
00:38Mecright, i saw that in the java file and was wondering why he hard coded so many
00:39replacaI think he may compile directly to them for common cases
00:39replacaso he doesn't have to choose the method at runtime and doesn't have to "box/unbox" into an array
00:40cooldude127yeah since function calls are pretty common, it was a good idea to optimize that
00:41replacaesp. in a language that encourages composing lots of small funcs & first order operations
00:41cooldude127yes
00:50Mecis the list for returns lazy?
00:50replacamec: I don't understand
00:51durka42(doc for)
00:51clojurebotList comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test. (take 100 (for [x (range 1
00:51durka42yes
00:51Mecok goodie
00:52replacaoh, I completely mis-parsed that sentence :-)
00:52Mecya i couldnt rephrase any better
01:08cmvkkwhy is it that every time i go "it'll be quick and easy to make a framework to do this, it'll take hardly any code at all!"
01:08cmvkki end up with these ridiculously complicated macros
01:11durka42heh
01:11durka42famous last words
02:13Mecwhat's the java squareroot function?
02:15Mecshouldnt it be Math/sqrt?
02:15hiredmanMath/sqrt
02:15hiredmanYes
02:15Mecweird it works but you cant call it to see if it is something
02:15Mec,Math/sqrt
02:15clojurebotjava.lang.Exception: No such namespace: Math
02:18hiredmanbecause it is not a clojure fn, or symbol
02:18hiredmanit is java
02:18hiredman,(marcoexpand '(Math/sqrt 5))
02:18clojurebotjava.lang.Exception: Unable to resolve symbol: marcoexpand in this context
02:19hiredman,(macroexpand '(Math/sqrt 5))
02:19clojurebot(. Math sqrt 5)
02:19Meci see
02:27bradbevhas it always been the case that refs to maps/vectors/sets don't need de-refing? ((ref {:a 0 :b 1}) :b) => 1
02:28cmvkkweird.
02:28cmvkkif you do it backwards, using the keyword as a key, it doesn't work.
02:28bradbevyeah, I tried that too :)
02:39RaynesWhy is it that this http://paste.pocoo.org/show/107524/ will blow the stack if given big input (I understand that it's because the stackoverflows) but an implementation written in Scheme which calls itself at a non-tail position doesn't? Is it something to do with the JVM stack being smaller or something?
02:39Raynesstack overflows*
02:44cmvkkif it's called in a non-tail position, it's going to use up stack space, even in the scheme version.
02:44cmvkk(i guess, anyway)
02:45cmvkkyou should be able to find a large enough value to blow the stack in the scheme version too.
02:46Raynescmvkk: I knew that. I just got tired of waiting on the scheme version to run out of stack space. In Clojure it happens in about 6 seconds. That's what lead me to ask the question.
02:47cmvkkwhat, how long did you wait for the scheme version to do it?
02:47RaynesAbout 2 1/2 minutes with a value of 10000 with the same algorithm.
02:47RaynesI run out of patience fast.
02:47Raynes:|
02:47cmvkkheh
02:51Raynescmvkk: The reason is I've been thinking about it, is I believe it's better to just let it blow the stack when needed than try to make it otherwise. The algorithm I used is a very Lispy algorithm. It's not like anyone will actually use it anyways.
02:52cmvkksure; towers of hanoi doesn't need to be practical.
02:52RaynesAgreed.
02:53cmvkkon the flip side, though, it never hurts to have experience transforming recursive algorithms into a tail configuration
02:55RaynesI've never seen a tail algorithm of towers of hanoi done before.
02:55cmvkki assume it's possible;
02:55RaynesMay be, but I don't intend to be the one to find out ;) not at this level of experience anyways.
02:56RaynesI added my Clojure implementation here. http://www.rosettacode.org/wiki/Towers_of_Hanoi#Clojure If anyone comes up with something better, feel free to add it.
02:56Carkthat algorithm is imperative, might be interesting to have it return a data structure with all moves instead
02:57Carkyou could then try to make it tail recursive
02:57RaynesCark: I intend to try to get that done tomorrow. I saw a pure Haskell version that did that.
02:58RaynesNight guys. Thanks for the help :)
02:59Carkgoodnight
06:29djpowellhow do you make a gen-class method that returns void?
06:33djpowell#^{:static true}[runInitScript [] java.lang.Void] doesn't work - it literally returns java.lang.Void; nil doesn't work as the return type either
06:34djpowellah, just 'void' on its own seems to do it
06:38karmazillaheh, it was one of those "nah, that's too easy. Let's try something else" :)
06:54AWizzArdclojurebot: max people
06:54clojurebotmax people is 158
06:54AWizzArdAha, again 2 more.
07:00AWizzArdDoes Windows CE run a full JRE? (so, it can run Clojure)
07:05djpowellProbably not
07:06djpowellWindows CE is like some sort of meta-OS, where for different applications, different things are compiled in. So smartphones, get less than PDAs, and there are some higher-end builds that are very windows like
07:07djpowellBut as microsoft doesn't support its old JVM anymore then I doubt there will be one built in to any version of CE
07:08djpowellI think there are 3rd party JVMs, but I have a feeling that they won't be very up to date, and you probably have to pay for them
07:12AWizzArdI see
07:12AWizzArdSo much about "write once, run anywhere".
07:17djpowellMost phones have J2ME, but it would be a lot of work to get clojure to run on it. The class libraries are tiny, even the Collection classes aren't included.
07:19AWizzArdI would like to target Windows CE. And I guess it would need a full JRE to support Clojure.
07:42djpowellAnyone using *use_context_classloader*?
07:43djpowellI'm not entirely convinced it is working properly. Seems to work for my AOT classes, but if I had a script to the classpath it seems to fail to load functions that it defines
07:46djpoweller I mean, *use-context-classloader*
07:51Lau_of_DKHey guys
07:51Lau_of_DK2 things, any update on Tony Morris, and any compojure gents in here?
07:55karmazillaI have not heard anything new on Tony since last night. I think #scala is place to ask.
07:56Lau_of_DKk
07:56Lau_of_DKCompojure any1?
08:16Lau_of_DKin Compojure, if I go with (defservlet serv (GET "/:action" (... (route :action))) then I can pass that to a function, which can read params like //localhost/param1=10&param2=20, but this doesnt fly well with forms who GET values, because they are prepended with ?, so //localhost/?param1=10&param2=20, how do I trap that ?
08:44karmazillaLau_of_DK: http://twitter.com/DRMacIver
08:52Lau_of_DKShameful behaviour, that some people would use such an event as grounds for jokes
10:01tbbhi all, i have a quick question
10:02tbbis there a way to retrieve the argument list of a function? so for example: (get-arguments list?) -> (x)
10:02gnuvincesee the meta data
10:02gnuvince,(meta list?)
10:02clojurebotnil
10:03gnuvince,(meta #'list?)
10:03clojurebot{:ns #<Namespace clojure.core>, :name list?, :file "core.clj", :line 3787, :arglists ([x]), :doc "Returns true if x implements IPersistentList"}
10:03tbbah! very cool
10:03tbbthank you :)
10:10pjstadigCLABANGO!
10:10cooldude127WOOO
10:15cooldude127does nobody have any clojure problems? has the language become perfect?
10:16pjstadigclojure is a futuristic ninja robot
10:16pjstadigwhat more could you want?
10:16cooldude127lol
10:18Drakesonis there a clojurey way to fetch a file over http (with sending POST data along with the request)
10:19cooldude127i actually have a question: why do objects made with proxy wrap up their toString methods with #<Object$Associative$IFn 2009-03-11 00:00:00>
10:19cooldude127like in that example the date part is all that toString makes, the rest is added automatically
10:25Chousercooldude127: that's not proxy, is it? It's the default print-method
10:25Chouser,(java.util.Date.)
10:25clojurebot#<Date Thu Mar 12 07:27:43 PDT 2009>
10:25Chouserit's #<ClassName toString-output>
10:26cooldude127o rly?
10:26Chouserif you call str or toString on the proxy object itself, you may see what you expect.
10:26cooldude127oh ok
10:27cooldude127it's just so ugly with proxies
10:27cooldude127cuz you get object + every interface they implement
10:27cooldude127is gen-interface the only way around that?
10:27Chouserright, proxy classes have big ugly names.
10:29cooldude127:(
10:29cooldude127even gen-interface would only make that Object$ChronoDate
10:30cooldude127proxies suck (and rule at the same time)
10:30ChouserI expect there will be something eventually like proxy but which can take a class name for the class to create.
10:31cooldude127that would be nice
10:31ChouserI also expect it to allow access to protected fields
11:02Mecrecurs on both branches of if should count as tail recursion right?
11:02Drakesonis there a function like `doc' in the repl that takes me to the source its argument (not just the documentation)
11:02Drakeson?
11:05ChouserMec: yes
11:05ChouserDrakeson: clojure.contrib.repl-utils/source
11:09DrakesonChouser: cool, thanks
11:18Mecany library function that tells you what position an item is in a seq
11:19Chousera set or map is faster and more convenient than searching a seq in almost every use case.
11:19Chouserhowever, if you're sure you want to linearly walk through a seq looking for a value, try 'some'
11:20Chouserhm, thought that won't give you the index.
11:20Chouserthough
11:20leafwChouser: sure, but I had a need for an "index-of" as well in numerous occasions. I wish there was a tree-map that autoupdated its numbers to be always naturals, starting at 0.
11:20Chouser,(.indexOf '(a b c d e f) 'c)
11:20clojurebot2
11:21leafwChouser: is that efficient for very large lists?
11:21leafwthat's not a map.
11:21kotarak,(first (some #(= (% 1) 2) (map #(vector %1 %2) (iterate inc 0) (list 1 2 3 4 5))))
11:21clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Boolean
11:21Chouserno, it's a linear search. Don't use it. :-)
11:21kotarak-.- silly me
11:22Mecwell I'm mapping over (range 1000000) and I need to find the max value and then the position (starting number) for it, maybe there is a better way
11:23Drakesonwill this form be supported? : (defn foo ([#^type1 x] (do-something x)) ([#^type2 x] (do-something-else x)))
11:23Meci suppose i could just loop instead of map
11:23ChouserDrakeson: It isn't now, and I wouldn't expect it to be anytime soon.
11:24kotarakMec: Maybe reduce? You walk the whole range anyway to get the maximum value.
11:24Drakesonso we have to write multiple dispatched "by hand", now?
11:24Meci need to know at what position the max value occurs tho
11:24ChouserDrakeson: if you want to dispatch on type, look at multimethods
11:25ChouserDrakeson: or use and 'if', whichever makes sense for the case at hand.
11:25cooldude127if you want to dispatch on any number of things, use multimethods
11:27kotarakMec: (first (reduce (fn [[pos cur-pos last-max] v] (if (< last-max v) [cur-pos (inc cur-pos) v] [pos (inc cur-pos) last-max])) your-seq)), ugly but should work, no?
11:27kotarakoops the [0 0 0] init is missing.
11:27Mecthat just hurts to look at this early in the morning
11:28kotarakas I said: ugly
11:28DrakesonChouser: I am thinking of a multi-dispatch slurp. currently slurp only reads from a file. it could read from InputStream, url, etc.
11:30ChouserDrakeson: sure. have you looked at clojure.contrib.duck-streams?
11:30Meci just did it as a loop instead of map and kept track of the highest value and index ;p
11:30cooldude127that's probably how i would have done it
11:32cooldude127loop is my friend
11:32Mecwhen i write loops they always seem inelegant
11:33Mecis there a clojure pasty site?
11:33cooldude127~lisppaste
11:33clojurebotNo entiendo
11:33Chousersometimes loops are the most elegant solution available
11:33cooldude127lisppaste8: url?
11:33lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:33DrakesonChouser: wow, thanks.
11:33kotarakMost of the time I write a loop, stare at it for 2hours and then it suddenly turns into a map or recur, which us half as long and twice as elegant.
11:34Chouseron the other hand, indexes seem generally inelegant to me these days.
11:34kotarakreduce instead of recur
11:34cooldude127i use loops a lot when i have something that would almost work for reduce, except i don't have a sequence to work on at the start
11:34cooldude127i just have some data and i know when i'm finished
11:34Chousercooldude127: yes. and in such cases 'iterate' will sometimes work but can make things really messy.
11:35cooldude127i have yet to use iterate for anything yet. maybe it would help in some cases, but really loop/recur is doing quite well for me
11:35kotarakFirst I had problems, when reduce should stop somewhere in the middle of the seq. Then I had the idea of (reduce ... (take-while ....))... Many loops killed. :)
11:35lisppaste8mec pasted "random loop" at http://paste.lisp.org/display/76898
11:35Mecoo nifty
11:36cooldude127Mec: i actually think max-key would be helpful here
11:37Meci can't tell what it does from the discription
11:38cooldude127Mec: it does a max, but based on a function called on the data, rather than the actual value
11:38Mechmm
11:39cooldude127Mec: if you did a map to turn [a b c] into [[0 a] [1 b] [2 c]]
11:39Mecso (apply max-keys f (range 1 1000000))
11:39cooldude127not quite i think
11:39cooldude127well yeah
11:40cooldude127but after you attach indices
11:40rzezeskiCan anyone tell me why gen-class allows me to specify the type sig of a method (e.g. [foo [Object] void]), and then pass said method an instance of class Bar which has method fubar, and then inside the impl-fn I can call fubar on the argument (e.g. (defn -foo [obj] (.fubar obj)) )
11:41Meco dont even have to do that, it still works
11:41Chouser, (let [most #(if (pos? (compare % %2)) % %2)] (reduce most (map vector (map #(* 2 %) (range 100)) (iterate inc 0))))
11:41clojurebot[198 99]
11:42Meci need to look at the implemenation of max-keys, its pretty nifty
11:43Mecnot sure if it's faster than my loop tho, it's taking a while
11:43Chouserrzezeski: Clojure will do reflection at runtime if needed to make such things work.
11:43rzezeskiIf I did the same in Java, I would get a compiler error unless I either cast the object or modify the type signature. I'm guessing this has something to do with the way Clojure calls back into Java?
11:44ChouserAnytime you say (.fubar obj x y), it will at compile time try to figure out which method fubar you mean.
11:44rzezeskiSo basically, you can uses Object in gen-class as a catch-all, but still call the methods specific to that class/instance
11:45Chouserif it knows (or is told via type hints) at compile time the class of obj, and can find a method that matches the arity and types of the args, it will emit bytecode that assumes that particular method.
11:45Chouserthis is independant of gen-class.
11:46Chouserbut if it can't find exactly one method that matches at compile time, it will emit code that checks at runtime for the fubar method of whatever obj actually is, and calls that.
11:46Chouserthis latter case is substantially slower at runtime than the former.
11:47Mecoo max-key used like that calls f twice on everything, not so good then
11:50rzezeskiok, lets say I'm actually passing the AOT-ed class a String, but in the gen-class method I declare it as type Object. If I understand you correctly it will emit bytecode that uses reflection to find the correct method? However, if I change the type to String (in the gen-class method declaration), it will emit bytecode that directly calls the method? Or do I also have to type hint the impl-fn?
11:51sohailOT: any news on this tony morris guy
11:51Chouseryou'd probably have to type-hint the arg in the impl-fn. To find out for sure, try it with (set! *warn-on-reflection* true)
11:52Chouserwith that on, anytime reflection code is emitted at compile time, it'll warn you.
11:53rzezeskicrap, I gotta run, thx for the help Chris
11:53Chouserrzezeski: np
12:04Mecis (count string) O(1)?
12:05cgrandMec: yes
12:05Mecexcelent
12:06kefkaIs it bad form or dangerous to have a ref to something mutable, e.g. a ref to a map whose values are refs?
12:07cooldude127first person to suggest using clojure as my java repl gets a sharp stick in the eye
12:07kotarakcooldude127: beanshell?
12:08Mecyou could implement java in clojure and then have a java repl ;p
12:10Chouserkefka: that's not necessarily bad
12:12kefkaChouser: Ok, because what I'm looking for is a map of refs/pointers so that I can synchronously change individual pointers without locking down the whole map
12:13kefkaChouser: So, thinking about it, is the right approach to make the map an atom and the values refs?
12:24walterscooldude127: i use groovy for that
12:26cooldude127walters: groovy has a repl?
12:27walterscooldude127: yeah, there's a console one and a swing one; and this shell i'm very slowly developing also uses groovy
12:27cooldude127hmm. the problem i had with beanshell was getting my java code to run inside
12:27Chouserkefka: will you want to coordinate changes to multiple sub-maps at the same time?
12:29fogusI think all the real-time tweets about Rich's persistent datastructures presentation broke Twitter.
12:29Chousukeis there a video of it already available somewhere?
12:31fogusNot that i'm aware of
12:31fogusFrom the tweets it appears to have just happened
12:32kotarakI hope there will a video or a podcast of some sort.
12:35replacatoday was Rich's second talk
12:35replacahe gave a Clojure overview yesterday
12:35replacaand is talking about functional data structures today
12:36replacaI assume there will be video up - I've seen lots of videos from past QCONs online
12:36AWizzArdsounds nice
12:36AWizzArdfogus: link?
12:37fogusI was just joking about breaking Twitter. But there has been a lot of buzz flying around about Clojure after his two talks. http://search.twitter.com/search?q=clojure
12:39leafware the talks online somewhere?
12:40replacaThere's been a lot of mainstream media attention on twitter the last few weeks. I bet their usage is *way* up. So it's back to the fail whale :-).
12:41leafwtwitter needs a sugar daddy, aka google, who sees value in all the information flying within twitter.
12:41defnI don't think the information twitter produces is even remotely valuable.
12:41defn:X
12:41fogusI'm not aware of any qcon content available yet, but the likely place to look is at http://www.infoq.com/qcon/
12:42defnIt's like a place for all of the incomplete garbage text to live
12:42defna lot of investors obviously disagree with me
12:42fogusdefn: I think it is highly valuable to know what Charles Nutter is eating for lunch.
12:42fogus:p
12:42defnbut i think its just too novel to be useful
12:42defnfogus: hehe
12:43leafwdefn: human relationships and the study of motivation and information encoding and transmission; there's the value.
12:43djpowellwhat is the best way to remove an element from a set?
12:43defnleafw: yeah i can definitely see that, but i just dont know if you get a valuable assessment of motivation,relationships
12:44defnthe latter point you make is certainly worth developign though
12:44defndeveloping*
12:44djpowell - ah 'disj' - I was looking for something in clojure.set
12:51replacatwitter just raised $35M. I don't think money's their problem. But they keep going through crazy growth spurts.
12:53fogusdjpowell: (clojure.set/difference #{:a :b :c} #{:a}) ?
12:59defndanlarkin: Needs moar Clabango.
13:01fogusdoes anyone recall the link to the recent (within 1-2 weeks) thread about the -> macro?
13:02fogusdoing a search for -> is less than helpful
13:02replacafogus: you mean with ?-> for doing nil short-circuiting?
13:02hiredmanhe means on the google group
13:03replacayeah, that was both here and there
13:03hiredmanI see a few "best presentation ever" in reference to rhickey's qcon talk
13:04fogusreplaca: possibly, I was hoping to pick the thread up again
13:04replacahiredman: one of Clojure's big advantages is that rhickey is a very compelling presenter. I definitely got hooked on the Clojure for Lisp programmers podcast
13:04foguswhat I recall was that there were a few excellent simple explanantions about what -> does
13:04fogusI'm trying to explain it to a co-worker, but cannot find the words
13:05hiredmanit expands into itsself
13:06replacafogus: yeah, I was thinking of a different thread, sorry
13:06hiredman(-> a b c) becomes (-> (b a) c) becomes (c (b a))
13:06hiredman"threading operator"
13:07fogusthat's one of those explanations that makes sense only if you already know what it means. ;)
13:07fogusBut it's still better than what I can come up with
13:10hiredmanI think the best way might be to write out an expression using (-> ) and then walk through all it's intermediate expansions
13:10fogusGot it. http://groups.google.com/group/clojure/browse_thread/thread/cb31d09ccf3706b0/2fcab81b15a9a40b?lnk=gst&amp;q=%22(-%3E%22#2fcab81b15a9a40b
13:17RaynesGood morning fellow parenthesis lovers.
13:38gnuvinceHolcxjo: that's tonight, right?
13:38HolcxjoIn 1 hour
13:39gnuvinceHolcxjo: are you gonna twitter it?
13:39HolcxjoProbably busy taking notes...
13:39Holcxjonot sure they'll have the Wifi up either
13:39Holcxjobut if so, I'll post it here in IRC if wanted
13:40gnuvinceCool
13:40gnuvinceHe's doing his "Clojure for Java programmer" talk, right?
13:40Holcxjoyes :-(
13:40Holcxjobut it's about �450 cheaper than the talk he gave today
13:42gnuvinceheh :)
13:46Mecif I have a list of strings, how might i (reduce .concat strings) since you cant actually do that?
13:46Meci guess i can just make a function
13:46cooldude127Mec: (apply str strings) ?
13:47Mecthanks
13:47cooldude127,(apply str '("bob" "fred" "joe"))
13:47clojurebot"bobfredjoe"
13:47cooldude127yay
13:47Meci didnt know str would concat like that
13:47cooldude127yeah
13:47cooldude127,(str "hello " "my friend")
13:47clojurebot"hello my friend"
13:48Mechmm apparently it doesnt
13:48cooldude127Mec: what do you mean?
13:49Meci ran it thru and it returned "\"1\" \"2\"" etc
13:49cooldude127Mec: maybe paste the code?
13:49Mecnvm missed apply
13:49cooldude127that sounds right
13:53Mecwow now my answer is just wrong because i cant spell :x
13:57Mectheres "four" but "forty" so i thought "forteen" but no no
13:57cooldude127lol
14:38Mecwill this use up the stack: (def fib ((fn rfib [a b] (lazy-cons a (rfib b (+ a b)))) 0 1))
14:38Chousukeooh, a pretty-printer
14:40cmvkk_Mec any recursion that doesn't use the 'recur' function will use up the stack, in Clojure.
14:40cmvkk_well actually...
14:41Carkthis should not use stack space
14:41cmvkk_yeah,
14:41cmvkk_that's a lazy sequence so it won't
14:41Meci shouldnt think so, but it does seem like it should
14:42cmvkk_well "lazy-cons" doesn't execute the recursion, it just returns, which is why it doesn't.
14:42Mecit still has to save the values somehow, is a closure not a stack layer?
14:43Carkright but you only have one stack frame at all time
14:43cmvkk_as an aside, none of the newest versions of clojure have 'lazy-cons' anymore
14:44Mecwhat do they have?
14:44cmvkk_lazy-seq.
14:44ChouserMec: a closure is not a stack layer.
14:44Mecwhats the dif?
14:44Mecfor cmvkk_ ;p
14:44Chousera closure can include values from any layer of a stack, so each of the values needed is stored on its own
14:44Carkchouser : depends on the implementation doesn't it ,
14:45ChouserI'm referring to Clojure. :-)
14:45Meci thought lazy-cons returns a lazy sequence, is it just renamed?
14:45cmvkk_lazy-seq works slightly differently, there's a page for it somewhere...but if you're using lazy-cons you should consider updating
14:45Carkah yes, sorry =P
14:45ChouserBut I think even in other languages/implementations, if it captures the whole stack it is a continuation, not just a closure.
14:46Mecmy version doesnt even have lazy-seq so i guess its moot
14:46Carkchouser : i beleive in some schemes it will captuer only the revelant stack frames
14:47Carkmec : you should update
14:47Carklazy-seq is here to stay
14:47Mecim too scared of breaking emacs now that i finally got it working ;p
14:47Carkor i hope so anyways
14:47Chouserexcept it's a breaking change, so don't until you're ready.
14:47cmvkk_i have a long question:
14:47Meclazy-seq isnt even in the api?
14:48cmvkk_my framework has these data structures called tracks, which are just vectors of vectors (one big one holding many small ones), but
14:48Cark,(doc lazy-seq)
14:48clojurebot"([& 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."
14:48cmvkk_the first element in the vector is a map containing type information and type-specific attributes for the track.
14:48ChouserMec: http://clojure.org/lazy
14:48cmvkk_i want to make them lazy-seqs instead (so that they can be infinite), but i don't know what to do with the map at the front. Before I figure that out, is this the sort of thing that I should be using metadata for?
14:49MecChouser: thanks
14:49cmvkk_I don't feel like I have a good grasp on what metadata is really 'for'.
14:49Chousercmvkk_: the central rule is that metadata does not participate in equality
14:49gnuvincecmvkk_: anything you want
14:49Carki don't like the idea on having type information in meta-data
14:50gnuvincecmvkk_: Clojure does not dictate what you put into it. Usually, you put in things that don't belong in the data itself.
14:50Carkif it's a different type, it should not be =
14:50cmvkk_So I feel like in this case that a track with different elements in the map might sound different when rendered (because I am using that data), so I guess it's not metadata?
14:50Chousercmvkk_: that seems likely
14:50gnuvince,(= (list 1 2 3) [1 2 3])
14:50clojurebottrue
14:50Chousercmvkk_: so, you can either go ahead and put your map as the first element of the lazy seq
14:50Carkgnuvince : both are sequences !
14:51ChouserCark: no
14:51Chousera vector is not a sequence.
14:51Chousercmvkk_: or you could store the lazy seq inside the map
14:51cmvkk_Chouser, I'm thinking that's what I'll do, thanks.
14:51Chousercmvkk_: or make a new top-level structure (a map? a two-element vector?) that holds the map and the lazy seq
14:52cmvkk_but with that said, I still can't think of a good use for metadata. what kind of data would you want that doesn't change the value of the element in question?
14:52Carkmhh so by which virtue are these = ?
14:53Chouserthey're both Sequential IPersistentCollections that contain = values.
14:54Carkyou mean they have some type in common
14:55cmvkk_they both define their equality by the equality of their constituents, I assume
14:56ChouserI guess I'm not very sure of the details of the equality rules. There's a paper on the subject I've so far avoided reading.
14:57Chouser,(= {:a 1 :b 2} [[:a 1] [:b 2]])
14:57clojurebotfalse
14:57Chouser,(= (seq {:a 1 :b 2}) [[:a 1] [:b 2]])
14:57clojurebottrue
14:57Mecman, it took me a long time to finally understand lazy-cons, lazy-seq is just a big woosh
15:01danlarkinLau_of_DK where oh where are you :(
15:18Raynes~source ref
15:19cooldude127Holcxjo: i do
15:22maaclWhen I try to launch slime with swank-clojure-jar-path set to the compojure clojure.jar I get java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0) - the REPL seems to work if I abort - any ideas why ?
15:25Chouserthat's what I'm doing for my birthday.
15:26WizardofWestmarclater guys, meeting time where I get to present *weee*
15:26maaclSetting up emacs/slime to work interactively with compojure is a nightmare - does anyone know of a guide ?
15:28cooldude127i don't remember compojure being that difficult
15:28cooldude127but i haven't looked in a little while
15:31maaclcooldude127: I have all the jars in my classpath, but I get the error I just posted when I start slime. If I then do (use 'compojure) at the repl I can eval / compile a file the uses compojure otherwise I just get errors about missing source files
15:38pjstadigclojurebot: pastebin
15:38clojurebotI don't understand.
15:39pjstadigclojurebot: pastebin link
15:39clojurebotHuh?
15:39cmvkk_~paste
15:39clojurebotlisppaste8, url
15:39lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:39lisppaste8pjstadig pasted "reading a file" at http://paste.lisp.org/display/76917
15:39pjstadigam i missing something?
15:40pjstadigI'm trying to read from an input stream and write to an output stream
15:40pjstadigbuff is 1K
15:41pjstadigthe loop is stopping after one iteration
15:41pjstadigwriting a 1K file
15:41cmvkk_why the ==?
15:41pjstadigi tried =
15:41pjstadigwas getting weird behavior and started randomly changing things for no reason
15:42cmvkk_you're reading into the buffer then writing all at once, is that right?
15:43pjstadigreading a chunk at a time using buff which is a 1K buffer
15:43cmvkk_you might want to use 'when' rather than 'if'. becuase you're only recurring when you' aren't writing.
15:43pjstadigoh
15:43pjstadigyes
15:43pjstadigstupid me!
15:43pjstadighehe
15:43maaclAnybody who can help me getting compojure up and running with emacs/slime? this driving me nuts
15:44pjstadigi knew it had to be something stupid
15:44cmvkk_i think when you're doing something iterative it's a lot easier to get tripped up with if's syntax.
15:44cmvkk_something mutable
15:54noidiis there an easy way to read a string? like (read (some-stream-wrapper-thingy "(1 2 3)")) --> (1 2 3)
15:56kotaraknoidi: read-string
15:56noidiargh, read-string
15:56noidiyup :)
15:56kotarak(doc read-string)
15:56clojurebotReads one object from the string s; arglists ([s])
15:56noidisorry, should've googled that
15:57kotarak(doc find-doc)
15:57clojurebotPrints documentation for any var whose documentation or name contains a match for re-string-or-pattern; arglists ([re-string-or-pattern])
15:57kotarak;)
15:57noidifunny that it's not mentioned in http://clojure.org/reader
15:58danlarkinclojurebot: max people
15:58clojurebotmax people is 161
15:58danlarkin~whoah, that's a ..... surprise
15:58clojurebotPardon?
15:58danlarkinbah
15:58danlarkinjoke ruined
15:58cmvkk_heh
15:59Chouser~there used to be 160, then suddenly...
15:59clojurebotCLABANGO!
15:59RaynesMy chicken exploded.
16:01danlarkinah there we go
16:01danlarkinsuddenly
16:04kotarakDoes anyone have a sane ant setup, where some Java class depends on some gen-class stuff, and some other clojure stuff depends on the Java stuff?
16:06danlarkinkotarak: I've got one doing gen-class and AOT'ing the rest, but that's not really what you're after
16:08kotarakdanlarkin: it's basically some clj -> java -> some clj in the dependency chain. I'm annoyed by programs like javac which claim to do a better job than make.... They don't!
16:08pjstadig~surprise!
16:08clojurebotsurprise is CLABANGO!
16:08pjstadigd'oh
16:09cmvkk_heh
16:09hiredmanuse <reply>
16:09pjstadigi'm must have told him wrong
16:09kotarakAnd then suddenly...
16:09pjstadigoh
16:09pjstadig~surprise
16:09clojurebotCLABANGO!
16:16danlarkinhave you guys seen this? "Uncomfortably Parallel"... it's hiiiilarious http://www.youtube.com/watch?v=1yH_j8-VVLo
16:20noidiis there a way to convert (1 2 3 4 5 6) into ((1 2) (3 4) (5 6))?
16:21noidii wrote a function to do that, but it's so ugly that it must be wrong :)
16:21Chouser,(partition 2 (1 2 3 4 5 6))
16:21clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
16:21Chouser,(partition 2 '(1 2 3 4 5 6))
16:21clojurebot((1 2) (3 4) (5 6))
16:21noidithanks!
16:23Chouserdanlarkin: I'm still laughing.
16:24danlarkinMUNCTIONAL
16:25noidiDo you want gratuitous amounts of volume changes? LOUD (quiet) LOUD (quiet)
16:26noidikinda ruined it for me, but thumbs up for the idea :)
16:27replacadanlarkin: fabulous! :-)
16:34lisppaste8noidi pasted "helloworld" at http://paste.lisp.org/display/76919
16:35noidii'm really beginning to like clojure
16:35noidii couldn't imagine writing a doctest clone as a "hello world" project in any other language :)
16:36noidiand after two evenings of work it seems coming along quite nicely
16:36noidi+to be
16:47rzezeskikotarak, what we really need is a joint compiler
16:48kotarakrzezeski: what we need is a simple way to extract dependency information and a capable build system. Eg. like cook.
16:49rzezeskiI'm not sure what cook is, but I think it would be awesome if someone could come up with a generic joint compiler for all languages that live on the JVM, allowing us to easily mix java/clojure/groovy/scala/jruby/etc
16:50maaclWhen I try to launch slime with swank-clojure-jar-path set to the compojure clojure.jar I get java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0) - the REPL seems to work if I abort - any ideas why ?
16:51kotarakrzezeski: you see: java, clojure, groovy, scala, ... Why not a small (easy to debug) dependency extraction tool (eg. like OCaml ocamldep) and a build system which is capable of coping with such dynamic information. Make is notoriously bad at that, but eg. cook (a make replacement) does this quite well. (Although ocamldep as well as cook aren't perfect, either...)
16:53rzezeskido you have a link for cook?
16:54Chousersomeone mentioned a builder for mixed clojure/java programs
16:54kotarakhttp://miller.emu.id.au/pmiller/software/cook/
16:54Chouserhttp://preview.tinyurl.com/bjwryo
16:54Chouser^^ Buildr
16:54rzezeskiChouser, I know someone wrote a java/clojure/groovy joint compiler for Buildr
16:55kotarak"gems" probably means Ruby...
16:57pjstadigBuildr is a Ruby based Java build tool
16:57pjstadigi think there is already a proliferation of build tools
16:57pjstadigrake, make, ant, maven, buildr, lancet
16:57pjstadigwhat we need is a non-proliferation agreement
16:57rzezeskiyea, the problem is these joint-compilers are all one-offs, and they must take into account the "parent" compilers that came before them. So for every different combination you need a new joint compiler, or you need to come up with some weird/fragile build order
16:58waltersheh
16:58pjstadigthese are weapons of mass construction
16:59noidihehe
16:59walterswell, part of it is "don't do that" too - e.g. keep the Java to the lower layers of the system, the dynamic languages for the faster moving parts on top
16:59waltersso bottom doesn't depend on top
17:00Chouserconversely, stop writing Java and just use Clojure.
17:00rzezeskiwalters, to an extent, but on larger projects it can be harder keep the different languages from mixing. Circular dependencies are a fact of life, and a single compiler handles them just fine, it's when you cross language boundaries that things get weird
17:00rzezeskiChouser, if only :)
17:01kotarakChouser: tell this our working student.... I tried to infect him with Clojure bacillus but he still has his defenses up....
17:01Chouserhmph
17:03rzezeskiEg, I'm working on a Grails/Clojure plugin so that I can utilize Clojure power from my Grails projects. However, since there is no joint compilation the dependency can only go one way, my Grails code can know about the AOT-ed classes, but not the other way around. It would be nice if that restriction wasn't there.
17:05Chouserno AOT for grails?
17:07rzezeskiChouser, not sure if you're joking or you are asking if there is a way to generate stubs in Grails?
17:08ChouserIf grails can produce class files, then a sufficiently powerful build tool could allow you to write clojure code that used them, right?
17:09rzezeskiyes, I agree, if you build tool is smart enough, it could search the dependencies and switch back and forth between the compilers to get the right order
17:09rzezeskiif thats what you mean
17:13Chouseri guess that's what I mean. :-) Haven't given it much thought.
17:13waltersrzezeski: depends what you want to do, but have you e.g. experimented with using the Clojure data structures and STM from groovy?
17:15rzezeskihaha, yea I'm not explaining myself very well either, I've just recently started working on this and so my knowledge of the problem is still shallow. I still have to play with AOT more and see what sticks, but even one-way I still think it's nice to allow Grails users to utilize some Clojure-fu in their projects
17:17rzezeskiWalters, no, I have not tried using the Clojure data structures directly from Groovy. Although I read an article of someone doing it in Ruby (I think) and having success. My main reason for my plugin is to actually write Clojure functions that can be called in my Grails projects
17:19kotarakWhy are people so obsessed with speed?
17:19RaynesGroovy is so not groovy.
17:19rzezeskilol
17:19Rayneskotarak: Because we liek fast things.
17:19RaynesVroom Vroom.
17:19rzezeskiRaynes, it's better than tradition J2EE, and I'm happy that I'm working in Groovy in a predominately .Net shop
17:20rzezeskitraditional*
17:20rzezeskiit could be much worse
17:20RaynesClojure would be much better though.
17:20RaynesOh the agony.
17:21rzezeskiYes, it would be nice, that's why I'm writing this plugin!
17:21rzezeskiIt's a foot in the door
17:21RaynesWhat plugin?
17:21RaynesO.O
17:21rzezeskiclojure plugin for grails
17:21RaynesOh neat.
17:23rzezeskiI can't believe this place has 160 ppl in it, it was hovering around 90ish in November
17:24Raynesrzezeski: The growth of Clojure has been amazing since I started coming here.
17:24shooverwe're all sitting here waiting for clabango
17:24rzezeskiRaynes, when was that?
17:24RaynesIf you Google Clojure you can notice that /everyone/ is trying it, and almost everyone is liking it. The channel gets 10 new people on a monthly basis.
17:24RaynesIt was around 3 months ago.
17:24kotarakrzezeski: lurkers in #clojure * 10 = members of the google group
17:24Raynes115 people were in here regularly.
17:25danlarkinha, speaking of... I need someone to help me test... who volunteers?
17:25RaynesCLABANGO!
17:25p_l20:56 -!- Irssi: New peak in #clojure@freenode : 160 20:57 -!- Irssi: New peak in #clojure@freenode : 161 .... 21:44 -!- Irssi: New peak in #clojure@freenode : 16
17:25pjstadig~surprise
17:25clojurebotCLABANGO!
17:25cmvkk_i'd guess both this channel and the group represent a small portion of users...i lurk on the google group but am not a member, for instance.
17:26rzezeskikotarak, what's that...like 1500?
17:26pjstadigi keep telling people that Clojure is the next big thing
17:26pjstadigbooyah!
17:26pjstadig~booyah!
17:26clojurebotCLABANGO!
17:27kotarakrzezeski: 1602 or something
17:27pjstadighehe
17:27shooverclojurebot: clabango?
17:27clojurebotExcuse me?
17:27pjstadigi better stop
17:27shooverclojurebot: clabango is the greatest web framework yet to be written
17:27clojurebotAck. Ack.
17:27pjstadigor soon anything you say to clojurebot will result in a CLABANGO!
17:27pjstadigi setup a site BTW
17:28shooverpjstadig: wha?! I just checked... parked
17:28pjstadigi'm waiting for 1and1 to update the NS servers
17:28pjstadigit takes forever
17:28shooverok
17:28pjstadigi submitted the change 8 hours ago
17:28cmvkk_heh
17:28pjstadigmight show up by tomorrow
17:28cmvkk_or in a few weeks, whatever...
17:29jhawk28I used to have 1and1 - yes they are slow
17:29jhawk28Dreamhost is much faster
17:29rzezeskikotarak, are you Brandmeyer ?
17:30rzezeskilol
17:31rzezeskifirst off, thx much for VimClojure man, it was really nice not to have to go back to emacs just for some good Clojure support
17:31pjstadigwhat's wrong with emacs?!
17:31pjstadigj/k
17:32rzezeskiNothing
17:32rzezeskibut I want a text editor, not an OS ;)
17:32rzezeskinah, I prefer Vim keybidings, IMO they are superior, and no I don't care about Emacs Viper mode
17:32kotarakrzezeski: did you try the new one?
17:33rzezeskikotarak, I was just about to get to that, I have a question
17:33kotaraksure
17:33rzezeskiAt the top of my vimrc I 'let' my maplocalleader to ","
17:34rzezeskibut when I try to invoke StartRepl or any of the commands, it's as if it didn't care that I set LocalLeader
17:35rzezeskieg, when I hit ,sr , it seems to ignore the comma, and then test 'sr' like it normally would
17:35kotarakrzezeski: hmmm.. do you edit a clojure file? (I have also , and it works.)
17:35rzezeskiyea, I open up core.clj
17:36rzezeskiand I have the nailgun server, not like that should affect the key binding
17:36kotarakrzezeski: does \ work?
17:36rzezeskiI saw you comment about Plugs (which I don't really understand), but I figured as long as I set LocalLeader I should just be able to use the default key bindings
17:36rzezeskinot \ does not work either
17:37kotarakrzezeski: and you are in normal mode?
17:37rzezeskias in, not in insert mode?
17:37rzezeskior visual mode
17:37kotarakyeah
17:37kotarakyeah
17:37rzezeskiyes
17:38kotarakhrmph...
17:38rzezeskiAnd I have syntax on a the filetype declaration
17:38kotaraksyntax works?
17:38rzezeskiyes
17:38kotarakmore hrmph...
17:39rzezeskiIf it makes any diff I pulled from your version control
17:39rzezeskiI like bleeding edge
17:39kotarakis identical to the release at the moment.
17:39rzezeskimaybe I forgot to copy something?
17:40kotarakautoload, indent, syntax, ftplugin, ftdetect, doc...
17:40rzezeskioh, also, I'm using vim in a shell, not in gui mode if that makes a diff
17:40kotarakHmm... It should not for the Repl, also it might for the highlighting of the ParenRainbow.
17:41kotarakwhat does nmap ,sr say?
17:41rzezeskiyea, I did a 'cp -r' on autoload, doc, ftdetect, ftplugin, and syntax
17:42rzezeski"no mapping found"
17:43kotarakargh. Did you put "let clj_want_gorilla = 1" in your .vimrc?
17:43rzezeskiif I do "call vimclojure#Repl.New()" I get a Repl window but it's kinda messed up
17:44rzezeski"let g:clj_wants_gorilla = 1" ...straight from my vimrc
17:44rzezeskioh wait
17:44kotarakw/o s
17:44rzezeskiI see a typo
17:44rzezeskitada
17:44kotarak^^^^ I figure it works?
17:45rzezeskiyep
17:45kotarak\o/ :)
17:45rzezeskiFYI, you have a typo in clojure.txt ;)
17:45rzezeskicause I straight copied it
17:45kotarakDoh. /o\
17:46rzezeskithx for the help, and you're welcome for the bug report ;)
17:50kotarakrzezeski: thanks for the report. Now there is also a bleeding-edge branch. ;)
17:50rzezeskihaha
17:50rzezeskii'm glad to see you eliminated the Ruby dep
17:50rzezeskiAlso appears you added some more key bindings too
17:51rzezeskilooking forward to checking it out
17:51kotarakMe too. It was annoying and unstable.
17:51kotarakrzezeski: try <C-X><C-O> (this time in insert mode) :)
17:51rzezeskiok
17:52kotarakeg. as in r-s<C-X><C-O>
17:52rzezeskioh snap, that's hot!
17:52kotarakIf you got the preview window you can close it with ,p
17:53rzezeskivery nice
17:53kotarak:)
17:53rzezeskithx for the hard work
17:53rzezeskimuch appreciated
17:53durka42kotarak: yesterday cooldude127 and i were complaining that the repl window resizes every time you evaluate an expression. i discovered that :set noequalalways makes it not do that. maybe something to put in the docs
17:53kotarakHuh? It does.
17:55rzezeskikotarak, you know what would be REALLY killer, if we could get some kind of "live templating" action going on in VimClojure. So you could do omni complete, find your selection, then when you hit enter it creates the shell and puts you in the first editable slot, and then you keep hitting tab to move to the next slot until you fill out the skeleton
17:55kotarakYou mean for the arguments.
17:55rzezeskiI think they have some basic support for this stuff in Vim, but I haven't had time to try it
17:55kotarakThey have? o.O
17:56rzezeskithere is?
17:56kotarakdurka42: Ah. Ok. I understand the equalalways thing.
17:56rzezeskihave you ever seen screencast of people using TextMate?
17:57kotarakNo.
17:57rzezeskiOh ok, I'll have to find one and send you the link, it's easier to see it then it is to explain it
17:57kotarakdurka42: I have to open a temporary file for the Clojure interaction. That's why the window gets resized. Will put a not in the docs.
17:57kotaraknote
17:57durka42ah, i see
18:00kotarakdurka42: or maybe I can disable the option and re-enable it afterwards..... Have to have a look...
18:03tashafaquick question...
18:03tashafahow do i get every other element into a seq
18:04kotaraktake-nth maybe
18:04hiredman,(map second (partition 2 (range 10)))
18:04clojurebot(1 3 5 7 9)
18:04tashafahiredman you are the best
18:04kotarak,(take-nth 2 (range 2))
18:04clojurebot(0)
18:04kotarak,(take-nth 2 (range 10))
18:04clojurebot(0 2 4 6 8)
18:04hiredmanooo
18:05hiredmankotarak is better
18:05tashafai take that back hiredman
18:05hiredman~kotarak is better
18:05clojurebotc'est bon!
18:05kotarakhuh?
18:05tashafakotarak is the man
18:05tashafajk hiredman
18:06tashafayou've helped me way too many times
18:06hiredmanbut I have no vimclojure love
18:06hiredmanI may just not have any vim love
18:06kotarakno?
18:07tashafa,(doc take-nth)
18:07clojurebot"([n coll]); Returns a lazy seq of every nth item in coll."
18:07tashafagod i should know that
18:07hiredmanI am not sure how this "localleader" thing works, and none of the key combinations I try with \ (the default localleader??) work
18:07tashafai need to hack clojure everyday
18:08kotarakhiredman: Have you set "let clj_want_gorilla = 1" in your .vimrc? There was a typo in the docs.
18:08hiredmanah
18:08hiredmanso no g:
18:08kotarakthe g: should not matter.
18:09kotarakAs long as it's not in a function.
18:09hiredmanah
18:09hiredmanso the docs said wants
18:09kotarakyes.
18:09kotarakSorry.
18:09hiredman*shrug*
18:09rzezeskilocalleader is a way to handle key bidning clashes between global and plugins
18:09hiredmanit happens
18:10rzezeskiyou can set it like so 'let maplocalleader = ","'
18:10hiredmanok
18:10hiredmanwonderful
18:10hiredmannow I get errors
18:10rzezeskiw/o the surronding single quotes that I shouldn't have added in
18:10hiredmanthis is progress
18:11hiredmanall kinds of errors
18:11rzezeskilol
18:12Drakesonhow should I "pipe" an InputStream into a file ?
18:12hiredmanhah
18:12hiredmangroovy
18:12hiredmanI had forget that I stopped the nailgun server last night
18:12hiredmanwith it running it works
18:13hiredmanDrakeson: you open an OutputStream on the file, and loop around both the InputStream and the OutputStream reading from the InputStream and writing to the OutputStream
18:14kotarakDrakeson: apache.commons has some copy function.
18:15hiredmanyeah
18:15hiredmancommons.io is the way to go
18:17rzezeskikotarak, this is kind of what I was talking about when I said "live templating" http://drnicwilliams.com/wp-content/uploads/2008/06/textmate-snippets-running-ruby.mov Mainly, the ability to build a skeleton of text and use the tab key to navigate through the the parts you want to edit. It helps avoid typing syntax and I think helps keep from constant switching between insert and normal mode.
18:20DrakesonOK, do you see a pitfall in (spit "filename" (slurp* stream)) ?
18:22rzezeskikotarak, it may not be as useful in Clojure since there isn't really much rigid syntax, but things like auto matching/deleting parenthesis, brackets, braces would be a good start.
18:22jhawk28be careful about using commons.io with files that need to be locked
18:23kotarakrzezeski: you might want to look into autoclose.vim
18:23rzezeskiwill do
18:30rzezeskiautoclose led me to surrond.vim, that looks pretty nice
18:30rzezeskihave you tried either?
18:32Lau_of_DKGood evening gents
18:33kotarakrzezeski: I tried autoclose and got always confused with the parens. So I gave up in the end.
18:35rzezeskiI see, well I'll give surround.vim a try
18:35kotarakHaven't looked at that.... Maybe I will, too
18:36Lau_of_DKChecked out paredit for emacs?
18:36rzezeskithx for vimclojure, it has been invaluable for me
18:37rzezeskiI'm outta' here, later guys/gals
18:38Lau_of_DKl8r
18:50lisppaste8mec pasted "inf-sequence" at http://paste.lisp.org/display/76928
18:51Mecmy first macro ^^ tell me how badly i screwed it up :D
18:51Chousukewhy is it a macro? :)
18:52Mecbecause it wants to be
18:52Chousukeit's old-style code anyway.
18:52Chousukewith lazy-cons
18:53Mecim not running off the repo so i dont have lazy-seq
18:53Chousukebut I dunno, seems okay to me.
18:54Mecyou asked why is it a macro, how do you do it as a function
18:55Chousukewell, I guess being a macro makes it a bit neater.
18:55Mecit keeps trying to evaluate its args as a function
18:59danlarkinLau_of_DK: ready to help me test out clab... err... madison?
18:59DrakesonI still don't get it :( what is the clojurey way of piping a stream into a file? is (spit "filename" (slurp* stream)) a good way?
19:00Chousukehm
19:00Chousukeprobably not
19:00Lau_of_DK~ dan, you know, I was ready to test, when suddenly...
19:00clojurebotCLABANGO!
19:00Lau_of_DKYou got it uploaded somewhere?
19:00danlarkinnope, you get to be my betatester
19:00ChousukeDrakeson: you should probably use some java classes.
19:01Lau_of_DKk - since its almost bedtime here, you can send me a zip, and I'll have a look at it and get back to you over the weekend, sounds good?
19:01danlarkinsure
19:03Meci love clojures gensym, it's gotta be the simplest in existance
19:11Lau_of_DKGood night America, whereever you are
19:24DrakesonChousuke: I see.
19:24dreishSounds like rhickeys talks this week have been a hit, from watching twitter.
19:26jhawk28dreish: are they online?
19:26dreishI doubt they'd be up yet, but I think he's going to put them up.
19:26gnuvince_I imagine infoq.com are gonna put up the one from qcon eventually
19:26jhawk28where did he speak? Im in brain-dead mode
19:26gnuvince_QCon and another place in London
19:27jhawk28qcon should be up on infoQ soon then
19:29dreishI'm a little bummed because I found a bug in the version of Clojure I have installed at work, and I ran home to reproduce it on my more recent compile, but it has already been fixed.
19:29dreishI wanted the glory of reporting a bug.
19:29hiredmanclojurebot: latest?
19:29clojurebotlatest is 1327
19:30cmvkk_is there glory in bug reporting?
19:30dreishTons.
19:30cmvkk_i've done it a few times for clojure, but they were all for ridiculous use circumstances, nobody else had noticed them yet because they weren't abusing the language
19:31dreishThis one seemed pretty serious to me: (= '(1 2 3) [1 2 3]) was true, but the hashCode() for the two collections was different.
19:32hiredman,(doc =)
19:32clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
19:32cmvkk_oh we were talking about that earlier. is that a bug, and it was fixed?
19:32hiredman"and collections in a type-independent manner."
19:32cmvkk_aha.
19:32dreishWith the result that when an array hash was promoted to a tree-based hash, keys would seem to disappear if they were being looked up by their synonyms.
19:33dreishIt was a bug -- the issue wasn't the = function per se, but .equals() and .hashCode() violating the contract for .hashCode().
19:33hiredmanah
19:33hiredmanI understand
19:33hiredmanyes
19:33dreishAnyway, now it works. hashCode()s are the same.
19:33hiredmanman, php is so dirty
19:36hiredmanit really makes you appreciate java
19:37hiredmanyou know, instead of writing a lisp in php so I can just write lisp and have it work where there is php, maybe I should just never ever write php again
19:38cmvkk_maybe nobody should.
19:40gnuvince_PHP and its weird definition of equality when using ==
19:41cmvkk_http://cmvkk.nfshost.com/lumenc/zelda.mp3
19:41cmvkk_have some clojure-generated zelda music.
20:29cp2neat cmvkk_
21:21Mecdoes clojure or java have a utility for converting bases?
21:22cmvkk_java definitely does somewhere
21:22cmvkk_do you mean like numeric bases in string representations of numbers?
21:23hiredman,(Interger/parseInt "10" 2)
21:23clojurebotjava.lang.Exception: No such namespace: Interger
21:23hiredman,(Integer/parseInt "10" 2)
21:23clojurebot2
21:23hiredman,(Integer/parseInt "10" 4)
21:23clojurebot4
21:23hiredman,(Integer/parseInt "1" 4)
21:23clojurebot1
21:23hiredman,(Integer/parseInt "11" 4)
21:23clojurebot5
21:24Mecis there a way to go to the other base?
21:25Mecspecifically i need to go from decimal to binary
21:27durka42,(Integer/toBinaryString 532)
21:27clojurebot"1000010100"
21:27Mecthanks
21:31pjstadigwww.clabango.com
21:31p_l>_>
21:32cmvkk_excellent.
21:32hiredmanhaha
21:32jhawk28what is clabango?
21:33jhawk28,(Math/pow 3 4)
21:33clojurebot81.0
21:34hiredmanclojurebot: do you have a surprise for me?
21:34clojurebotCLABANGO!
21:34cmvkk_it's a clojure program that turns lead into gold.
21:34cmvkk_or at least that's what i assume judging by the hype.
21:34jhawk28creates your own custom social networking site for people who love clicking ads?
21:35Mecwhich is basically turning the internets into gold instead of lead
21:36jhawk28indirect payment, indirect taxes, what is next?
21:36Mechmm what symbol represents the last repl value?
21:37Meci sware i saw it on the site and cant find it again
21:37jhawk28*1
21:37jhawk28,(*1)
21:37clojurebotjava.lang.IllegalStateException: Var clojure.core/*1 is unbound.
21:37jhawk28*2 is second
21:38jhawk28*3 is the third
21:38Meccool thanks
22:03hiredmanhah
22:03hiredmanvimclojure
22:03hiredmanall working and good
22:05hiredmannew key bindings to learn
22:22tedanlarkin: http://github.com/Lau-of-DK/clabango/tree/master
22:22te;)
22:57durka42hmm, looking at Nu
22:57durka42how many languages can i use without leaving the land of the parens? :)
22:59p_ldurka42: somewhere around infinity
23:01Mecanyone ever used scite and know if it's possible to set up a repl with it?
23:03jcriteshow well does clojure support building a project into a jar for deployment?
23:04jcritesat one point in the past it didn't very well, but i've heard it's gotten a lot better since then
23:07hiredmana jar is just a zipfile
23:07hiredmanis their something more specific you are looking for?
23:08hiredmanthere
23:09Mecwhen using arity to add a counter type is it better to use recur?
23:10hiredmaneh?
23:10Mec(defn f ([a] (f a 0)) ([a counter] ...))
23:11Mecmaybe better to use loop.. hmm
23:11hiredmanrecur recurs with in the the method
23:11ChouserMec: early on I teneded to do that, now I'm more likely to use a loop
23:11hiredmanso recur in the on arity version will recur to the one arity version
23:12Mecreally?
23:12MecChouser: ya that observation just came to me
23:12hiredmanChouser: for what reason?
23:12Chouserhaving the other arity leaks an internal detail to the public api -- someone could call with a counter value and get unexpected results.
23:12hiredmanI see
23:13Chousermaybe not likely, but what's the benefit? *shrug*
23:13Mectrue enough
23:13Mecand loop does remove the necessity for arity, so wins all around
23:13Mecbut i find it interesting if recur will not match arity... must test
23:14Mecwow it does, i'd never have guessed, i'd just have been confused by that error
23:14ChouserMec: what do you mean?
23:15Mec,(defn f ([a] (recur [a 0])) ([a b] b))
23:15clojurebotDENIED
23:15Mecjava.lang.Exception: Unable to resolve symbol: f in this context (NO_SOURCE_FILE:0)
23:15Mecerr wrong one
23:15Mecjava.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 1 args, got: 2 (NO_SOURCE_FILE:86)
23:16Chouser,(fn f ([a] (recur [a 0])) ([a b] b))
23:16clojurebot#<sandbox$eval__1590$f__1592 sandbox$eval__1590$f__1592@74c144>
23:16Chouser,(fn f ([a] (recur a 0)) ([a b] b))
23:16clojurebotjava.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 1 args, got: 2
23:16Chouserthere it is. :-)
23:16jcriteshiredman: I suppose I am specifically looking for classfile generation for all my code, and building it into a jar for deployment
23:17jcritesI mean, with regards to "what I am looking for" I just mean packing my code up for deployment like I do with Java... I don't have to think much about the specifics of how that works when using a relatively high-level build system, so I am not sure what to ask for :)
23:19hiredmanjcrites: clojure's jar file has a build.xml with an ant task for compiling .clj files
23:21hiredmanif you like high level tools, now is he time to write them
23:21jcritesheh
23:21jcritesI suppose I don't actually need for it to be precompiled, as long as I have a jar which appears and works like an executable... do you recommend I compile?
23:22jcrites(assuming I don't depend on it like a library, for example)
23:22jcritesa java executable that is
23:22dreish,(Integer/toString 102 26)
23:22clojurebot"3o"
23:25arohner_jcrites: if you don't compile, you'll need the clojure.jar to run them
23:26Chouseryou'll need that even if you do compile.
23:26arohner_I would recommend you compile. It's not that bad
23:26arohner_oh, right
23:28Chouseryou might be able to leave out some classes, like Compiler*, when it's compiled... but I'm not sure how well that would go.
23:29jcritesoic. deploying clojure.jar with my application is fine, I think
23:29jcritesthanks for the help.. I will try some things out
23:29arohner_Chouser: if you leave out Compiler*, can you still eval?
23:29Chouserno
23:29arohner_so that means no repl too
23:30hiredmanyou can also fold clojure.jar into your jar
23:42RaynesI place all libraries including Clojure.jar in a library folder beside the jar.
23:44RaynesStu should have hosted his book on his website for free like Real World Haskell does. He then could proceed to flip Brian O' Sullivan off and smoke a huge cigar.
23:46hiredman~/.jars
23:46clojurebotexcusez-moi
23:46cooldude227lol
23:47cooldude227so who's using maven with clojure?
23:48Raynescooldude227: You are.
23:52Guest46760,(time (reduce + (map * (range 100) (repeat 1))))
23:52clojurebot4950
23:52clojurebot"Elapsed time: 1.019 msecs"
23:52Guest46760,(time (reduce unchecked-add (map unchecked-multiply (range 100) (repeat 1))))
23:52clojurebot4950
23:52clojurebot"Elapsed time: 26.5 msecs"
23:52cooldude227Raynes: actually, i'm not at the moment
23:53cooldude227i just installed it for some java stuff tho
23:53Guest46760thought the unchecked stuff was supposed to be faster?
23:53cooldude227Guest46760: you would think. that's bizarre
23:55Chouserit's the boxing and unboxing that's killing you there, I think.
23:56cp2wow, after not writing in java for a while im starting to notice that it is severely lacking compared to clojure :)
23:56Guest46760Chouser: yeah. i was wondering if maybe it needs type hinting.
23:56cooldude227i don't know if you can fix the boxing problem. clojure doesn't usually do primitives like that
23:56Chouserif you want fast math, don't use the seq abstration
23:57Guest46760Chouser: what would i use to avoid it?
23:57cooldude227you can't have primitive function args, they'll get boxed, cuz IFn has objects as the arguments to invoke
23:57Chouseruse something that can deal with primitives, like loop/recur and locals.
23:58Guest46760Chouser: k. i'll look into it. thx.
23:59arohner_Guest46760: you can also use the java array operations