#clojure logs

2011-12-26

00:22clojure_0000is there a way to write OSX sreensavers in clojure? I have the Java Graphics 2D drawing part already; I just need it to run as an OSX screensaver
00:24replaca_clojure_0000: I have no idea, but if you can find out how to do it from java, the same mechanism should work for clojure
00:32clojure_0000yeah; now that I think about it, this is really a Java/OSX question, not a clojure question :-)
01:14clojure_0000is there a way to modify a (defrecord Cat [name age]), so that (Cat. a b) requires a to be a java.String and b to be a Java.int ?
01:14clojure_0000this is kinda like :pre/:post, but I want to do a :pre on Cat.
02:03clojure_0000a & b are both of defrecord Foo. Yet somehow, in my code (= a b) = false, whereas (.equals a b) = (.equals b a) = true. WTF is going on?
02:12replaca_clojure_0000: strange, that shouldn't be happening. = is the same as .equals except that it supports nil
02:12replaca_and my test with defrecord shows that to be correct
02:12clojure_0000replaca_: great; atleats shows I'm reading the documentation correctly
02:13clojure_0000I'm certain this is my fault; I however have no idea how to debug this (restarted repl + tried it = same bug(
02:13replaca_also: (defrecord Cat [^String name ^int age]) will do what you want
02:13clojure_0000are those hints; or enforced?
02:13clojure_0000let me try that first
02:14replaca_enforced: (->Cat "Seymour" "unknown) throws an exception
02:14replaca_(add a close quote there!)
02:16replaca_clojure_0000: what Clojure version are you running. I'm using 1.3
02:16clojure_0000I'm also on 1.3
02:16replaca_yeah, so it should be the same
02:16clojure_0000I'm not getting the same
02:16clojure_0000is there a in channel bot here?
02:17replaca_yeah, two I think
02:17clojure_0000(defrecord Cat [^String a ^int b]) (Cat. 23 45)
02:17clojure_0000does not give me an error
02:17clojure_0000maybe my clojure is fucked up
02:17replaca_but I'm not sure the sandboxes will let you use defrecord
02:17RaynesThey wont.
02:17replaca_quoth the expert
02:17Raynes:p
02:18replaca_clojure_0000: interesting, I only tried on the int side
02:19clojure_0000hmm; I'm now closer
02:19replaca_maybe it's only primitives or maybe my notation is wrong
02:19clojure_0000this is what the following code outputs: (println (type other)) (println (type n)) (println (= (type other) (type n))) --> foo.Status foo.Status false
02:19clojure_0000how is that possible?
02:19clojure_0000shit; if I require/load a class twice, does clojure generate different types? (I'm using reload-all all over the place)
02:20replaca_clojure_0000: yeah, it might
02:20replaca_require should only do it once, though
02:20replaca_load isn't as smart, iirc
02:21clojure_0000i'm using :require :reload-all ...
02:21replaca_yeah, I think you're doomed
02:21replaca_Clojure doesn't have much choice without decided that your types are identical for you
02:22replaca_*deciding
02:22clojure_0000replaca_: I failed to parse the above sentence
02:22replaca_so you load foo.clj the first time and it sees a defrecord, so it creates a type
02:23replaca_then you load foo.clj the second time and it sees defrecord again
02:23clojure_0000ah; then it reloads it; creates another defrecord
02:23clojure_0000I'm a moron
02:23replaca_it can't tell if that's the same def or if you changed it without working hard
02:23replaca_cause really clojure is just reading along as it goes
02:24replaca_so every new thing it sees is new by default
02:24replaca_I don't know what's happening inside the JVM here, though
02:24clojure_0000well
02:24clojure_0000that was an expensive lesson to learn ~ 3 hours of my life :-)
02:25clojure_0000how about :pre on defstruct constructors?
02:25replaca_some lessons are like that :(
02:25clojure_0000if I could get that to work; it would eliminate many of my clojure bugs
02:25replaca_dunno, I haven't used :pre at all
02:26amalloyreplaca_: definitely not true that the only difference between = and .equals is nil-safety
02:27Raynesamalloy: I'm tempted to add another auto reply that whines about mentions of defstruct. Would probably end up annoying people during nostalgic conversations.
02:27replaca_yeah, there's the stuff about collections and type-independence too
02:27replaca_anything else?
02:27amalloynothing that comes to mind
02:27Raynes#pedant
02:27replaca_amalloy: that one's good to note
02:28amalloyalso: what's going on inside the jvm is that clojure creates a new classloader for every unit it compiles. so there are two classes, both named Status and in the foo package, but from different classloaders
02:28replaca_though my real point was that clojure_0000's comparison of = and .equals results seemed valid
02:29amalloyclojure_0000: suggestion: treat records and structs as "advanced features", not "hey look i can make objects after all!"
02:29amalloys/objects/classes, i guess
02:29replaca_yeah, 99% of the time I am happy with maps
02:30replaca_and they work quite well with :pre and :post reasoning too
02:31replaca_oh, man, time for bed
02:31replaca_good luck all!
02:37clojure_0000amalloy: no no, I'm not going for "I can make objcts after all"; I'm going for "I can have types after all"
02:37amalloyhence my s/objects/classes
02:38clojure_0000I have refined my needs to be able to do the following: <private> (defrecord Foo ...) (defn Typed-Checked-Foo [ ] (Foo. ... )) </private> <public> (defn Foo. TypeCheckedFoo.) </public> <--- is something like this easily possible?
02:40clojure_0000what I need, is defn::defn- = defrecord:: ???
02:40lazybotclojure_0000: Oh, absolutely.
02:43clojure_0000alternatively:
02:43clojure_0000how do I overwrite the constructor of a defrecord?
02:44clojure_0000minds that wnat to implement haskell within clojure wants to know :-)
03:12clojure_0000grr
03:12clojure_0000no one in theworld knows how to do type checking on a clojure def struct constructor?
03:22amalloyclojure said it doesn't want to do static typing with you. no means no, man
04:29clojure_0000so I get an error in the repl like:
04:29clojure_0000(ClassCastException ..... )
04:29clojure_0000and there's no *.clj line associated with it
04:30clojure_0000only a Util.java:104
04:30clojure_0000how do I get a stack frame out of this?
04:30clojure_0000I wnat to know which *.clj line caused this error so I can fix it
04:36clojure_0000fixed
04:36clojure_0000error in (ns ...)
04:40morphlingclojure_0000: you probably used a list where you should use a vector in your (ns)-form
04:43clojure_0000yeah; I wote [( ... )] instead of [ ... ]
08:13clojure_0000I realize this is bad practice, but is there a way to say:
08:13clojure_0000(:require foo.*) ?
08:13clojure_0000basicaly I want to require _ALL_ packages, ie.. foo/**/*.clj
08:19thorwilclojure_0000: afaik no. you should use require and use in a way that makes it clear in the code what comes from where, anyway
08:46clojure_0000thorwil: a blanket require still makes it clear where it come sfrom, since by default, all names have their paths encoded within
08:47clojure_0000not being able to do a blanket require actualy encourages me to ... not have lots of little files lying around
08:47clojure_0000which is bad; since I wnat to have code split quite a bit
08:51thorwilshouldn't said code split be much about what you have to require where?
08:52clojure_0000lots of decomposition = more files = more args to require = too lazy to type = want a blanket require
09:11TimMcJust use slamhound. :-)
11:28TimMcIs xerial.org the place to get sqlite-jdbc?
11:29TimMcOr should I use zentus?
11:39RaynesTimMc: Teach me how to use Enlive.
11:45TimMcRaynes: Pssh, *now* you ask. Can't though, I'm on a train with really shitty wifi/
11:45TimMcalso, I don't understand Enlive yet.
11:45RaynesYeah, I'm not sure I quite understand how anybody possibly can.
11:45RaynesBut meh.
11:46weavejesterIsn't enlive just (at selector transformer)?
11:46TimMcI intend to write a doc for Enlive that groups the API into different categories.
11:46TimMcmaybe invent some nomenclature
11:46TimMcweavejester: Soemtimes that transformer does something, sometimes it returns a closure to do something.
11:47Raynesweavejester: I don't know, man. I read about a paragraph of dnolen's tutorial and hid behind hiccup.
11:47neotykGood morning everyone!
11:47RaynesI think I got to "This would allow us to easily implement template inheritance which we’ll talk about later (grin).", facepalmed, and promptly gave up.
11:47weavejesterI thought the transformer was just a function that modified a clojure.xml data structure
11:47Vinzentweavejester, selectors are pretty hard to write, imo
11:49weavejesterAdmittedly I haven't played around with enlive a whole lot.
11:49neotykweavejester: I've seen your fork of autodoc, did you managed to get it to work on 1.3?
11:50weavejesterneotyk: No, I gave up and wrote my own doc generator, codox
11:51Raynesweavejester: What the shit. I didn't know about that.
11:52neotykweavejester: cool, will take it for a spin now
11:52weavejesterRaynes: I created it for Ring, because I couldn't get autodoc to work
11:52weavejesterIt generates docs like: http://weavejester.github.com/compojure/
11:52weavejesterAnd: http://mmcgrana.github.com/ring/
11:52Raynesweavejester: We've been looking for something new for Noir because... well, we can't get autodoc to work.
11:52neotykweavejester: looks nice !
11:53Raynesweavejester: I think this will do fine. You need to publicize this.
11:53neotyknobody can
11:53weavejesterRaynes: I guess I should write up a Clojure group post on it then :)
11:54weavejesterYou should just be able to include codox 0.3.0 as a dependency then run "lein doc"
11:54weavejesterI haven't got around to adding options to customize the output at all
11:54weavejesterBut I'll accept patches
11:56Raynesweavejester: You missed a great opportunity here. You could have made the command 'lein dox'
11:56neotykweavejester: good for yak shaving
11:56weavejesterRagnor: I thought about that :) - But I wasn't 100% sold on the name
11:57weavejesterBut I couldn't think of any better name
11:57Raynesweavejester: Codox explodes on noir. :<
11:57weavejesterRaynes: What does it say?
11:57RaynesException in thread "main" java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in fragment at index 25: noir.core.html#var-route->name
11:57RaynesI can make an issue if you'd like.
11:58neotykweavejester: works like promised :)
11:59weavejesterRaynes: Ohh
11:59Raynesweavejester: https://gist.github.com/1521648 Should be this code it goes boom on.
11:59RaynesI guess there is still some old autodoc metadata in there.
11:59weavejesterRaynes: Yeah, I can see why. It probably doesn't escape the ">" character
12:00weavejesterRaynes: And I don't have any macros or functions with that character in Ring or Compojure.
12:00weavejesterHang on, let me just add a URL-encode in there...
12:00RaynesThis is why you announce things. People test them. :p
12:01weavejesterRaynes: I was meaning to... eventually...
12:05weavejesterRaynes: Hm, odd, I just grabbed noir master and codox 0.3.0 seems to work on it...
12:05Raynesweavejester: This var was added on the 1.3 branch.
12:06weavejesterRaynes: Oh, right. Let me switch branches then
12:07TimMcweavejester: The selectors are easy. I want docs on the transformers.
12:07TimMc(and back I go into cellular shadow)
12:09Raynesmdeboard: You've got the creepiest twitter picture I've ever seen.
12:10neotykweavejester: also H.A.C. is using codox now http://neotyk.github.com/http.async.client/doc/
12:11RaynesOoh, that's still around? I haven't heard anything about it in a while.
12:12neotykRaynes: indeed, I was kind of busy :)
12:12neotykbut yes, next rel will have 1.3 comat and maybe WS client
12:20weavejesterRaynes: Try codox 0.3.1
12:20weavejesterRaynes: It should work now
12:21Raynesweavejester: We have liftoff.
12:22RaynesOmgdocs.
12:23Raynesweavejester: This looks great. I'm going to run it by Chris. I'm sure you'll see patches and such from us in the not-so-distant future.
12:24weavejesterRaynes: I look forward to them :)
12:28pandeiroRaynes: is there a more intelligent way to debug noir stuff than throwing printlns all over?
12:29RaynesThat's a pretty common way of debugging most Clojure code.
12:29pandeirook that it is then... i thought maybe there was a logging package i was missing
12:30Raynespandeiro: Well, someone actually wrote something like that recently. Let me look it up.
12:31pandeirohttps://github.com/ibdknox/noir/pull/63 ?
12:32Raynespandeiro: Yeah, that's it.
12:32RaynesI don't know anything about it, but it says 'logging', so it might be helpful. :)
12:34weavejesterI've been playing around with the idea of creating a "component" from a transformer function and Ring middleware.
12:35pandeiroweavejester: for logging?
12:35weavejesterpandeiro: Oh, no. Something else.
12:35pandeirosorry, got logging on the brain :)
12:37weavejesterI was thinking about how to combine a HTML snippet with server-side code.
12:37weavejesterLike how a text input might have a validation server-side
13:11clojure_0000I am writing my own macro. I want to take a symbol, and append other chars to it, i.e. Cat -> Cat_ and Cat -> Cat. How do I do this?
13:12Vinzent,(-> 'cat name (str "_") symbol)
13:12clojurebotcat_
13:13clojure_0000,(symbol (str (name 'Cat) "_"))
13:13clojurebotCat_
13:13clojure_0000Vinzent: got it; thanks
13:13Vinzentclojure_0000, but it's usually not a good idea, i think
13:13clojure_0000Vinzent: why not?
13:14clojure_0000in this particular case, "clobbering names" should be okay -- I'm writing a maco on top of defmacro
13:14clojure_0000so the clobbering, if it happens, would be intentional
13:14clojure_0000i.e. (myDefRecord Cat ...) would purposely create a Cat_ that does type checking before clalint Cat.
13:24Vinzentclojure_0000, probably I misunderstood you, but is it possible to use protocols here?
13:28dabdI am trying to use an http-agent but the following code hangs the REPL: https://gist.github.com/1521872
13:29dabdcould someone please check it?
13:29dabdty
13:29neotykdabd: if you would use http.async.client I could help
13:30dabdneotyk: thx I might try it but I would like to understand why http-agent is not working for me.
13:32dabdin my example h is http-agent and ds is duck-streams
13:37clojure_0000how can I construt a function that takes a vector and outputs only every 2nd element
13:37clojure_0000i.e. it outputs v[0], v[2], v[4], ...
13:37clojure_0000so it's like a filter; but filters on the index
13:37clojure_0000rather than the content
13:40Vinzentclojure_0000, ##(keep-indexed (fn [i x] (when (even? i) x)) [:a :b :c :d :e])
13:40lazybot⇒ (:a :c :e)
13:45clojure_0000, (doc ##)
13:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
13:46clojure_0000Vinzent: what is this ## ?
13:46Vinzentclojure_0000, it's just for lazybot
13:47RaynesIt makes lazybot ##(println "evaluate the") code that comes after it.
13:47lazybot⇒ evaluate the nil
13:48TimMcclojure_0000: How else would lazybot know what to evaluate?
13:48RaynesHe could use magic.
13:48Raynesmagicbot
13:48clojure_0000mind-reader-bot
13:50Raynes"Powered by Clojure, Noir, MongoDB and the cries of children the world over."
14:10clojure_0000is there an idiomatic way to take a list of 2n elements; and create a list of n elements, each of which is a pair?
14:11clojure_0000i.e. (0 1 2 3 4 5 6 7) into ((0 1) (2 3) (4 5) (6 7)) ?
14:11Raynes&(partition 2 [1 2 3 4 5 6 7])
14:11lazybot⇒ ((1 2) (3 4) (5 6))
14:11clojure_0000is & = ## ?
14:11RaynesYeah, it's another lazybot prefix.
14:17TimMcclojure_0000: & is the start-of-line eval trigger, ## is the inline eval trigger (and doesn't respond to as many forms)
14:17clojure_0000i have a dumb question
14:17RaynesI was tring to think of a non-confusing way to explain that, but decided against it.
14:17clojure_0000why is ~ chosen as the unquote char?
14:17clojure_0000it feels very RSI -inducing ish
14:17clojure_0000the way I have to contort my left hand
14:17clojure_0000to hit shift + ` at the same time
14:18RaynesIf you use it enough to cause RSI, you're writing code in the wrong language.
14:18clojure_0000isn't macros part of lisp?
14:18TimMcclojure_0000: Presumably because , was co-opted as whitespace for readability and ~ is on the same key as `.
14:18RaynesYes, but you shouldn't use them enough to cause RSI.
14:18arthurdentureclojure_0000: hit shift with the opposite hand?
14:25clojure_0000darn it; looks like I'm going to have to learn how to type properly
14:45dabdI have the following code https://gist.github.com/1521996 to download a bunch of files using HTTP GET. I would like to create a standalone uberjar so I ran 'lein uberjar' but when I run the resulting jar with 'java -jar jwget-1.0.0-SNAPSHOT-standalone.jar "http://download.thinkbroadband.com/5MB.zip&quot; "http://download.thinkbroadband.com/10MB.zip&quot;' it downloads the files but the jar does not return terminate in the shell. What might be the cause?
14:45dabd ty
14:48huahaiy_\quit
14:51clojure_0000is there a short hand for: (fn [x] (apply f x)) ?
14:51clojure_0000i.e. I'm looking for g s.t. (g f) = (fn [x] (apply f x))
14:51clojure_0000seems like g should have a name
14:52hroarkedabd: Agents run in a pool of non-daemon threads. These will keep your JVM alive. You need to call shutdown-agents, this will let your JVM exit.
14:52dabdhroarke: ty!
15:16TimMcclojure_0000: "g" is spelled "partial apply"
15:17TimMc&((partial apply +) [1 2 3 4 5])
15:17lazybot⇒ 15
15:17romanandreghas anyone tried to run test.generative using leiningen (lein run)
15:17romanandreg>
15:18romanandregI'm trying to find somewhere that tells me how to run clojure.test.generative with clojure.test but no luck so far
15:47clojure_0000for functions, I can alias w/ (def short some.path.cat.dog/func); can I do something similar with macros?
15:47clojure_0000for functions, I can alias w/ (def short some.path.cat.dog/func); can I do something similar with macros? or am I forced to write (defmacro short [ & args] `(some.path.cat.dog/macro ~@args))
15:52tmciverclojure_0000: no need to alias that way. You can :use in the namespace declaration or use :as with :require.
15:56tmciverclojure_0000: see http://clojuredocs.org/clojure_core/clojure.core/use#example_551
16:03Xenocorphello?
16:03clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline Xenocorp
16:04Xenocorpis anyone here?
16:04Xenocorphttp://pastebin.com/qygkjNix - could someone check that out for me and see where I am going wrong?
16:08arthurdentureXenocorp, I get an answer when I evaluate that. can you more thoroughly describe "going wrong"?
16:11Xenocorpindeed. I was running it through emacs, the eval line is only 1 line so I just saw the nil. My algorithm is wrong, but I will fix that :)
16:12arthurdentureI'm using a library where lots of different namespaces get immigrated into a single ns "overtone.core". Is there a way to find the original definition site of a given immigrated name?
16:12arthurdenture(other than grep)
16:13technomancy_arthurdenture: depends on your editor; it's M-. in emacs/slime.
16:14technomancy_Raynes: you pinged me like ages ago?
16:15arthurdenturetechnomancy_, thanks, that worked! i guess i was assuming the way would be via the repl
16:15Raynestechnomancy_: Yeah. I was trying to run a website with 8 kabillion dependencies on Heroku, but `lein run` keeps trying to pull down deps but it times out because the app doesn't bind to a port within 60 seconds.
16:16technomancy_Raynes: curious, there should be no dependencies fetched at runtime; they should all be downloaded at slug-compilation time.
16:16RaynesYeah, it does it at slug compilation time and when lein run is an.
16:16Raynesran*
16:16technomancy_can you paste project.clj?
16:16RaynesSec.
16:17Raynestechnomancy_: https://github.com/4clojure/4clojure/blob/f/1.3/project.clj
16:17RaynesI'm guessing checksum-deps is the problem?
16:17RaynesI didn't notice that (because I didn't put it there) until now.
16:18technomancy_that'd be my guess; can you see if you can repro without that line?
16:18RaynesSure
16:21Raynestechnomancy: That was it.
16:21technomancyRaynes: I'll see if I can debug further tomorrow; for the time being at least there's a workaround.
16:22Raynestechnomancy: Well, it wasn't anything critical. I was just playing around with it and noticed it and figured it might be a bug.
16:22Raynestechnomancy: One question: the free hours you get are per-app, right? Not per-account?
16:23technomancyRaynes: I believe so but not confidently enough to put any money on a wager
16:23RaynesHeh
16:24technomancyby default you're getting 1.5.2, but I've got my apps running on the 1.6.2 branch of the buildpack, so it's been tricky for me to repro that issue in particular
16:25Xenocorphttp://pastebin.com/qN4UyxdD for http://projecteuler.net/problem=1 if anyone's interested
16:25Raynes"Basic usage of Heroku is free. Each app you create has free access to 750 dyno hours per month and a 5MB database."
16:26Raynestechnomancy: ^ Awesome. I was curious because I'll be deploying a new heroku app soon.
16:26Raynes(not 4clojure, in case anyone is wondering)
16:29Xenocorpdoes anyone know if there will be an updated version of clojurebox to 1.3?
16:30technomancyI don't think clojurebox is maintained
16:30Xenocorpno, i know. But I'm sure it won't be much work to package it up
16:30Xenocorpit seems like the regular emacsW32 install + a clojure setup /.emacs.d folder
16:32Raynesamalloy: Y U NO SAY HI?
16:32RaynesI didn't realize you were around.
16:33technomancyXenocorp: using clojure directly is discouraged these days
16:33Xenocorp@technomancy can you explain that a bit more?
16:34Rayneshttps://github.com/technomancy/leiningen
16:34technomancyXenocorp: clojure is really just a library rather than an application designed for end-user use
16:35Xenocorpa library for which language?
16:35technomancya JVM library
16:35technomancyI guess in this case you could say Emacs is the launcher
16:36Xenocorpehh, I'm confused. You're treating the JVM as a platform that runs, what, exactly?
16:36XenocorpI thought you would label Clojure as a language in it's own right, correct?
16:36technomancyit's a language implemented as a library
16:36RaynesYes, but Clojure doesn't have a decent end-user interface.
16:36RaynesI think you're using the word 'library' in a confusing way, technomancy.
16:36technomancymost languages come with a launcher designed for end-user consumption, but clojure does not.
16:36XenocorpI'm a noob to both clojure and the jvm, so bare with me.
16:37technomancyXenocorp: do you know ruby?
16:37XenocorpNo, Python is the only language I 'know'
16:37Xenocorpbut I'm a fairly advanced user
16:38XenocorpPython has the interpreter, ran through python.exe on Windows. Is this what you're referring to as 'the user-interface' ?
16:38technomancyyeah
16:38Xenocorpok, Clojure has clojure-*.*.*.jar
16:38Xenocorpdoes that not count?
16:39technomancyimagine if instead of running python.exe you had to write a shell script for anything you wanted to run that set LD_LIBRARY_PATH to point to wherever python was installed
16:39Xenocorpok
16:40RaynesXenocorp: Clojure's jar has an executable portion for starting a REPL that isn't even wrapped by readline. The interface is terrible, but Leiningen fills all of the holes in it.
16:41XenocorpI've not used leiningen, I don't use the REPL either (personal preference)
16:41XenocorpPython has a REPL and I find it horrible, I presumed Clojure's would be the same.
16:41RaynesHaha.
16:41dnolenXenocorp: heh, when it comes to Lisps, the REPL is everything.
16:42XenocorpLike I said, I'm a noob (== (time-spent) 0) :: TRUE
16:42RaynesThat's less of a personal preference and more of a "totally missing everything" sort of thing. :p
16:42XenocorpHow so?
16:42RaynesWhat dnolen just said.
16:43Xenocorpbut that doesn't explain anything, it's a statement?
16:43technomancyprogramming without a repl is cybernetically unsound no matter the language.
16:43RaynesAnd that wasn't a question.
16:44amalloyXenocorp: if you don't have a repl, you can't answer simple questions like "hm, what happens if i call foo with various args?" you have to set up a whole program that prompts for args, calls foo, and prints the result
16:44RaynesInteractive development is something that can't really be explained to you. It's something you have to experience.
16:44RaynesIf you experience it, there isn't a question like "why a REPL" that makes sense.
16:45XenocorpI have experienced it, I find that entering things that require >1 line in a single line REPL the most painful experience ever. If I can write it out in a file, hit a single button to run it, what's the difference. When it's running, sure, a REPL is great. Before that, nope.
16:46amalloywell that's not crazy. emacs's repl is a multi-line editable area
16:46XenocorpI've just started with clojurebox today
16:46amalloy(and has a button for sending a file to the repl)
16:47dnolenXenocorp: you can interact with the REPL w/o always typing into
16:47Xenocorpwith using the arrow keys/
16:47Xenocorp?
16:48dnolenXenocorp: all the good LISP environments support many ways of sending code to the REPL
16:48XenocorpI never said a repl is a waste of time, just that it's not my main programming interface.
16:49Xenocorpand I've been using clojure for about 2 weeks, only.
16:49choffsteinCan anyone point me to a good post / article / book on writing performant clojure? I've done some profiling with JVisualVM and seem to be spending a lot of time with reflections. I've set *warn-on-reflections* and gotten rid of everything I could. But I would love to read a page about where I can use type-hints, best uses of Java arrays, or when it is better to use maps vs records.
16:49Xenocorpchoffstein: There's a section about it in Practical Clojure on Apress pub, about 30-70 pages.. iirc
16:50choffsteinXenocorp: Awesome. Thanks.
16:54Xenocorpchoffstein: I just checked. 9 pages, but it covers type hinting
16:54Xenocorpsorry
16:58choffsteinNo worries. I just noticed an incredible speed-up in an app I am writing going from a generic map-of-maps to a map-of-records with type-hints. That sort of thing I never would have really "guessed." I'm trying to find more stuff like that.
17:01Xenocorppractical clojure seems like a decent book. I need something a little more basic, but it sufficed to get me 'hooked' on clojure.
17:02mbaiis there an enhanced clojure repl that has built in doc, completion, sugar. some equivalent of ipython for python.
17:02dnolenchoffstein: what are you using the type hints for? field access?
17:03choffsteincomputations on the fields
17:03choffsteinso something like (math/abs (:field record))
17:04dnolenchoffstein: another approach is to definite a protocol for those accessors
17:04choffsteindnolen: Can you elaborate?
17:04dnolenchoffstein: then you don't need type hints
17:04choffsteinLike, create a protocol with type-hinted accessor functions?
17:05dnolenchoffstein: (defprotocol IPoint (x [this]) (y [this]))
17:06akhudekmbac: I don't think so, but you can get documentations using the "doc" function: e.g. (doc some-fn)
17:06akhudekerr mbai
17:06mbaierr?
17:06clojure_0000what is a good rule of thumb for naming stuff to NOT conflict w/ java classes? For example, I have a defrecord that is a wraper about KeyEvent; but what shoudl I name it?
17:07clojure_0000I want to name it KeyEvent, since it's basically what it is
17:07clojure_0000but then there's already java.awt.event.KeyEvent, and I think having both would be confusing
17:07mbaiakhudek: I found cljr
17:07mbaiThere's also the built in repl in intellij idea.
17:08akhudekyes, the intellij repl is pretty nice
17:08akhudekthe enclojure repl is not as nice
17:08clojure_0000no one has advice on naming?
17:08choffsteindnolen: I don't think I understand protocols well enough to understand how that is helpful. Any links you can share?
17:08amalloychoffstein: (:field record) is taking limited advantage of its record-ness. (.field ^MyRecord record) will be at least a little faster
17:08clojure_0000iirc, all what protocols says is: this object implements these functions
17:09mbaiakhudek: I was just about to install enclojure, but the author warns against using latest version of netbeans.
17:09clojure_0000how does defprotocol differ from java interfaces?
17:09dnolenchoffstein: amalloy: (.field ...) is way faster than (:field ...)
17:09mbaiI've used netbeans for a long time, but the plugins are never maintained.
17:09dnolenbut (field ...) is just as fast as (.field ...) if field is a protocol fn
17:09akhudekmbai: I would recommend against encjoure at this time. The author is correct, the netbeans 7 version has some bad bugs.
17:10choffsteinOhhh. Wow. That is hugely helpful.
17:10akhudekthe 6.x version is ok, but has problems with clojure 1.3 as it won't start a repl without the old contrib
17:10dnolenclojure_0000: you don't need to worry so much about naming - everything in Clojure is namespaced.
17:10akhudekalso, the repl has some real issues with it's syntax parsing
17:10choffsteinSo, either use (.field ^MyRecord record) or make my record follow a protocol?
17:10amalloydnolen: doesn't that put some strain on the jit to inline? i'd be surprised if it were really *just* as fast, though sure it would be close
17:10akhudekIf you print \" to standard output, it will think everything is a string.
17:11dnolenamalloy: seems just as fast to me.
17:11mbaiakhundek: understood. IDEA it is.
17:11akhudekIt also becomes very very slow at that point as I guess the algorithm for parsing has bad behaviour on long strings.
17:11dnolenchoffstein: keyword lookups are optimized, but for performance critical stuff yes make a protocol for the accessors
17:12choffsteindnolen: Okay, let's assume I am really stupid. Can you show me how you would use that IPoint protocol?
17:13amalloydnolen: just benched it a bit and the protocol version takes ~3 times longer. putting together a gist in a sec
17:13dnolenchoffstein: (x some-point), however if you're doing some primitive math, that approach is not so good and your type-hint approach is better.
17:14amalloyhttps://gist.github.com/1522199 outlines the approach i think dnolen is suggesting, and my timing results
17:14choffsteindnolen: It's a lot of accessors, data being passed around, then some primitive math. Wish I could share, but it's company code :-\ The performance speed-up isn't necessary -- just nice
17:16choffsteinAny such optimizations for setters? :D
17:16amalloyof course
17:16dnolenamalloy: those are the timings I've seen, but it probably depends on machine, JDK, etc.
17:16amalloythough the answer depends on whether you really mean setters, or you mean immutable updates
17:17dnolenchoffstein: setters are really a last ditch thing since that's playing with fire.
17:17choffsteinHmm. Well, assoc on a record
17:17amalloysure. i think the protocol dispatch here is something the JIT could be smart enough to inline, then optimize
17:17dnolenamalloy: I meant those aren't, sorry.
17:17amalloychoffstein: you might want to borrow a tool from `useful`, called assoc-record
17:18amalloyit does the optimizations for you
17:18choffsteinawesome, thanks
17:18amalloyand also generates the optimized accessor functions
17:18amalloyhttps://github.com/flatland/useful/blob/develop/src/useful/datatypes.clj and sample usage at https://github.com/flatland/useful/blob/develop/test/useful/datatypes_test.clj
17:20amalloypersonally i hate the update-record syntax and don't really suggest using it, but the rest is pretty handy
17:20dnolenamalloy: choffstein: https://gist.github.com/1522208, OS X, JDK 7, 2.6ghz dual core i7
17:20choffsteinmuch appreciated
17:22amalloydnolen: yeah, must be a jvm thing. when i run your code the difference between (.a f) and (a f) is even more pronounced than in my code
17:22amalloy40ms and 170ms respectively
17:23amalloyon Ubuntu openjdk 1.6, slow-ass old cpu
17:24rplevyI'm curious about updating leiningen to depend on 1.3. Are there problems that have held this up, or is just a to-do that hasn't been done yet?
17:24ibdknoxrplevy: many of the plugins rely on contrib
17:25ibdknoxupgrading lein itself is easy
17:25ibdknoxupgrading nearly every plugin? that's going to take some time
17:25ibdknoxunfortunately :(
17:26rplevyok, so basically what is holding it up is going down the list of plugins and eliminating their contrib dependencies.
17:26clojure_0000I have (:require foo.bar); then somewhere later, I use foo.bar/kick inside of a _macro_ -- do I have to do something special when using functions within a macro? [some lisps have multi level compilation; so depending on whether it's within a macro, I have to import the function in a special manner]
17:26rplevybut they can't be updated to 1.3 yet
17:27ibdknoxrplevy: last I knew, technomancy is basically waiting to make that transition for the 2.0 release
17:27rplevyI see
17:28rplevyare all of the plugins listed on the lein plugins page on github?
17:28rplevyI can't think of any that aren't anyway...
17:28ibdknoxmost likely not
17:28ibdknoxbut that ought to be the majority
17:28rplevyok
17:29amalloyclojure_0000: no
17:32ibdknoxdnolen: done with cljs, clojail (only works in chrome, for some reason): http://blazing-flower-2726.herokuapp.com/
17:33ibdknoxdnolen: and little example code: https://gist.github.com/1522225
17:34clojure_0000amalloy: it was a diferent error
17:34dnolenibdknox: that's neat!
17:34clojure_0000I'm not yet versed in deciphering clojure's error codes yet.
17:35choffsteinIt's hard to profile when my network is running at 1.03KB/sec … sigh
17:38ibdknoxdnolen: I'm working on an interactive teaching environment :)
17:39dnolenibdknox: that is a-w-e-s-o-m-e :)
17:40choffsteinDoes a type-hint for the value being returned by a function go before or after the function name?
17:40dnolenchoffstein: it comes before the arglist
17:41dnolenchoffstein: well if you're talking about primitive returns
17:41choffsteindnolen: …and if I am talking about an object? I am looking at an example in practical clojure that has #^String after defn
17:41dnolenchoffstein: you can also type-hint the var of the fn to help the compiler
17:42Xenocorphi, does anyone know a decent DEAD TREE book for learning clojure syntax?
17:42dnolenchoffstein: but you're not really hinting return values (i.e. doesn't work higher order)
17:42choffsteindnolen: type hint the var of the fn … that has to do with every symbol having a var and a fn, right?
17:43dnolenchoffstein: not quite. every top level definition is stored in a var.
17:43dnolenchoffstein: the compiler looks at the var's metadata to see if it can avoid reflection.
17:44choffsteinSo … what's the difference between (defn #^String greeting [] "hi!") and (defn greeting #^String [] "hi!")? Because this is confusing the crap out of me.
17:45dnolenchoffstein: it's confusing.
17:45choffsteindnolen: If there is a book or article you can refer me to, I'm happy to go reading on me own and stop annoying you :)
17:45dnolenchoffstein: I believe both forms work.
17:45dnolenchoffstein: there's no book on this stuff that I'm aware of.
17:45dnolenchoffstein: also ^String is preferred now.
17:46choffsteinhmm… can I pay you to write an article on it? :D
17:46ibdknoxhaha
17:46choffstein…shit, that isn't a bad idea. have a website with "bounties" for answers. People can pledge a certain amount for an answer, and the community votes if the answer is adequate for a release of the $$ :)
17:46dnolenchoffstein: if you search the ML I've written many times on Clojure perf, also I've got some posts on dosync.posterous.com
17:47ibdknoxchoffstein: it's been tried before
17:47dnolenchoffstein: also the Clojure alioth benchmarks are a good source of ideas. core.logic also has a bunch of things in it I've learned from optimizing Clojure.
17:47choffsteinibdknox: Of course it has. I have never had a single original idea, nor a single good one ;)
17:48choffsteindnolen: Awesome. I'll check that out. THanks :)
17:48ibdknoxhehe
17:48clojurebotTitim gan éirí ort.
17:48ibdknoxchoffstein: none of us have ;)
17:55Xenocorpcan someone give me a rundown of what lein is?
17:55ibdknoxXenocorp: it's a tool that lets you create, run, and manage clojure projects at the command line
17:55ibdknoxXenocorp: it's also the quickest way to get a repl up
17:56Xenocorpinteresting
18:03replaca_ibdi
18:03replaca_~/////
18:03clojurebotI don't understand.
18:04replaca_sorry, network prrobs
18:05replaca_ibdknox: I'm prepping a new release of autodoc. Any issues besides version numbers that are burning a hole with you.
18:07choffsteinAnyone seen an error like this before: my.namespace.MyRecord cannot be cast to my.namespace.MyRecord ?
18:07replaca_did you reload the def?
18:08choffstein*le sigh*
18:25rplevyI just cloned the 53 leiningen plugins repos listed on https://github.com/technomancy/leiningen/wiki/Plugins to analyze their dependencies. Out of 53, 16 of them directly depend on contrib in project.clj
18:26ibdknoxtechnomancy: ^^
18:26alexbaranoskyrplevy: hey Rob
18:26rplevyhe
18:26ibdknoxreplaca_: version numbers?
18:26rplevy*hey
18:28replaca_ibdknox: well, the fact that the current released version wants to be in clojure 1.1
18:28replaca_and therefore doesn't build with newer things
18:29ibdknoxreplaca_: ah yes that makes things difficult. My biggest complaint was that I could never find one release to definitely use, I'm using someone's fork right now and it works only part of the time :(
18:29replaca_ibdknox: I see that you're using a version that Rayne pushed to get around that
18:29ibdknoxyeah
18:29replaca_k, I'm trying to iron that out
18:29Raynes(a version that I don't remember pushing and have no idea why)
18:30ibdknoxRaynes: I was wondering about that :p
18:30replaca_I'm about to do an interim release that will help at least some
18:30replaca_(though maybe not 100% with leiningen)
18:37choffsteinThanks for the help today, everyone. I'm out for a while
18:50weavejesterOut of interest, does anyone develop Clojure on a Mac?
18:52clojure_1000I need a powerful sounding name; something command/control-ish; it's basically the object that stores state for the user actions (in the heads up display)
18:52clojure_1000I was going with somethign like "Status", but it sounds too weak
18:52clojure_1000I need something like "this-button-launches-nukes"
18:52clojure_1000but shorter
18:52weavejesterred-button ?
18:52clojure_1000no no, it doesn't always launch nukes
18:53weavejesterhmm
18:53clojure_1000it's like the mythical "houston" that is talked about in every space movie
18:53clojure_1000it's the place where all info is routed through
18:53clojure_1000and all important decisions are made
18:53turbofailNORAD
18:53clojure_1000a hub of sorts
18:53weavejester"Houston" might work too :)
18:53clojure_1000I feel like that has too much emotional connections; it wouldb be like naming a variable batman
18:54clojure_1000(referring to Norad, not houston)
18:54clojure_1000do the air controllers that F22 pilots talk to ... do they have a name besides "air controllers" ?
18:54weavejesterI find naming things hard :/
18:55rplevyweavejester: I thought it was the most popular, but at the last baznex there was only 1 mac, GNU/Linux PCs represent
18:55weavejesterrplevy: I wonder how they compare...
18:55clojure_1000bah
18:55clojure_1000CommandCenter is too long
18:55clojure_1000Hatch doesn't sound right
18:55weavejesterI was thinking about getting an ultrabook
18:55clojure_1000so I think I should name it after the protoss Nexus
18:55sandy1986Can you help me? My tests behave other than my repl!
18:56weavejesterAnd the best seems to be the Macbook Air. I kinda like OSX as well, but... I also like Linux :)
18:56clojure_1000I am running ubuntu inside of vmbox inside of a macbook pro
18:56hkon_mac air is good mkay
18:56clojure_1000wait wait
18:56sandy1986(is (= nil (test/get-item "notAvailable"))) << works in test
18:57clojure_1000I am runnig irssi inside of xterm inside of gnome inside of X inside of ubuntu inside of virtualbox inside of OSX on a macbook pro.
18:57rplevyweavejester: my preferred environment is Thinkpad / Ubuntu
18:57sandy1986in VimClojure repl: clojurestack.core=> (= nil (with-mc db-nodes get-item "notAvaliable")) ... evaluates to false
18:57sandy1986the expression itself to "true" ...
18:57weavejestersandy1986: Could that with-mc be doing anything?
18:58sandy1986(deftest get-item (test/with-mc testdb (is (= nil (test/get-item "notAvailable"))) ))
18:58sandy1986it's exactly the same as in the test
18:58weavejestersandy1986: And testdb is the same?
18:58sandy1986yes
18:59weavejestersandy1986: You could try adding some (prn ...) to your test to make sure all the data is the same
18:59sandy1986(def db-nodes "127.0.0.1:11211") << exactly the same
18:59weavejesterAlso...
18:59weavejesterHang on
18:59weavejester(with-mc db-nodes get-item "notAvailable")
18:59weavejesterIs that exactly what you have?
19:00weavejesterAnd not (with-mc db-nodes (get-item "notAvailable"))
19:00weavejester?
19:00weavejestersandy1986: You might be missing some parentheses.
19:01sandy1986clojurestack.core=> (with-mc db-nodes get-item "notAvaliable") true clojurestack.core=> (with-mc db-nodes (get-item "notAvaliable")) true
19:01weavejesterrplevy: Mine is Ubuntu too, but Mac hardware is always very nice.
19:02weavejestersandy1986: Maybe the return value of with-mc isn't what you think
19:02weavejestersandy1986: Try: (with-mc db-nodes (prn (get-item "notAvailable")))
19:02clojure_1000is str a multimethod? if so, for a struct, what is the difference between overloading toString vs hijacking the str multimethod?
19:02sandy1986when I use prn in my test it prints "nil" and the test works as excepted
19:02sandy1986expected
19:02sandy1986damn auto corretion
19:02weavejesterMy guess is that the (with-mc ...) macro might return true no matter what the body.
19:03clojure_1000how can I get the source of vector.toString?
19:03rplevysandy1986: just curious, you said the repl behaves different from running it directly. Did you try turning the repl on and off again ;) it tends to build up state.
19:03sandy1986yes rplevy I've tried it
19:03sandy1986same result
19:04amalloyclojure_1000: it's in the clojure repo on github
19:04rplevyI had this problem with lein test working and running tests in the repl not working once, but I don't rememeber what the solution ws
19:04clojure_1000amalloy: Is there a way to get it via a combo of doc/source ?
19:04weavejestersandy1986: What happens when you put a prn function inside the with-mc block?
19:04amalloysrc/jvm/clojure/lang/PersistentVector.java, though it probably inherits its tostring from somewhere else
19:04amalloyno
19:04clojure_1000amalloy: Is there a way to get it via a combo of doc/source ? (from teh clojure repl)
19:04clojure_1000amalloy: got it
19:05sandy1986I'll try weavejester !
19:05clojure_1000amalloy: do I want IPersistentVector.java or PersistentVector.java?
19:06rplevyin general, I tend not run my unit tests in the repl, so I sometimes interactively construct them in the test namespace in the repl
19:06rplevy* "though", not "so"
19:06clojure_1000hmm, I want APersistentVector.java it looks like
19:06Scriptorclojure_1000: I think any file that starts with I is just for the interface
19:06Scriptornot sure though
19:06Scriptoractually, I'm probably wrong
19:07Scriptornope, right
19:07sandy1986#<NullPointerException java.lang.NullPointerException>
19:07amalloyScriptor: exception: Intrinsics.java :)
19:07clojure_1000anything that starts with I[A-Z].*.java
19:08Scriptorpfft, semantics
19:08clojure_1000what does the RT in: jvm/clojure/lang/APersistentVector.java: return RT.printString(this); stand for?
19:08clojure_1000wtf is RT?
19:09sandy1986(defmacro with-mc "Macro to manage Connection" [spec & body] `( with-mc* ~spec (fn [] ~@body)))
19:09clojure_1000run tiem?
19:09clojure_1000hmm
19:09Scriptorclojure_1000: it just contains a lot of java functions that are counterparts to clojure functions
19:09Scriptorwithout being attached to any particular data structure, which is why everything is static
19:10weavejestersandy1986: Hm? Are you doing: (with-mc db-nodes (prn (get-item "notAvailable"))) ?
19:10clojure_1000let me ask a simpler question:
19:10Scriptorwell, not all counterparts, but a lof them are there
19:10clojure_1000does a clojure vector call toString on each of its args?
19:10clojure_1000when I tell a vector to become a string?
19:10sandy1986clojurestack.core=> (with-mc db-nodes (prn (get-item "notAvaliable"))) nil true
19:11sandy1986There is my nil ... mhhh
19:11sandy1986yes, with-mc seems to eat the value
19:12Raynesclojure_1000: Do you want to convert all of the elements of a vector to a string or the vector itself?
19:13RaynesFormer is ##(map str [1 2 3 4]) and the latter is ##(pr-str [1 2 3 4])
19:13lazybot(map str [1 2 3 4]) ⇒ ("1" "2" "3" "4")
19:13lazybot(pr-str [1 2 3 4]) ⇒ "[1 2 3 4]"
19:13clojure_1000I wish that (str vec) acts something like: (apply str (map str vec))
19:13clojure_1000Raynes: actually, ti's more of a question: is (str vec) equiv to (apply str (map str vec))
19:14Scriptorclojure_1000: it just returns a string representation of the entire list, as opposed to each element
19:14Scriptorwhich I think makes sense
19:14RaynesYes.
19:14clojure_1000what is "string representation of the entire list" ?
19:14Scriptors/list/vector
19:14clojure_1000how is that defined?
19:14sandy1986How can I modify with-mc to not return "true"
19:14RaynesIn order to make a vector a string, it has to make each of its elements a string.
19:15clojure_1000Raynes: so it has to call toString on each of them?
19:15weavejestersandy1986: It looks like with-mc is just calling with-mc*
19:15Scriptorclojure_1000: if you want to print [1 2 3] it just returns "[1 2 3]"
19:15weavejestersandy1986: Which library is this?
19:15Scriptorso that's the equivalent of converting the entire vector to a string
19:15sandy1986spymemcached
19:16clojure_1000, (defrecord Foo [] Object (toString [x] "Bar")) (str [ (Foo.) ] )
19:16sandy1986https://gist.github.com/1522334
19:16clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
19:17clojure_1000so in the above example
19:17Scriptorclojure_1000: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L1775
19:17clojure_1000how is the Foo object being converted to a string
19:17clojure_1000is toString is not called?
19:17Scriptorthat's what ends up happening if you call str on a vector
19:17weavejestersandy1986: It's that shutdown that's the problem. The last expression in a function is what it returns
19:18weavejestersandy1986: Let me fork and modify your gist a sec...
19:18sandy1986ahh, damn... I got it
19:18sandy1986okay
19:19Scriptorclojure_1000: specifically it calls the write method of a stringwriter class on each element in a vector
19:19clojure_1000it looks like it's usinr print (a.nth ...)
19:20weavejestersandy1986: By the way, (. Thread (sleep 1)) is just going to sleep for 1 millisecond
19:20clojure_1000how can I check if print is a fn or if print is a multimethod?
19:20clojure_1000Scriptor: btw, thanks for the link, it was quite interesting to read
19:20clojure_1000(the print i'm referring to is line 1779)
19:20Scriptorclojure_1000: link to the print function https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L1697
19:20sandy1986I know weavejester , thats what the spymemcached team suggested
19:20weavejestersandy1986: Oh, okay. Weird! :)
19:20sandy1986there is an error when the first data is send before the connection is set up and running
19:20sandy1986this is a timing problem about ~1ms
19:20Scriptorclojure_1000: as you can see, print does a bunch of stuff but essentially calls stringwriter's write
19:21clojure_1000Scriptor: ah, well wait; doesn't the first line check if there is a multimethod, and if so, calls it?
19:21clojure_1000Scriptor: (sorry for stupid questions; this is my first tour into the jvm side of clojure's source)
19:21clojure_1000[i'm referring to lines 1699, 1700)
19:21weavejestersandy1986: What about this: https://gist.github.com/1522337
19:22weavejesterUsing a (try ... (finally ...)) is the usual pattern for handling shutdowns
19:22Scriptorclojure_1000: no worries, I'm just trying to figure this out as I go along, I have no idea whawt PRINT_INITIALIZED means
19:22weavejesterBecause then if there's an exception in (func) the connection is still closed.
19:24clojure_1000hmm, (defmethod print Foo [x] (println "YAY")) <-- results in Exception complaining clojure.core$print can not be cast to clojure.lang.Multfn
19:24amalloy,print-method
19:24clojurebot#<MultiFn clojure.lang.MultiFn@1b7e189>
19:26sandy1986weavejester: it works!
19:26weavejesterAwesome :)
19:26sandy1986When it is finished, I'm going to publish it on github (the memcached / spymemcached things)
19:27clojure_1000amalloy: is there a way via the repl to get the dispatch-fn of print-method?
19:33clojure_1000amalloy: for a multimethod, is there a way via the repl to get a list of all methods registered + their source?
19:34clojure_1000i feel that based on the readings I have done so far, ideserve an upgrade
19:46sandy1986https://gist.github.com/1522366
19:46sandy1986nice ;)
20:19sandy1986how can I throw away a return value
20:19sandy1986["addtodo"] (fn [req] ( (save-todo-from-req req) (response (str "ok"))))
20:20sandy1986(save-todo-from-req req) returns net.spy.memcached.internal.OperationFuture , message : OperationFuture cannot be cast to clojure.lang.IFn
20:20amalloy&(do (inc 1) "ignored that") ;; this, sandy1986?
20:20lazybot⇒ "ignored that"
20:21sandy1986ahh
20:22sandy1986net.spy.memcached.internal.OperationFuture cannot be cast to clojure.lang.IFn << same error, even with "do"
20:23amalloyyou put in too many parens
20:24sandy1986parens?
20:24clojurebotΜΟΛΩΝ ΛΑΒΕ
20:25sandy1986["addtodo"] (fn [req] ( (do (save-todo-from-req req)) (response (str "ok")))) << ...
20:25amalloy(fn [req] (do
20:26sandy1986ahh
20:40sandy1986What is the best way to get a list, containing the :task of https://gist.github.com/1522366
20:43amalloy(map :task ...)?
20:44sandy1986mhh
20:44sandy1986wow, works
20:47sandy1986and how to get both open and name ?
20:47sandy1986:name and :open
20:48dnolen(map (juxt :name :open) [{:name "foo" :open "bar"}])
20:48dnolen(map (juxt :name :open) [{:name "foo" :open "bar"}])
20:48dnolen,(map (juxt :name :open) [{:name "foo" :open "bar"}])
20:48clojurebot(["foo" "bar"])
20:49dnolensandy1986: ^ one way
20:49sandy1986wow, what is juxt, never seen it before
20:49dnolen((juxt dec inc) 1)
20:49dnolen,((juxt dec inc) 1)
20:49clojurebot[0 2]
20:50sandy1986ahhh
20:52sandy1986and if I want to replace "true" as the result of :open in the list...? using a formatting method?
21:05dnolensandy1986: what do you mean?
21:07sandy1986["Wutttzi" true] ["Wuutz" false] should appear as ["Wutttzi" "Open"] ["Wuutz" "Closed"]
21:10dnolensandy1986: then don't use :open, use a custom function
21:10sandy1986as a parameter of map?
21:10dnolen((juxt :name my-fn) ...)
21:10sandy1986(map (fn [x] ... ) xyz ) ?
21:11sandy1986ahh
21:11dnolen(map (juxt :name my-fn) xs)
21:14sandy1986clojurestack.core=> (map (juxt :task (fn [x] ("x")) ) (get-todos)) ( #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
21:14dnolen,("x")
21:14clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
21:15sandy1986ahh str
21:15sandy1986,(str "x")
21:15clojurebot"x"
21:16sandy1986,(power-on-skynet)
21:16clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: power-on-skynet in this context, compiling:(NO_SOURCE_PATH:0)>
21:20sandy1986(map (juxt :task (fn [x] (str (if (true? (:open x)) "Open" "Closed")))) (get-todos))
21:20sandy1986wooho ;)
21:22sandy1986okay, thank you very much
21:22sandy1986I'm going to bed
22:36technomancyrplevy: yeah, the problem is that the plugin guide actually mentions that clojure and contrib are implicit dependencies, so they don't need to be declared
22:37technomancyrplevy: it's looking right now like lein 2.0 will not even attempt to be plugin-compatible with 1.x in most cases.
23:38technomancyholy smokes; try.ocamlpro.com actually compiles ocaml bytecode straight to JS.
23:39ibdknoxtechnomancy: any thoughts on why when I run heroku and leave a site idle for a bit, the next request takes a *really* long time
23:39ibdknoxtechnomancy: also, that's ridiculous
23:39technomancyyeah, dead code elimination and everything
23:40technomancyI think the delay is just it coming back from idling
23:40technomancyIIRC that's just part of the deal with the free tier; you get the same thing with app engine &co
23:41ibdknoxI see, outside of the free tier that won't happen?
23:43technomancythat's my understanding