#clojure logs

2010-08-17

00:00dnolenseangrove: you don't have to use my plugin, but if your native libs are in the right place, lein will pick them up for you.
00:02seangroveIs that url your plugin?
00:03dnolenseangrove: yes
00:03seangroveVery cool
00:03seangroveIs there a way to start clojure in 32bit?
00:04technomancyseangrove: depends on the platform. try starting java with the -client flag
00:04seangroveI'm on snow leopard
00:04technomancyhmm; I think you have to compile your own Java for that unfortunately. =\
00:04seangroveSeems that the jni is only supposed to run on 32bit :P
00:04seangroveHaha
00:04seangroveGoodness
00:05dnolenseangrove: that why I didn't bother with OpenCV, Xuggle is 64bit.
00:05dnolenseangrove: in yr Utilities directory there is the Java utility, launch and pick the 32bit one
00:07seangroveLooking for that...
00:10dnolenhttp://stackoverflow.com/questions/3363637/opencv-2-1-mac-os-x-webcam-issues-32-and-64-bit
00:11seangroveGot it I think
00:12seangroveAlright, imported :)
00:12seangroveThanks guys!
00:12seangroveThat was the biggest issue so far
00:13seangroveI'd like to get this working in lein in a bit, but this is the first big step
00:43seangroveCool, got it all working, thanks!
00:48bmhgood evening, channel
00:50technomancyrelease candidate for Leiningen 1.3.0: http://github.com/technomancy/leiningen/blob/master/NEWS
00:51bmhI'm interested in converting a bitfield into a IEEE float. Clojure's bit ops seem to only work on integer types. Any advice?
01:27slyrus,(flatten {3 4 5 6})
01:27clojurebot()
01:30tomoj,{{}}
01:30clojurebotjava.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
01:30tomoj,(identity {{}})
01:30clojurebot1
01:30tomojwat
01:30tomojI get {}
01:30tomoj$(identity {{}})
01:30sexpbotThis command is old. Use -> now. It's a hook, so it can evaluate anything, even stuff that doesn't start with parentheses.
01:30tomoj->(identity {{}})
01:30sexpbotjava.lang.ArrayIndexOutOfBoundsException: 1
01:30tomojhmm
01:31tomoj,(read-string "(identity {{}})")
01:31clojurebot1
01:31tomoj,(read-string "(identity {})")
01:31clojurebot(identity {})
01:31tomojwhat the heck?
01:33tomoj-> (sequential? (first {3 4 5 6}))
01:33sexpbot=> true
01:33tomojslyrus: ^
01:33slyrushmm...
01:34tomojerr
01:34tomoj-> (sequential? {3 4 5 6})
01:34sexpbot=> false
02:16alpheusHow do I make an InputStream from a string?
02:19cgrandalpheus: (-> "hello world" (.getBytes "UTF-8") java.io.ByteArrayInputStream.)
02:20alpheusthanks!
02:21raekalpheus: you can also create a Reader (the Character counterpart for InputStream, which reads Bytes) with:
02:21raek(java.io.StringReader. "HelloWorld")
02:23alpheusWould either one be a suitable argument to net.cgrand.enlive-html/html-resource ?
02:23raekbut that depends on whether you need a stream of bytes or characters (the latter is more likely in the case of a web server)
02:27raekI did a quick glance through the code, and it looks like both should work
02:28raekI'm inclined to recommend the Reader approach, since it does not do the extra encode to byte and decode into character step
02:29raekbut maybe cgrand himself can answer the question more accurately...
02:33cgrandalpheus: yeah, use a Reader, but you can also trade your html-resource for a html-snippet. (html-snippet "<html>....</html>")
02:38adityogood morning
02:40adityohow can i flatten a map i.e {a 1, b 2, c {"foo" "bar"}} into {a 1, b 2, "foo" "bar"}
02:41adityocontrib's flatten might not work on this
02:48raek,(let [m {:a 1, :b 2, :c {"foo" "bar"}}] (into (empty m) (apply concat (for [[k v] m] (if (map? v) v [[k v]])))))
02:48clojurebot{:a 1, :b 2, "foo" "bar"}
02:49raek,(let [m {:a 1, :b 2, :c {"foo" "bar"}}] (apply merge (for [[k v] m] (if (map? v) v {k v}))))
02:49clojurebot{"foo" "bar", :b 2, :a 1}
02:50adityothanks raek, ;)
03:50LauJensentechnomancy: You're the man!
03:50LauJensenGood morning all :)
07:19raekhaven't seen this approach for exceptions before: http://github.com/richard-lyman/amotoen/blob/master/src/com/lithinos/amotoen/errors.clj
07:19raekit avoids the subclassing issue in a pretty interesting way
07:44hanDerPederwith my current intuition, reduce and apply can be used pretty much interchangeably.. am sure this can't be correct. does anyone have a good example where one could be used but not the other?
07:46Raynes->(apply + 1 2 3 4 [5 6 7 8 9]) ; I don't think you can do stuff like this with reduce.
07:46sexpbot=> 45
07:47RaynesPlus, what they do is completely different.
07:48fogus_,(apply hash-map [2 3 4 5])
07:48clojurebot{2 3, 4 5}
07:48fogus_,(reduce hash-map [2 3 4 5])
07:48clojurebot{{{2 3} 4} 5}
07:48RaynesApply simply applies the function to the sequence of arguments as if they were individual arguments. It "unrolls" a sequence.
07:49RaynesReduce applies a function to the first two elements of a sequence (or the first element and the initial value you optionally provide) and then applies the function to the result of that and the next element and so on until the sequence is depleted.
07:49RaynesThey only appear to do same thing in certain situations, such as with the arithmetic functions.
07:49raekfor variadic functions like +, they happen to have the same result
07:52hanDerPederahh, ok
07:52hanDerPederthanks!
07:52fogus_raek: hash-map is variadic
07:53Raynesraek: Just be quiet and bask in the glory of my explanation. ;P
07:54hanDerPederso when using the max or an arithmetic function, is one considered better style than the other?
07:55hanDerPederie, (apply max '(1 2 3)) vs (reduce max '(1 2 3))
07:56RaynesI always use apply when I picture the final result as being the application of a function to a set of arguments that happen to be in a sequence, such as in the case of my + example above.
07:57fogus_raek: Maybe you mean "associative" :-)
07:57RayneshanDerPeder: I'd use the former, because it makes more sense in my head.
07:58hanDerPederRaynes: seems like a fair heuristic, thanks!
07:59Raynesrhickey: Morning.
08:00rhickeyhi
08:01metagovThis morning I was surprised this expression worked at all: (def a [a])
08:02metagovIt appears to be an array whose first element is an earlier version of the array.
08:02metagov(ie an empty arrary)
08:03fogus_metagov: Why is that surprising?
08:04metagovfogus_: I thought the reader would complain
08:04fogus_It will complain if a had not been previously defined, but otherwise no problem
08:06metagovBut I thought the symbol 'a', while created, wouldn't have been bound until after the overall (def ...) expression finished.
08:07fogus_`a` must have been bound previously no?
08:08metagovoh! right! I forgot I'm in a repl.
08:08fogus_:)
08:09RaynesDun dun dun.
08:09metagovI keep thinking I can't rebind symbols like they're read only or something.
08:11metagovSo, quitting the repl and trying it anew, I get the error I was expecting. Thanks :-)
08:12fogus_Public poll: If *you* were creating a unification library what would you do on a clash? 1) Throw an Exception 2) Throw a ClashException 3) Return a kw ::clash 4) other
08:14Raynesfogus_: Is scream and run in circles an option?
08:15fogus_That's contained in #4 :p
08:19fogus_Reading: http://stephen.wolfram.usesthis.com/
08:20hoeckfogus_: are there any other exceptions a unification can throw? If not, I would use a plain Exception.
08:21fogus_hoeck: Yes. It can also throw on a cycle. I'm currently going the ::cycle/::clash route, but am not completely satisfied
08:24hoeckfogus_: is this lib available somewhere?
08:24fogus_hoeck: not yet
08:33LauJensenfogus_: the clashexception sounds good to me
08:34nickikcan somebody help me with some namespace problems?
08:34nickikI have a namespace (main.players) with some records in it. Called nice and asshole (they are bots for a game).
08:34nickikIn the main.core I include it. (ns main.core (:use [main.players]))
08:35nickikSo far so goot but know I want to test it.
08:35fogus_LauJensen: I would like to avoid AOT if at all possible, but will if that makes the most sense.
08:35nickikThis is in the testfile:
08:36LauJensenOk
08:36nickik(ns titfortat.test.core (:use [titfortat.core] :reload-all) (:use [clojure.test]) (:import [titfortat.players nice]) (:import [titfortat.players asshole]))
08:36fogus_Another option of course is to throw Exception on one and Error on the other
08:36nickikbut in the testfile i cant get a new player like this (nice. [])
08:37LauJensenfogus_: To me the biggest concerns are always quality through predictability. I'm afraid passing keywords around etc can lead to misundertandings. An exception seems like the right response to something like that. But its a matter of taste I guess
08:38fogus_LauJensen: I think I agree
08:41hoecknickik: and whats the exception?
08:43nickik@hoeck No matching ctor found for class titfortat.players.nice
08:43hoecknickik: that means the (nice. []) call is wrong
08:44hoeckhas the wrong number of arguments
08:44hoeckfor each field there must be an argument in the ctor-call
08:44hoeck(defrecord nice [a b c]) -> (nice. 1 2 3)
08:45LauJensenfogus_: Jich Bickey ?
08:45hoeckif the class has not been imported, it would have been a "unable to resolve classname: nice" Exception
08:46fogus_Josh Bloch ;-)
08:47LauJensen:)
08:47LauJensenI knew it was a long shot going in :)
08:48nickik@hoeck thx, I'm an idiot. The error that caused the problem I resolve myself and than I had a other one and didn't notice it.
08:54LauJensenfogus_: Out of curiosity, what would he do in this case?
08:59fogus_He'd pick an existing Exception that corresponds to the type of problem. For example, a cycle could be likened to an IllegalStateException.
08:59LauJensenOk, makes sense
09:29cemericktechnomancy: I'm really surprised that you're recommending that people push personal copies of jars into clojars (looking at the lein readme)...
09:46bmhI'm interested in converting a bitfield into an IEEE float, but clojure bitops only work on integer types. Should I just be looking at doing this with the java interop?
09:47puredangerIf anyone's interested, I just published a short interview with Chris Houser http://thestrangeloop.com/blog/10/08/17/strange-loop-speaker-interview-chris-houser
09:54nickikshould I write unit-test for macros?
09:56esjyou should test everything :)
09:58bmhnickik: Just implement static type checking in the macro system. Take a look at Soft Typing by Cartwright and Fagan ;-)
10:03apgwozwhat's the best way to traverse a hiccup produced tree? i, for instance, want to pull out specific elements and get the text from them. it doesn't fit the xml produced by clojure.xml
10:07bmhok, java interop it is
10:11jfieldsis there a better way to do this? -
10:11jfields(deftest add-values
10:11jfields (is (=
10:11jfields {:a {:b 4 :c 7}}
10:11jfields (merge-with (partial merge-with +) {:a {:b 2 :c 3}} {:a {:b 2 :c 4}}))))
10:20pdk(doc reduce)
10:20clojurebot"; "
10:20pdkok who maintains clojurebot again
10:20pdkhiredman right
10:21pdk(doc is)
10:21clojurebot"clojure.contrib.test-is/is;[[form] [form msg]]; Generic assertion macro. 'form' is any predicate test. 'msg' is an optional message to attach to the assertion. Example: (is (= 4 (+ 2 2)) \"Two plus two should be 4\") Special forms: (is (thrown? c body)) checks that an instance of c is thrown from body, fails if not; then returns the thing thrown. (is (thrown-with-msg? c re body)) checks that an instance of c is thrown AND
10:42no_mindwith Oracle showing aggressiveness over Java patents, can clojure be dragged into Java patent minefield ?
10:43cemerickno_mind: Oracle has patents related to VMs, not languages. Clojure and other JVM languages aren't within spitting distance of that sideshow.
10:46Chousukeand why would oracle harass languages that can be used to write more software for their platform :P
10:46ChousukeMy guess is they target Dalvik because it's not compatible with the java platform
10:46apgwozi think they target Dalvik because they already have a dying mobile platform
10:50LuytI think they target Dalvik to squeeze out some $$$ from Google
10:51LuytBut it leaves a nasty taste in my mouth, and I frown when I see my system use BerkeleyDB or MySQL.
10:51RaynesI think they target Dalvik because they were bored and didn't feel like being creative.
10:55nickikif i have namespaces A, B and C. A uses B, B uses C. In C is a macro and i want to use that macro form a what do I have to do? Do I have to include (use) C in A?
10:55apgwozso, are zippers the way to go to traverse arbitrary trees even if you're not modifying them?
10:56no_mindfor whatever reason they are suing dalvik, they are still suing an entity which is making developer build more and more programs on there platform
10:56arohnerOracle is suing because they're not getting JavaME licenses from dalvik
10:57arohnerwhich used to be a decent source of money for Sun
10:58Raynesnickik: Yes.
10:58arohnerapgwoz: they can be. I've used zippers for scraping HTML
10:58apgwozarohner: so, it'd be a great way to scrape stuff from hiccup?
10:59apgwozare there any selector sort of interfaces on top of something like hiccup? i know enlive will do this against the xml structures
11:00nickikas far as I understand it the VM stuff the have patents on is common in many VMs (smalltalk ...) and the want to hit google. If the win google pay.
11:00nickik*they
11:01arohnerzf-xml works just fine against the HTML that hiccup produces
11:01fogus_arohner: Why would they get JavaME licenses from Davlik? Davlik is not JavaME right?
11:01apgwozzf-xml?
11:01apgwozahh
11:01apgwozzip-filter.xml
11:01apgwozcool
11:01apgwozi'll check it out
11:02arohnerfogus_: right, but dalvik is a substitute for javaME, taking money away from Oracle
11:04fogus_arohner: Competition hurts
11:04LuytHowever, Google has always made sure there wouldn't be any licensing troubles with Dalvik. This is the test if that worked.
11:12cemerickfogus_: I'd be very surprised if Google ends up being the white knight in all this. As it is, they've successfully pushed a Java-but-not-Java VM into the world that, in practical terms, serves their interests and not Sun/Oracle's, and probably not mine.
11:14fogus_cemerick: Maybe you could have asked them... I'm sure they would have thrown some cemerick love into the mix
11:15nickikmaybe they did it because the offical one sucks
11:15cemerickfogus_: Unlikely. Every now and then, instead of search results, I just get a white page that says "Suck it, cemerick" in bold type. :-(
11:16cemericknickik: That's just a little silly. Dalvik only recently got a JIT.
11:16fogus_Wow... my type is blinking. Is that better or worse?
11:16cemerickfogus_: BLINKING? That HTML is coming from inside the building! Get out!
11:18nickik@cemerick is the offical one fast? on most phones I had it seamd very slow
11:19cemericknickik: I've never messed with mobile stuff much, couldn't say.
11:21nickik@cemerick don't no either but the had some reason
11:21slyrusany other fnparse users around? I've been having fun with it.
11:21cemerickLots of reasons, I'm sure. We'll see if they turned out to be legal.
11:21slyrusand morning folks
11:29fogus_Jeez, not only is chouser a Vi user, but he also got his start in the TI-99/4A! What's next?
11:29slyrushunt the wumpus!
11:40arkhq: "What makes JoC unique?" a: "Fogus wrote it - what more do you need?"
11:49edbonddoes enlive have some specific function to get attr (:href) from node?
11:49edbondor it's ok to treat node as map and use get-in :attrs :href?
11:50dnolenedbond: that's the right approach, the node is just a map.
11:52edbonddnolen: thanks
12:05nickikhow to write a function that gets a nummer as input "n" and returns true in n% of the time
12:05nickikis there something like that in a lib
12:09qbg(< (rand-int 100) n)
12:11qbg,(reduce + (map #(if % 1 0) (repeatedly 100 #(< (rand-int 100) 33))))
12:11clojurebot29
12:11qbg,(reduce + (map #(if % 1 0) (repeatedly 1000 #(< (rand-int 100) 33))))
12:11clojurebot351
12:14technomancycemerick: it's true though; java on mobile devices is widely regarded as terrible
12:14technomancybefore android, anyway
12:14cemerickabsolutely agreed
12:15cemerickOf course, that's neither here nor there in court.
12:16technomancyheadius makes a pretty good case on his blog that the patents are absurd.
12:16technomancyof course ... they're software patents, so they're already absurd by definition. but they don't seem to hold a bit of water.
12:17nickik(< (rand-int 100) n) works nicely
12:17cemerickI'm of two minds about it. People always say "oh, that's obvious", when the people that filed the patent may have been the ones that made it obvious.
12:17qbgIf you want n to be real, you can use rand instead of rand-int
12:19arkhanyone one ever see an exception for cake like this? "Exception in thread "main" java.io.FileNotFoundException: .cake/project.log (Permission denied) (NO_SOURCE_FILE:0)"
12:19cemerickIn any case, I don't think Google deserves any pity, etc. They went into this with their eyes open, and they're big boys with a lot of money. Let 'em fight it out.
12:20arkhI'd rather see the fight avoided and patent reform take place instead
12:21cemerickThat ship sailed a looong time ago. :-)
12:22arkhViva La Revolución
12:23arkhagreed
12:24technomancyeh; "no more _software_ patents" seems to be working well for other countries
12:24arkhour democracy would work if people really used it :)
12:24arkh... but they don't :(
12:26cemericktechnomancy: I dislike policy that downgrades my profession to time-and-materials labor. If I come up with something that's truly novel, and I want exclusivity in the market, I don't see why I shouldn't have the same opportunities as the guy who designs a better screw.
12:26cemerickThe details are a complete mess, but that's where I'm grounded.
12:28technomancythen we can agree to disagree. you and I, we are good at that. =)
12:28cemerickyes, yes we are :-)
12:29cemericktechnomancy: can I surmise then that you'd prefer a purely FOSS world where support is your primary stream of income?
12:31technomancycemerick: and a pony, if you're asking.
12:32JorejiGiven (let [x 0] (let [x 1] ...)) - is there any way to access the outer binding of x (i.e. x==0) within ... ?
12:34cemerickJoreji: nope. Lexical scope is what it is.
12:34cemericki.e. no fancy tricks like OuterClass.this.field as in Java
12:36Jorejicemerick: Hmm, alright. Guess I'll just rename the var.
12:36JorejiThanks!
12:36no_mindIs there a templating engine in clojure which can use HTML files as input ?
12:38metagovno_mind: http://wiki.github.com/cgrand/enlive/getting-started
12:42no_mindmetagov, the doc says enlive is not a templating system but a html transformation library
12:43no_mindI need a templating system where code can be embedded into the template and templates can include other templates
12:44phobbsWhat is the difference between next() and more() for ISeqs?
12:47metagovno_mind: I'm thinking of using enlive as a templating system by combining html files + clojure files. The templating code, including embedding, appears in .clj files and the templates are just .html files.
12:48metagovSo, you get equivalent functionality but in two files instead of one.
12:48no_mindhmm, how will you achieve thing like, filling a select box options ?
12:49no_mindtwo files is okay with me
12:50metagovno_mind: I don't know about select box options specifically.
12:51metagovI'm, unfortunately, not that experienced with enlive :-/
12:52no_mindok
12:55metagovno_mind: I do know that enlive uses 'selectors' which give CSS-like access to the html: http://enlive.cgrand.net/syntax.html
12:56phobbsmore() returns PersistantList.EMPTY when empty and next() returns null.
13:00cgrandno_mind: (deftemplate my-page "html/page.html" [opts] [:select#id :option] (clone-for [opt opts] (content opt))) ; with your <select> having a dummy <option> in your file
13:01cgrandphobbs: more is lazy, it doesn't force evaluation of the "rest", next evaluates it and always returns nil when empty
13:14pdk(doc more)
13:14clojurebotPardon?
13:17phobbs(doc next)
13:17clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
13:42nickik(defrecord test-record [a b c])
13:43nickikhow to get from (test-record. 1 2 3) to "test-record"
13:43raeknickik: it is probably a good idea to make a constructor function
13:44raekthat fn could take as many or as few args as you, independently of how many fields the record has
13:45pdk(doc lazy-cons)
13:45clojurebotI don't understand.
13:45raekas Stuart Halloway pointed out in one of the currently active google group thread, protocols are only used in clojure as an implementation detail
13:46raekthe user doesn't need to know that protocols are involded
13:46nickikhow does that help me with the name? I want something better than (defrecord test-record. a b c name) (:name (test-record. 1 2 3 "test-record") to get to the name of a record
13:48raekyou want the name of the record type as a string?
13:48raekI thought you were asking about how to get away the dot from the constructor... :)
13:48raeksorry
13:49raekpdk: lazy-cons has been replaced by lazy-seq + cons (but you don't have to use cons, of course...)
13:56pdkdoes it affect anything if you drop the cons raek
13:57pdkat first glance i assumed lazy-cons would have been shorthand for (lazy-seq (cons ...
13:57pdk(doc lazy-seq)
13:57clojurebot"([& 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."
13:59raekpdk: lazy-seq only delays the evaluation of some sequence
13:59raekso you always need to put something in it
14:00pdkhmm
14:00raekmaybe an example would help
14:00pdkyeah so you need to have a sequence in the body of lazy-seq
14:00pdkwhich would be e.g. cons
14:00raekexactly
14:01raek(defn my-repeat [n x] (cons x (my-repeat (dec n) x)))
14:01raekeager version, don't do this ^^
14:02raekoh sorry, I'm really tired today, forgot the condition...
14:02pdkits the fun way
14:02pdksince it's eager it gets me excited to run this function
14:03raekhttp://gist.github.com/531174
14:03raekthere
14:04raekyou should always be able to get an eager version if you simply remove the surrounding lazy-seq
14:05raeklazy-seq simply returns something that evals and returns the body when you call seq on it
14:05raeksubsequent seq calls will be caches
14:06raekthis is also thread safe, of course
14:07raekhttp://gist.github.com/480608 <-- this can be useful to experiment with when the lazy seq are actually realized
14:58alpheusWhat's a good way to store configuration for a clojure program? Presumably I can just write clojure code and call load on the config file. But what's recommended?
15:02LauJensenalpheus: usually depends a little on who's reading it
15:34jfieldsis there any fn that reloads all of the current namespaces?
15:34jfields(user defined namespaces)
15:35technomancyjfields: there's not really anything special about user-defined namespaces; they're all first-class
15:35technomancyexcept clojure.core; that's zeroth-class
15:35technomancybut yeah, no such function
15:35jfieldsk, thx
15:36technomancyjfields: it'd look like this though: (doseq [n (all-ns)] (require [(.getName n) :reload]))
15:41jfieldstechnomancy, will that reload all ns's?
15:45chouser_you might want :reload-all instead of just :reload, or macros might not get updated in the right order
15:46chouseryou might want :reload-all instead of just :reload, or macros might not get updated in the right order
15:52AlmostObsoleteHi all, I want to install Clojure with SLIME on Ubuntu. I'm an experienced Emacs user. What's the best method/setup these days?
15:55raekit's recommended to start the swank server outside emacs (or more accurately, without swank-clojure.el, which is deprecated)
15:56raekthe swank server can be started with a project management tool, such as leiningen, cljr or cake
15:56AlmostObsoleteThanks raek, any suggestions on which of those to look at first?
15:56AlmostObsoleteWould this be a reasonable up to date setup? http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
15:57raekAlmostObsolete: I recommend to read the official swank-server docs first of all: http://github.com/technomancy/swank-clojure
15:57raekI use leiningen for my projects
15:58raekcljr can be neat if you don't want to create a project everytime you want to do something in clojure
15:59raekif you add :dev-dependencies [[swank-clojure "1.2.1"]] to you project.clj with leiningen, starting up a swank server is just a matter of running lein swank
15:59raek(after having ran lein deps)
15:59raekhttp://github.com/technomancy/leiningen <-- leiningen docs
16:00raeklast time i installed slime, I did it through ELPA
16:01raek(slime, slime-repl and clojure-mode are the packets you'd want)
16:01raekAlmostObsolete: that guide compiles clojure from source, wich is rarely necessary
16:02AlmostObsoletethanks
16:02AlmostObsoleteI guess I'd better start reading then
16:03raekhttp://www.assembla.com/wiki/show/clojure/Getting_Started <-- this has gotten pretty good
16:03raekanyway, use slime-connect to connect to the swank server from emacs
16:07AlmostObsoletethanks, I'll take a look at that!
16:32smokecfhraek: i recently found out that there is 'clojure box' which is a great way to get started; but it is not mentioned on the assembla site
16:44technomancysmokecfh: IIRC it's not cross-platform
16:44technomancybut then again, leiningen is only vaguely cross-platform
16:46smokecfhcorrect, 'clojure box' is for windows only. am i right in assuming that most clojure development is done on linux?
16:46technomancysmokecfh: hard to say, but going by bug reports and patch submissions, I'd estimate windows users as less than 10% for the projects I work on.
16:46kotaraksmokecfh: there are some windows guys, and also a lot of Macs
16:47technomancythat metric is probably a bit biased against Windows since there's a history of having a hard time with git on that platform though
16:48kotaraktechnomancy: there is was svn history before git. I don't think that is really a problem.
16:48LauJensenfogus_: Thinking about what we were discussing earlier, whats the definitive advange of using prexisting exceptions?
16:49technomancykotarak: well I was looking for a more gentle way to say "Windows users don't contribute as much on average" =)
17:07caljuniorMessing around with Obba (http://www.obba.info/) trying to use OpenOffice as a GUI for my clojure app.
17:09hiredmanclojurebot: restfn?
17:09clojurebotant clean and rebuild contrib
17:09caljuniorIs there any prior art in the clojure community on using obba?
17:11caljuniorOr any thoughts on whether it would be at all viable to call clojure functions via java via obba/openoffice?
17:24holowayhi
17:24holowayclearly a lame question, but i'm trying to call a function for every item in a vector
17:25holowayand it looks like for is the answer, but I'm clearly getting something wrong
17:26chousermap should do too
17:26chouser,(map inc [1 2 3 4])
17:26clojurebot(2 3 4 5)
17:30holowaychouser: thanks!
17:47ecyrbWhat's the proper / ideomatic way to do something like (zipmap (map first xs) (map second xs)) ?
17:48hiredmanapply hash-map
17:48chouserprobably (into {} xs)
17:49hiredmanas long as you are calling first and second on two element vectors there
17:49ecyrbyes
17:51ecyrbthanks guys. I don't know why I couldn't see that.
17:51ecyrbthough, hash-map is a confusing name.
17:52ecyrbI mean, I know it's in the core, but I keep thinking it returns a HashMap for some dumb reason.
17:52raekit reaturns a PeristentHashMap
17:53raek,(class (hash-map :a 1 :b 2))
17:53clojurebotclojure.lang.PersistentHashMap
17:53raek(modulo spelling)
17:57arkhif a transaction is retried multiple times with following: "(dosync (ref-set reference (Object.)))" is a java object generated with each try?
17:59raekyes
18:00raekonly ref access and agent sends are affected by transactions, afaik
18:00arkhfair enough ... back to the drawing board
18:00raekyou can do something like (let [o (Object.)] (dosync (ref-set reference o))) i guess...
18:01arkhoh yeah
18:01arkh:)
18:01arkhI must be staring at the screen for too long o.0
18:02ecyrbOh wow, I didn't realize they were true hash-maps. Karl Krukow's blog is really good.
18:03JorejiHey guys, I'm destructuring a map using {:keys #{k1 k2} :or {k1 0 k2 1}} - is there some way to have clojure raise an error when a key not in #{k1 k2} has been specified?
18:05nickikare the slides for this http://vimeo.com/9090935 somewhere?
18:05chousershould be :keys [k1 k2]
18:06MayDanielA set can be used too.
18:07chouserhm, really? I wonder if that can be relied upon.
18:07Jorejichouser: I've always used sets. Worked so far.
18:08chouserinteresting
18:11raekecyrb: this is how they are implemented http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/
18:12raekvectors: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
18:13raekoh sorry
18:13raekthat *is* Karl Krukow's blog
18:14raekdidn't see his name at first
18:14raekplease disregard the previous lines... :)
18:17ecyrbnp :)
18:28rhudsonyow, {:keys (a b)} works too. But a vector's the documented form
18:47raekhrm, it seems like clojure.contrib.apply-macro/apply-macro is broken
18:47raekjava.lang.StackOverflowError for the example in the doc
18:48raek...not that I need to use it
19:26hiredmanping?
19:26clojurebotPONG!
19:57bobbytekwhat's the point of the do form if its not needed in function definitions?
19:58mefestobobbytek: it can be handy for an if/else and you need to perform side effects in one or the other
19:59bobbytekjust a grouping mechanism?
19:59mefestoyeah
21:27bobbytekAnyone here use scala?
21:32seancorfieldbobbytek: yeah, i use scala
21:32bobbytekwhat sort of things do you use it for vs. clojure?
21:34seancorfieldi'm using it for XML manipulation - i needed high performance statically typed stuff for that piece of my application
21:34seancorfieldalso i've only learned clojure recently and haven't had much opportunity to use it in a production app
21:35bobbytekcool
21:35bobbytekI'm just learning clojure
21:35seancorfieldmostly i'm building web applications with cfml (running on railo, the jboss community project) and integrating java-based stuff where some other language makes my life easier
21:36bobbytekneat
21:36bobbytekI use groovy a lot for that type of thing
21:36seancorfieldjava is too verbose, i like groovy but it's dynamic and doesn't buy me much performance wise compared to cfml (on railo, at least)
21:36seancorfieldhence my choice of scala
21:37seancorfieldbut i'll probably use clojure for some stuff i have coming up in the next year (lots of dynamic data structures and probably a DSL for processing them)
21:38bobbytekya, definitely using groovy for performance is a step in the wrong direction
21:38bobbytekgreat for xml, db access, html, scripting, etc.
21:39bobbytekI'm interested in clojure right now, but I'm going to checkout scala later I'm sure
21:54bmhhey channel
22:12bmhI'm implementing my own random number generators (long story), and they all supply a method to output a pseudorandom bit. Is this a job for a multimethod? (I suppose that the haskell analog would be constructing a typeclass)
22:20phobbshello
22:20phobbsI am having a problem with nested maps
22:20phobbshash-maps, that is
22:21phobbsif I try: (:a {:a {:b 'aoeu}})
22:21phobbsI get: clojure/core$print_map$fn__4867
22:21phobbs [Thrown class java.lang.NoClassDefFoundError]
22:21phobbsand if I set a variable to be a hash-map and try to use it in a similar expression, I get the same result
22:21hiredmanno you don't
22:21phobbsheh
22:22bmhYeah, that code is cromulent.
22:22phobbsyou're right
22:22phobbsok, then slime or swank is messing something up
22:22phobbsthat's what I get in emacs
22:22phobbsit works on the command line
22:23phobbsIt gives me the same thing when I try to slime-compile-and-load-file
22:23phobbs=/
22:24hiredmanwhy are you so quick to blame slime?
22:24phobbsI have little imagination for what else it could be
22:24phobbswhat do you think it is?
22:25hiredmanyou're doing it wrong
22:25phobbsthanks
22:25hiredmanwell, given the choice between you doing it wrong, or slime doing it wrong, slime's not perfect but it sees a lot of use
22:26phobbsso if I copy and paste it into the repl, and it gives me that same error...
22:26phobbsam I doing it wrong?
22:27hiredmandunno what you are copy and pasting
22:27phobbswhat I just typed: (:a {:a {:b 'aoeu}})
22:27hiredmanwhat did you type before that? is it a fresh slime?
22:28phobbslet me try it on a new one
22:28phobbsI didn't realize it was possible to mess a repl up that much
22:29hiredman*shrug*
22:29hiredmangigo
22:32phobbsthanks
22:32phobbsthat worked
22:32phobbs=]
22:35wwmorganphobbs: the NoClassDefFoundError is often indicative of something wrong with your environment, as opposed to the ClassNotFoundException which is often a typo or classpath problems
22:43bobbytekpoo tastes bad
22:45phobbswwmorgan: thanks for that tip
22:45phobbshiredman: I also was doubting my slime or swank setup
22:45phobbsI've messed that up pretty badly before
22:45phobbsI also have a lot of existing emacs customizations which used to conflict with my clojure setup
22:46phobbsin fact, setting clojure up was so frustrating at first that I'm only now coming back to the language
22:46phobbsfor some reason it's much easier now =]
22:47bobbytekeclipse works fine for me :)
22:58bobbytekwhat's with the name clojure? Is it spanish or something?
22:58kwertiibobbytek: it's a pun on "closure"
22:59kwertiia block of code that closes (captures) the lexical bindings of the context in which it was created
22:59bobbytekhow is that a pun?
22:59kwertiithe pronunciation is similar
22:59kwertiiperhaps conflated with "conjure"
22:59bobbytekthat's a stretch as far as a play on words is concerned
22:59kwertiiyeah, well...
22:59bobbytekit's about as witty as groovy
23:00wwmorganthe "j" is for "java"
23:00bobbytekah
23:00kwertiiwwmorgan: that makes sense
23:00bobbytekindeed it does
23:00bobbytekI like it better now :)
23:00bobbytekperhaps even better if it stood for jvm :)
23:02bobbytekis a keyword just and abstraction to a constant unique integer?
23:37alpheusa unique identity