#clojure logs

2010-02-23

00:01jcromartiehow would you typically combine an "application" template in enlive with other templates?
00:06defni personally didn't see much need for enlive in things i wrote in compojure
00:06jcromartiehmm, yeah it is feeling a bit complicated at this point
00:06jcromartiewhat did you use?
00:09dnolenjcromartie: have you looked at this? http://github.com/swannodette/enlive-tutorial/blob/master/src/tutorial/template3.clj
00:09dnolenit shows you can easily mix and match components together with Enlive.
00:09dnolenit's not obvious but once you get it, you can really do nearly impossible things.
00:10jcromartiednolen: that is a really great example
00:10dnolenthat's 120 lines of code, and you can mix and match navs, headers, footers, widgets.
00:10jcromartiethanks
00:15jcromartiethis is quite enlightening
00:22herdrickIf one is going to fool around with hidden Markov models, are there any tools to use what should one use? I don't see anything specific within Incanter, though coding it up in Incanter wouldn't be so hard.
00:22herdrickI ask because I don't see anything 'official' in Java
00:22herdrick Don't say Python ;)
00:22herdrick Unless you really mean it.
00:23herdrickOh, I should say, I mostly talking about the Viterbi algorithm
00:32jcromartiewhat's the deal with defsnippet selectors?
01:16slyphonwoah, pre and post conditions
01:16slyphonsweet
01:20slyphonheadius: judas!
01:20slyphonoh wait
01:20slyphonheadius: i mean "HAI!"
01:21headiusnice, what did I do now? :)
01:21slyphonyou're in #clojure!
01:21slyphonget back to working on duby!
01:21headiustoday is a Duby day
01:21slyphonyay!
01:21slyphon:)
01:22headiusmainly because that's the talk for JAX today
01:22slyphonoh nice
01:22headiusI really need to add a clojure-mode that creates classes with all immutable fields initialize on construction
01:22headius+refs where appropriately
01:23slyphoni had a real hard time getting gen-class to work and call protected methods
01:23slyphonon a superclass
01:23headiusthat's a tough one for any dynlang
01:23headiusclojure generates function classes which don't actually extend the original, so the JVM beats it up trying to call protected stuff
01:24slyphonah
01:24headiusjruby has the same problem, since we generate essentially the same structure
01:24slyphonyeah, i was told the only way to do it was wall-hack-method
01:24headiusgroovy works around it by doing setAccessible on the reflected methods everywhere (bleah)
01:25headiusjruby works around it where it can by generating synthetic methods on the actual subclass that act as helpers to call protected superclass methods
01:25headiusbut it's tweaky
01:25slyphonwell, it worked for me when i was wrapping PircBot in jruby
01:26slyphoni'm pretty sure if i sat there and poked at it long enough i could probably get it working with clojure
01:26slyphoni had a feeling i'd have to learn a bit more about JVM internals than i cared to at the moment though
01:27slyphonheadius: so, when do we get sexp mode for jruby?
01:27headiuswell, that's an interesting thought
01:27headiusit would make writing transformations a lot easier than twiddling the ruby or duby ASTs
01:28slyphonsomeone proposed it for MRI and i jumped up and down on the mailing list, but to no avail
01:28slyphonheadius: and then: macros
01:28headiusduby is basically a macro language as it is right now
01:28slyphonrather than doing instance_eval everywhere
01:28slyphonorly?
01:28headiusthe "compiler" is really just a language transformer
01:28slyphonis that how you're handling the type-hints?
01:30headiushttp://github.com/headius/duby/blob/master/lib/duby/jvm/types/intrinsics.rb#L198
01:30headiusno, type hints are built-in; all AST nodes have an inferred_type attr that gets filled in during a late compiler cycle
01:30headiusbut there's an example of how "each" is added to iterable
01:31headiusabove it is a couple examples of how + is expanded
01:31slyphonwow, that's nuts
01:32slyphoni somehow missed the compilers class in college
01:32headiusme too
01:33slyphonhah
01:33slyphonyou're a better man than me, then
01:33headiuswhich may explain duby's structure
01:33headiushttp://github.com/headius/duby/blob/master/lib/duby/ast/type.rb#L23
01:33headiusthere's a macro expanded in the earlier Ruby AST to Duby AST phase
01:33headiusessentially just replaces calls to "import" with appropriate Duby AST nodes
01:33slyphonwow, that's...disturbing
01:33headiusyeah
01:34headiussomething that was just tree transformations against a sexp would be cleaner
01:34slyphonyou know you're not supposed to have methods that are 50 lines long
01:34headiusI think there's an open bug for duby codebase cleanup
01:34slyphonhah
01:34headiusthe other committer has gone a little hog wild
01:34slyphoni think this is the part where you say "Patches accepted!"
01:36headiusexactly :D
01:36slyphon;)
01:37headiusit would be nice to be able to show people macro expansion logic during a talk and have them understand it
01:37slyphoni kinda understand what you're doing there
01:37slyphoni wouldn't want to try and write tests for it...
01:37headiusit's not hard, it's just large
01:38slyphonthat's what she said
01:38headiusyeah, we don't have any tests for the transform phase really
01:38slyphonhahaha
01:38headiusmost of the tests are for the last couple phases that create actual code
01:38headiusthey're more integration or functional tests
01:38slyphonyou're taking the basic "atoms" of the language and poking them into place
01:38headiusright
01:38headiusbut I want it to be easier to do that poking and even defining new atoms
01:38headiusthat's the essence of duby
01:39slyphonso you're coming to clojure for inspiration?
01:39slyphon:)
01:40headiusof course
01:40headiusI never really learned the power of sexps back in the day, but I've come to appreciate it
01:40headiusI just don't like the syntax :)
01:40headiusduby's all about kowtowing to syntax bigots
01:41slyphonhah
01:41somniumheadius: if you could do something about all those 'end's while youre there youll be my hero
01:41slyphonsomnium: no no, see, in ruby the 'end's justify the means
01:41headiusI don't mind the ends so much
01:42slyphonthank you! i'll be here all week!
01:42somniumtheyre twice as many characters as 2 parens! :)
01:42slyphonsomnium: indeed
01:42headiusyeah, but I know what "end" means
01:42headiusit means "end"
01:42headius) is half of a smiley
01:42slyphoni used to see all the 'end's there, but now i just see blonde, brunette, redhead
01:42somniumhttp://www.lrde.epita.fr/~didier/software/smilisp.php
01:43headius) makes my code happy, but not me
01:43somniumit can be flexible
01:43slyphonthe parens *really* aren't as bad as people make them out to be
01:43slyphonesp. if you have an editor that indents stuff properly for you
01:44somniumI still wish ruby used python or haskell style indentation
01:44slyphonwell...i dunno if i'd go *that* far
01:44headiussignificant whitespace is great until you start pasting code
01:44somniumbut duby looks really promising even with the ends
01:44slyphonwhitespace awareness FTTL
01:44headiusthen suddenly all hell breaks loos
01:44headiusloosing whitespace shouldn't break your code
01:44headiuslosing
01:45somniumhaskell mode in emacs makes it pretty effortless
01:45slyphonhrm
01:45slyphon"effortless haskell"
01:45somniumthe syntax
01:45slyphonthat's an oxymoron
01:46headiusif we all used emacs, everything would be better
01:46headiusexcept that we'd all be using emacs
01:46slyphonheadius: hahahahaha
01:46slyphon"Now you have two problems"
01:46headiushahah
01:46headiusyes
01:46somniumlook, Im not trying to advocate the use of haskell :) (or emacs I suppose)
01:47slyphoni used emacs for a while, i just had so much damn fun getting my eirc scripts *just* right that i never got any work done
01:48headiusyeah, we had a discussion at one javaone about who had the largest .emacs file
01:48slyphonhahaha
01:48headiusI think nicksieger won, his was something like 120k
01:48slyphonoh man
01:48slyphonjeeeeeeeeez
01:48headiuspulled in a bunch of stuff though
01:48headiustwbray was a distant second
01:48headiusbbl
01:49slyphonlata
01:50slyphonis there a clojure idiom for comparing a string to a number of regexen?
01:50slyphonbasically using a regex for dispatching
01:51slyphonor is that a use case for multimethods?
01:53somnium,(condp (fn [r s] (re-matches r s)) "bar" #"foo" :foo #"bar" :bar :FAIL)
01:53clojurebot:bar
01:54slyphonahhh
01:54slyphonso *that's* what condp is for
01:54somniumthats one way, you could also use a map of {regex fn}, mhich is a kind of handrolled multimethod I suppose
01:57somniumit would be cool if regexes implemented IFn and you could just call them with strings
01:57slyphonyeah, i was thinking of the ruby case statement
02:04slyphonsomnium: in your example, couldn't you do (condp re-matches "bar" ...)
02:04slyphonsince re-matches is a binary function?
02:05somniumslyphon: ah, yeah you could
02:05slyphonoh, cool, just wanted to make sure i was reading that right
02:05somniumI have this weird habit of using it with #(%1 %2) all the time to DRY-up cond statements
02:12slyphonthe difference between re-matcher re-matches and their ilk is kind of confusing
02:16somniumre-matches or re-seq usually get me where I need to go
02:18somnium(I really like clojure but still despise reading javadocs)
02:23slyphonsomnium: heh
02:32defnsomnium: i dont think that ever goes away
02:32defn(that feeling I mean)
02:37somniumhmm, anyone done anything with clojure + jambi?
02:58defn(def *blah* (ref []))
02:58defn(dosync (alter *blah* (conj *blah* "foo")))
02:58defnwhat am i doing wrong here?
03:04LauJensendefn: dont wrap (conj obj itm) in parens
03:05defnLauJensen: do i want to use ref-set or alter?
03:05LauJensendepends on the context - if its a single object, you might prefer an atom
03:06defnLauJensen: cool -- one more question...
03:07defnI want to start a Thread/sleep for 20minutes, and then update the atom, and finally prompt for another 20minute interval
03:09LauJensen(still waiting for the question)
03:09defn(let [timer (Thread/sleep foo)] ...
03:09defni guess im just having trouble understanding how to do this functionally
03:10Chousukeif it involves IO, you can't.
03:10defnhow do call timer and then dosync
03:10Chousukecall timer?
03:10LauJensen(defn job [] (Thread/sleep (* 1000 60 20)) (update-atom) (if some-condition? (recur)))
03:11defnrun the timer i guess
03:11ChousukeThread/sleep doesn't give you a timer
03:11Chousukeit just sleeps
03:11defnwell it behaves like a timer, no?
03:11defnone could use it to block for x seconds
03:11defnno?
03:11clojurebotda da king of the road
03:12Chousukeyeah.
03:12Chousukeand only that.
03:12Chousukenot really. it just suspends the current thread for whatever
03:12Chousukeoops.
03:12defnright, which is all i need it for
03:12Chousuke-not really
03:12Chousuke(this is what I get for switching sentences in the middle of typing them)
03:13LauJensendefn: was that snippet I posted not what you were going for ?
03:14defnno that's great
03:14defnmy only question is how recur behaves there
03:14Chousukejust restarts the function
03:14defnis there an implicit loop target around the if statement, or the whole function?
03:14defnokay
03:14defnthanks Chousuke && LauJensen
03:15Chousukerecur is not just for loops, it also allows you to write tail-recursive functions
03:15Chousukewhich are in effect loops, but that's another thing :P
03:15LauJensenrecur goes back to the last point where it can restart the current body, in this case the top of the function, had there been a 'loop' it would have gone to that
03:19defnLauJensen: thanks
03:27defn(swap! *blah* (conj @*blah* "abc")) ???
03:28defn(swap! *blah* #(conj % "blah"))?
03:30defn(swap! *blah* conj @*blah* "abc")?
03:32avarusmorning
03:37LauJensenhehe
03:38LauJensen(swap! your-atom conj [1 2 3])
03:38LauJensendefn: that will conj a vector containing integers 1, 2, 3, to the current value of the atom
03:38defnah -- i was worried i needed to include what i was conj'ing onto like i'd write a conj function normally
03:39LauJensenI think (reset! your-atom (conj @your-atom [1 2 3])) will produce the same result
03:42defnLauJensen: what if i have a (let [continue? (read-line)] (if (= continue? "y") () ()))
03:42defnwhere does my recur go if that is in the job [] context?
03:42LauJensen~doc recur
03:42clojurebothttp://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&q=recursive+macroexpand#28837d55525306d8
03:42LauJensenStill goes to the top
03:43defnhm weird
03:44LauJensenwhy?
03:44clojurebotwhy not?
05:06caljunioranyone around using Textmate in combination with Incanter?
05:09avarusI dunno what version of textmate you are running but when I tried some weeks ago it was horrible
05:10avarusthe most confusing thing was that it didn't highlight the matching parens
05:11avarusI use emacs with clojure mode now
05:14eevar2foul lisps are spreading the corruption ;)
05:15caljuniorI'm running version 1.5.8
05:15avaruswell, don't waste your time with textmate
05:16caljuniorit works reasonably well with Clojure, but I am trying to add Incanter to the mix
05:16avaruswell? so you got it working to highlight matching parens?
05:17caljuniorit is matching parens
05:17avarusand how did you do it?
05:17caljuniorhighlighting when you type or move the cursor over the,
05:18caljuniorclosing paren
05:18avaruswhat bundle are you using then?
05:18caljuniorClojure.tmbundle
05:19avarusthere's more than one with that name :)
05:19caljuniorI believe it was the version forked by kek
05:19avarusah ok
05:19caljuniornot sure though
05:19caljuniorit's been a while
05:19caljuniordon't dare to update as I have it running now
05:19caljunior:-)
05:20avarushehe
05:20caljuniorthere should be an easy way to add Incanter and it's deps to the classpath
05:22caljuniornot planning on going over to emacs.
05:23eevar2don't, you'll never recover
05:23avarusI watched the peepcode video about emacs and could use basic things after half an hour
05:24avarusalmost as good as my old friend "joe" :)
05:24caljuniorme too
05:25caljuniordidn't need a peepcode video for textmate though
05:25RaynesI didn't need a video for Emacs, though.
05:25caljunior:-)
05:25RaynesIt took me around 5 hours to be able to use Emacs, and over time I learned to do more powerful things.
05:26RaynesI don't see the appeal of Vim.
05:26avarusjoe > * :P
05:28caljuniorI asked how I could change a tyre on my FIAT, not whether a Ferrari is a better car. :-)
05:28avarusit isn't :p
05:28caljuniorwanna bet?
05:28avarusno
05:28avarusI think no one knows the answer to your problem
05:29avarusthat's why :)
05:29caljuniorthat's what I concluded as well
05:29RaynesI'm quite sorry, it's just annoying when people whine about Emacs. :|
05:29caljuniorthanks anyway
05:29RaynesBecause they do it so often!
05:29avaruswho whines in here?
05:30Raynesavarus: There is hardly ever any whining in here, fortunately.
05:31avarus:>
05:42zabUltra noob question. How would I call a function from within a file inside a REPL?
05:42zabWhenever I try (use 'name) it fails because that file requires other files to be loaded
05:51esjzab: put the appropriate (use ) clauses into the file you're loading
05:53zabyeah I have, but whenever I (use 'file) from the REPL, it still complains with java.lang.NoClassDefFoundError: Could not initialize class
05:53zaband I'm fairly sure all files needed are in my classpath
05:54esjtry load 'em individually from the repl
05:54esjto find the missing one ?
05:54AWizzArdzab: (System/getProperty "java.class.path")
05:55zabahh that's something I wanted to do but didn't know how
05:57zabIf the class I want is in a JAR file, how do I know which namespace to (use ')? Do I have to look at the source?
05:58AWizzArdzab: the documentation will explain it, or otherwise you can simply look at the .jar file with your favourite archive manager and loop up the paths yourself.
05:59zabk
05:59powr-tocWhy does evaluating (promise) at the repl block the repl? Is there an implicit deref?
06:00powr-tocI was thinking the call toString might do the deref but, (. (promise) toString) returns fine
06:00esjbecause the promise blocks the repl thread
06:00esjoh, sorry, missed you question
06:01esjyeah I think the repl tries to pretty print the deref
06:02powr-tocWas just confused by the fact the repl was derefing the promise but a call like (when (promise) (prn "foo")) obviously doesn't
06:03powr-toci.e. (promise) has a value when it's not derefed... but I can't see that value at the repl
06:07powr-tocPresumably the REPL deref's all IDeref's? What's the rationale for this?
06:08esji think its just the pretty printing
06:09esjso > (def a (atom 3), then > a will result in <#atom:xxxxxx : 3>
06:10esjand i seem to recall it does the same with futures and promises
06:12powr-tocwhat method does the pretty print call?
06:12LauJensenside question: Wouldnt that be 'which' method ?
06:12esjLau: I think so
06:13esjpowr-toc: no idea
06:13LauJensenEven on official websites, like news sites etc, I see people replace 'which' with 'what' and I have no idea why
06:13powr-tocLau: yes it should
06:13powr-tocI was assuming that the deref was happening inside toString... but that's not the case
06:15LauJensenthe only places where a reference type is implicitly deferenced, is when calling swap, reset!, alter, etc
06:20lessthantristananyone know if the result of (/ 1 (/ -1 2)) being a ratio -2/1 the desired behaviour or a bug? (using 1.1.x branch)
06:21powr-tocLauJensen: so how come (promise) at the REPL blocks?
06:21esjlessthantristan: how is is this different from what you expected ?
06:22LauJensenlessthantristan: I'd say desired behaviour :)
06:22LauJensenpowr-toc: no idea
06:23lessthantristanesj: i guess i expect it to reduce the ratio back to the integer -2 rather than leaving it as a ratio. it doesn't effect calculations, but it makes the output look weird :)
06:23Raynespowr-toc: Maybe it's promising to block the REPL, and is being sincere?
06:23esjlessthantristan: Clojure promotes to Ratio and stays there to ensure numerical precision
06:24esjfogus and chouser's book has a good section on this
06:24RaynesSpeaking of that, they should write faster.
06:25lessthantristanok cool. maybe i should have a read. I was just taken back a bit when my code printed out a heap of 0/1 results :P
06:25esjfor quality like that, i'm willing to wait (albeit impatiently)
06:26Raynesesj: Indeed.
06:26esjlessthantristan: i can sympathise
06:27powr-tochmm... I'm confused, there's no derefs in main.clj
06:27esjit must do it though, because you see the value in the repl
06:28LauJensencan you run a blocking example on clojurebot?
06:29esj,(promise)
06:29clojurebotExecution Timed Out
06:29esjsorry cb, Lau made me do it
06:30LauJensen~source promise
06:30esjquestion: if I grab clojure and contrib 1.2 from github and compile em. What do I need to do to get clojure into my local maven repo so I can feed it to lein ?
06:31esji'm having issues trying to use 1.2, which is req'd by the latest Incanter
06:31AWizzArd,(Thread/sleep 1234)
06:31clojurebotnil
06:31esjcontrib goes right right with a >mvn install
06:31esjbut clojure is compiled with ant
06:32esjhow do I make all the poms etc ?
06:32esjalternatively, how do I get a matched pair of clojure / contrib using clojars and save myself the suffering
06:33Raynes1.2.0-master-SNAPSHOT
06:33esjfor both ?
06:33RaynesMhm.
06:33esjlemme give that a spin
06:33RaynesIt's what I use for all my projects. They are compatible.
06:35powr-tocOk, I'm trying to decipher this http://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/ and can't figure out why p is set to (second @promises)
06:36powr-tocbecause we deliver the value to a which is the cell prior to p in the lazy-seq
06:36esjRaynes: are you compiling your own leiningen ?
06:37esjwith 1.2.0 ?
06:37RaynesNo.
06:37esjrats
06:37RaynesI just used lein self-install
06:37esjbecause using 1.2.0-master-SNAPSHOT for both results in my favourite
06:37esjat clojure.lang.RestFn.applyTo(RestFn.java:147)
06:37esjerror
06:37RaynesThat's odd.
06:37RaynesIt works fine for me. :\
06:37esjwhich usually means clojure / contrib have got out of sync
06:38powr-tocahh wait, I thin I get it... the call to (swap! promises next) has shifted the seq along
06:38RaynesIt's probably something to do with the fact that there hasn't been a new 1.2.0-master-SNAPSHOT build for like 2 months...
06:39RaynesYeah, that's it.
06:39RaynesThere has been a new clojure build, but not a new contrib build.
06:39esjaaah
06:39RaynesWho manages these things anyways? :\
06:39esji dunno
06:39esjok, I think I can work around that
06:40esjgrab the clojure snapshot, build the contrib myself and mvn install that....
06:40esjlets see....
06:43LauJensenHaha - Just got an email from 'Guusjevannoorden' subject: "CONGRATULATIONS!!!" - Apperantly my email has won quite a bit of money :)
06:44esjcongratulations - i'm still waiting for mine
06:44esjany day now...
06:44RaynesI get those every day.
06:45LauJensenI think I'll make a spamfilter in Clojure which is EVEN more effective than Paul Grahams (if (.contains (first (line-seq email)) "We are a china based")) (delete email))
06:45RaynesHah.
06:48esjwell.... that's just ugly. Some bits of lein work with 1.2.0 master etc, but not all. So I can make it start lein-repl at 1.2.0 which is what I'm after to get at Incanter, but have to use lein-stable for deps, clean etc. Life could be worse ;)
06:49tomojhmm
06:49tomojdeps worked for me with 1.2.0
06:49tomojoh, you mean lein 1.2.0?
06:49LauJensenhehe - esj could you prefix each line with "Dear Diary" just for context ? :)
06:50tomojI'm confused
06:50esjbut then I'd need a nice pink leather skin for my IRC window
06:51esjtomoj: using lein built off clojure+contrib 1.2.0 crashes on lein clean and lein deps, but not lein repl
06:51esjdoubtless i'm doing something thunderously stupid and would love to hear what it is
06:53tomojbut what was the "have to use lein-stable" thing
06:53tomojthe latest stable lein release works with 1.2.0, but master lein doesn't?
06:54esjoh sorry. lein-stable referers to the leiningen stable release.
06:54esjso lein-stable is build on 1.1.0 or whatnot
06:55tomojoh, hmm
06:55tomojI'd never considered the clojure version that lein uses, why does it matter?
06:55esjbecause lein repl uses that version
06:55tomojoh
06:55tomojI only use lein swank, I guess that's immune
06:56tomojwonder why lein repl doesn't do the same thing as lein swank
06:56esjdunno, i've still not got my head around the slime / swank thing
06:57esjtomoj: so you use lein swakn, and then slime connect from emacs ?
06:57tomojyeah
06:58tomojI plan to make a screencast about it
06:58esjhow does this differ from swank-clojure-project ?
06:58tomojnot much
06:59tomojexcept that leiningen handles setting up the classpath rather than swank-clojure
06:59tomojso, e.g., leiningen adds resources/ while I believe swank-clojure-project doesn't
07:00tomojalso, lein swank can be used on a remote server, and you can forward the port over ssh to get a remote slime repl
07:01esjok, I got tied up by the classpath with lein swank before, but I'll try again.
07:01tomojI had issues before with the classpath as well (src/ wasn't added)
07:01tomojbut now it seems to be resolved
07:02esjperfect, that's exactly what I had.
07:07esjtomoj: you're right - they've fixed it :)
07:11AWizzArdDoes anyone of you have a fast SSD?
07:11edbondAWizzArd: I have ssd, not sure if its fast. :)
07:11AWizzArdDo you have 2 minutes to try something?
07:12AWizzArdhttp://pastie.org/838378
07:12AWizzArdPlease tell me how fast you are for: (time (dotimes [i 1000] (schreib1 (str "Line " i))))
07:12AWizzArdAnd for schreib2 the same
07:13AWizzArdMaybe for schreib2 you begin with dotimes [i 100], because that could already take 2 secs
07:13AWizzArdBut perhaps your SSD is so fast that [i 1000] will be ok
07:14edbondAWizzArd: should i copy that to file? I have user/fos is unbound in repl.
07:15AWizzArdYou can copy it into your repl
07:15_ato~40 ms for 1
07:15clojurebotmea culpa!
07:15AWizzArd_ato: yes, that is very possible, because this will only write into some caches
07:16_ato2 varies a lot but is around 2.2 to 2.7 seconds
07:16_atoon an OCZ Vertex SSD in a generation 2 macbook running linux
07:16_atoon ext3
07:20edbondfirst varies from 27msec to 400, second is about 5500msec
07:21edbond128Gb samsung, ubuntu 9.10, ext4
07:21edbondnoop scheduler
07:26_atoI'm using the cfq schedular and the drive is 64 GB
07:31AWizzArdI use a simple IDE disk, Win XP, 32 Bit, Java 6 Update 18. Schreib 1 can do 10k writes in 200 msecs. But Schreib2 can do only 55 Writes within one second.
07:32AWizzArd_ato: schreib 2 varies you say. Is that for [i 100]?
07:32AWizzArdedbond: thanks for testing. Your 5.5 seconds for schreib2, was that with a [i 1000]?
07:33_atofor 1000
07:33edbondyes
07:33_atofor 100 it varies around 150-250
07:34AWizzArdcypher23 explained that for example Apple only waits on fsync until the data is in the HD cache. It does not block until the HD has actually written the data. So on Leopard the .sync version runs about as fast as schreib1.
07:34edbondI got about 550 for i 100
07:35AWizzArdSo, on your SSDs you can do 200+ writes per second, while I can do only 50 on my IDE disk.
07:35AWizzArdThanks for testing guys.
07:37_atono worries. SSDs make a massive difference on many workloads
07:39_atowe run lucene indexes off them at work, they're many times faster than even fast SCSI disks
07:42Chousukehttp://gist.github.com/312137 <- I implemented monads using protocols. :P
07:42ChousukeI suspect there may be some failure in that implementation though
07:42Chousukebut it seems to work
07:50boojumis there a way to disable sequence chunking?
07:51Chousukeboojum: http://paste.lisp.org/display/90536 here's one
07:52boojumChousuke: thanks
07:54cemerickis the lisppaste8 bot permanently out of commission?
07:55cemerickanyway...
07:55cemerickFeedback welcome: agent-based finite state machines: http://paste.lisp.org/display/95483
07:56cemericknothing particularly fancy, but I couldn't find anything similar out there.
07:58avarusuhoh... in the following source http://paste.lisp.org/display/95484 I can't call the defn link from this one http://paste.lisp.org/display/95485 <-- what's wrong? it says "No such var: ws/link"
07:58cemerickChousuke: that's a riot :-D
07:59boojumwait, reify is not in 1.1
08:00Chousukeboojum: proxy will probably work too
08:01Chousukejust won't be as fast.
08:01Chousukebut I suppose you're not looking for speed if you're explicitly disabling chunking
08:02AWizzArdChousuke: do you use the official 1.1 release?
08:02ChousukeI tend to use master
08:02AWizzArdok, good to know that I am not alone :)
08:03ChousukeI wonder if I can write a monad transformer using protocols too
08:04AWizzArdWould they serve a real purpose for you, or is that just of theoretical interest, to implement such a thing?
08:04Chousukejust playing around
08:08LauJensencemerick: very clean implementation!
08:09cemerickLauJensen: Thanks. I don't suspect I'll add much -- probably just have the dispatcher clean up ::stop states and return them to a runnable state.
08:09cemerickI was thinking of trying to verify the state transitions, but allowing arbitrary fns to determine next states makes that a little rough.
08:11cemerickI suppose I could force the next-state-fns to be pairs of conditionals and next states that would get dropped into a cond, but I'm really not that motivated.
08:15avarushow to tell the bot to show me something regarding "require" :)?
08:17avarushttp://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/require found it
08:21avarusmhh...what am I doing wrong...
08:21cemerickthis is unfortunate:
08:21cemerick,(assoc {} :foo 5 :bar)
08:21clojurebot{:bar nil, :foo 5}
08:22AWizzArdoh indeed
08:28chouserI suppose you'd prefer an exception?
08:30AWizzArdyes
08:30AWizzArd,(hash-map :foo 5 :bar)
08:30clojurebotjava.lang.IllegalArgumentException: No value supplied for key: :bar
08:33headiustechnomancy|away: I thought you had a bouncing ball example of Duby
08:33headiuswas I mistaken?
08:33tomojavarus: hmm, looks ok to me
08:34tomojexcept, put the requires in the ns
08:34tomoj(ns foo (:use bar) (:require (baz [bim :as b])))
08:34tomojit should work your way too, though...
08:34cemerickchouser: it seems like too likely of a typo to not catch
08:35chousercemerick: yeah, I can see that
08:40avarustomoj: perhaps I am returning the vector the wrong way?
08:41tomojwell, yeah
08:41tomojbut that shouldn't cause "no such var"
08:43tomojoh, wait
08:43tomojyou have a circular dependency, I believe
08:43tomojadmin-header requires websites, and websites requires admin-header
08:49cemerickha! Of course, await doesn't do one any good if you're trying to wait for a send that occurs within an already-running send. :-P
09:00avarustomoj: oh
09:02avarusso this is not allowed I guess
09:02avarusk, I put the "helper" function in the helper.clj then :)
09:04avarusyep, did the trick
09:04avarusthanks tomoj
09:05avarusgoal achieved: learned something new today
09:06cemerickam I correct in thinking that there is no support for namespaced keywords when doing map destructuring via :keys?
09:09ohpauleezhas anyone tried to use higher level networking libraries in a clojure project, specifically JXTA?
09:10ohpauleeznvm, I just dug up some articles
09:40jcromartiewhat is mapcat for?
09:41AWizzArd,(map val {:a #{10 20 30}, :b [1 2 3]})
09:41clojurebot(#{10 20 30} [1 2 3])
09:41AWizzArd,(mapcat val {:a #{10 20 30}, :b [1 2 3]})
09:41clojurebot(10 20 30 1 2 3)
09:41jcromartieah, so it kind of flattens the result
09:41AWizzArdWhen your map fn returns a collection, then map returns a collection of collections, and.. yes
09:41jcromartieby concat'ing each one together
09:42jcromartiethe stuff I was trying didn't make that too clear
09:43jcromartieI guess it sort of works around not having multiple return values
09:45AWizzArdmapcat or the thing you try to do?
09:45jcromartiethe Enlive source reads nicely
09:46jcromartieI was just fiddling with mapcat and coming back with results that didn't really illustrate a good use for it
09:46jcromartiebut now I understand
09:46AWizzArdIndeed, cgrand writes hq code.
09:53jcromartieyeah reading code is something I should do more often
09:54jcromartieI didn't realize that (:foo x bar) translates to (get x :foo bar)
09:54chouserrhickey: would direct linking of vars allow calls to gen-class methods to be fully inlined? that is, same performance as reify?
09:56stuartsierraAt what scale does pmap become worthwhile?
09:58chouserstuartsierra: it has to do with the amount of work per item, not the size of the seq
09:58stuartsierraYeah, I was coming to that conclusion.
09:58chouser,(time (vec (map #(do (Thread/sleep 100) (inc %)) [1 2])))
09:58clojurebot[2 3]
09:58clojurebot"Elapsed time: 202.517 msecs"
09:58chouser,(time (vec (pmap #(do (Thread/sleep 100) (inc %)) [1 2])))
09:58clojurebot[2 3]
09:58clojurebot"Elapsed time: 102.413 msecs"
09:58stuartsierragot it
09:59chouserthat makes it look like an op that take more than a msec or two would benefit
10:01caljunioranother attempt: anyone using TextMate with Incanter? what would be the most simple way to get Incanter and it's deps playing nice with clojure.tmbundle?
10:02chouser,(doseq [m [map pmap]] (time (vec (m (fn [x] (Thread/sleep 1)) (range 10)))))
10:02rhickeychouser: nope
10:02clojurebot"Elapsed time: 19.663 msecs" "Elapsed time: 3.833 msecs"
10:02chousereven at just 1 msec, pmap still wins. much below that it doesn't.
10:03AWizzArdhow about this vmap?
10:03chouserrhickey: hm, ok.
10:03stuartsierrachouser: Yeah, at 0.1 msec, pmap takes longer
10:03AWizzArdIn the PAR branch
10:03rhickeygenclass is designed to go through the vars in order to support dynamic dev
10:03AWizzArdI won't use pmap before my fn runs longer than 1-2 msecs
10:03chouserYeah, I understand. I'm trying to figure out a good way to generate a bunch of classes and provide factory methods for them to Java
10:04rhickeychouser: things deftype can't do?
10:06chouserdeftype could do it, as could reify -- I need some pre-calculated fields, so I was leaning toward reify.
10:06chouserbut either way, I need a Java API -- something AOT compiled to for Java to call.
10:06rhickeychouser: pre-calculated meaning constants?
10:07chouseryes -- they would be static final fields if I were hand-writing the code in Java
10:07rhickeyAOT-compiled deftypes have stably named types and ctors
10:07chouseryes, but the ctors would be wrong
10:08rhickeyso this begs for gen-statics or gen-factory or something
10:08chouser(gen-proto-stub Foo) then from Java something like ProtoAPI.newFooStub(c)
10:08stuartsierraHow about defconst?
10:09chouserthe instance created by that has methods that need access to some constants computed by gen-proto-stub at compile time
10:09rhickey(gen-statics Classname sig clojure-fn sig clojure-fn ...)
10:09rhickeystuartsierra: yes, defconst is a todo
10:09stuartsierrayay
10:11rhickeygen-statics would have no code-gen needs other than arg/return conversion
10:12rhickeycould even do 'direct-linking' kind of stuff
10:12chouserrhickey: yeah, gen-statics would do it. I don't think gen-class's var lookup is deal-breaker here, just trying to make sure understand my options so I don't design an API compatible with the fastest possible implementation.
10:13chouser(gen-proto-stubs Foo Bar Baz ...) ; if I want a single class with multiple factory fns...
10:14chouserhm. I don't -- too closed. I guess for each instance type I want one class with a single factory method.
10:15rhickeybut if you had an arbitrary ctor sig would you need the factory?
10:16chousernot if I also had static fields or the methods were closures or something.
10:16rhickeychouser: what about defconst for those?
10:18Chousukerhickey: I wrote a couple more revisions of the gen-iter macro yesterday http://gist.github.com/311629 and http://gist.github.com/311647 (this one is missing a name for the mapx iter)
10:18ChousukeDesigning good macros is interesting work :P
10:18chouserhm... maybe I don't need statics at all. Maybe I can generate method bodies with constants right there in them.
10:19chouserdefconst would probably work, though their names would be long.
10:20rhickeythese constants are of what types?
10:20chouserints
10:20rhickeywe really need to unify the semantics of boxed/primitive integers
10:20ryshmm, I seem to remember there was a presentation some moons ago by you, rhickey, where you explained with a nice diagram how PersistentHashMap tries work, but I can't find it. Anyone got a link?
10:23chouserrys: this isn't exactly it, but may have what you want: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/
10:23remleduffHi everyone! Has anyone happened to have set up an Amazon Machine Image for running a clojure dev environment under EC2?
10:23chouserthough ... I'm not sure that's accurate anymore
10:23chouserare LeafNodes gone now?
10:25ChousukeI had an idea for "code mixins" for reify and deftype yesterday. Something like (define-mixin foo :as this Iface (method [] ..) (method2 [args]) Iface2 ...) and then reify could have a :mixin [foo bar] option, and then merge the code data structure from foo, bar and its own body before the final evaluation. The biggest problem I could see was making sure that the this symbol from
10:25Chousukethe mixins is replaced with whatever the reify invocation uses (or with a gensym)
10:25chouserrhickey: gen-statics would produce a single class with only static methods?
10:25rhickeychouser: yeah
10:25Chousukethis should be implementable using only macros so maybe I'll throw something together. I'm not sure if there's an actual use case for these though.
10:26Chousukemaybe not enough to justify the complexity
10:45stuartsierraIs there currently a function to force non-chunked sequences?
10:45stuartsierraI.e., to make a chunked sequence into a non-chunked sequence?
10:47Chousukehttp://paste.lisp.org/display/90536
10:47chouserhttp://paste.lisp.org/display/93650
10:48chouser_fogus_ updated that second one for more recent versions of reify
10:48stuartsierraOk. I just made an unchunked-map, http://paste.lisp.org/+21OJ
10:49chouserout of curiosity, what did you need it for?
10:50stuartsierraIn lazytest, I wanted a map that was truly lazy, so that I could verify that my test runner was also truly lazy.
11:05brandonware futures basically just very simple agents?
11:06crowbar7What would be the best way to be able to use aspell with Clojure?
11:07crowbar7clojurebot:,(*1 2 3 4)
11:07clojurebot5 (for large values of 2)
11:07crowbar7so "," is the keyword for code. neat-o
11:07crowbar7clojurebot: help
11:07clojurebothttp://www.khanacademy.org/
11:19ordnungswidrigcrowbar7: I just found http://jaspell.sourceforge.net/javadocs/pt/tumba/spell/Aspell.html
11:23crowbar7ordnungswidrig: Thanks, I found that already just wondering if there was something built into clojure.
12:18ieureSo I have an infinite lazy-seq of timestamps. And I want an infinite lazy-seq of deltas between timestamps. I’m really not sure how to make this happen, can someone give me some guidance?
12:18ieureIf I was using Python, I’d do something like zip the seq with the rest of the seq, then map subtract across the pairs.
12:18stuartsierraieure: (map - (partition 2 1 timestamps))
12:19stuartsierraEven simpler: (map - timestamps (rest timestamps))
12:19rhickeyyes, please
12:20stuartsierramy first example was wrang
12:20stuartsierra*wrong
12:20ieurestuartsierra, Aha, I did not know that map could map across seqs like that. Handy, and it explains why there’s no zip.
12:21stuartsierrayep
12:43brandonware futures basically just very simple agents?
12:44stuartsierranot really
12:45stuartsierraBoth run in a separate thread.
12:45stuartsierraBut deref of a future can block; deref on an agent never blocks.
13:15brandonwstuartsierra: okay, thanks
13:16brandonwso, similar use case in terms of starting something asynchronously, but getting the result (if there is one) of the async operation is different between the future and agent
13:17cemerickI don't think the use cases are similar at all.
13:17cemerickI'd say the use cases of delays and futures are very similar, with the latter being asynchronous.
13:19rhickeyright, an agent is an identity with various states over time. delays/futures are simply pending computations of a single value
13:23chouserhttp://www.indeed.com/jobtrends?q=Java%2C+Python%2C+clojure&amp;l=&amp;relative=1
13:24jcromartieholy crap
13:24jcromartienice
13:24chouserif that surprises you, note that's "percentage growth", not absolute terms at all
13:24jcromartieyes
13:24ieureInteresting.
13:24brandonwis that accurate?
13:24brandonwholy crap
13:24jcromartie6000% over 0
13:24jcromartie:)
13:24chouserclick "absolute" for something closer to what you'd expect
13:25brandonwstill though
13:25brandonwit wouldn't take long at that growth rate..
13:25jcromartiehey what would you call a function that takes this: {:foo.bar 1, :foo.bat 2, :zort 3} and returns {:foo {:bar 1, :bat 2}, :zort 3}
13:25chousera parser
13:25chouser:-)
13:25jcromartiebrandonw: 6000% over the prior level of Clojure jobs is not a lot of jobs
13:25cemerickbrandonw: that's a growth rate with zero as a baseline
13:26cemerickchouser: nice :-)
13:26jcromartiechouser: a parser, really?
13:26chouserwell that's one of the things it's doing, right? extracting meaning from a string
13:27jcromartiethe intended use is taking query/form params and turning it into a more complex map
13:28brandonwwell, given that clojure is very young still, the inital burst of popularity probably accounts for most of the spike
13:29brandonwstill, that is some crazy growth. i checked out scala and it has gotten extremely popular, especially with foursquare and twitter giving it free advertisting. it still has only 1/6th of the growth as clojure
13:29ieureScala still has too much Java for my taste.
13:29jcromartieoh Foursquare is using it?
13:29brandonwyep
13:29jcromartiewe're building a location based service in Clojure :) so there
13:29brandonwlift too, not jus the backend
13:29jcromartiewe've got a sinatra frontend at the moment but I'd like to make it compojure
13:30cemerickactually, this is quite a bit more interesting: http://www.indeed.com/jobtrends?q=clojure%2C+scala&amp;l=
13:30chouseryes
13:30cemerick~ 50% of scala market
13:30clojurebotcertainly petrus
13:31cemerickbut this makes me question the entire dataset: http://www.indeed.com/jobtrends?q=clojure%2C+scala%2C+jruby&amp;l=
13:31chouserthe common timing of the uptick is very interesting. What happened last summer?
13:31jcromartielayoffs
13:31jcromartie?
13:31jcromartieor hiring
13:31jcromartieof course
13:31jcromartiestartups
13:31_fogus_cemerick: Because solutions require 50% of the code compared to Scala. ;-)
13:32chouserheh
13:32cemerickstellear
13:32cemerickstellar
13:32cemerickthat is
13:32cemerick_fogus_: and here I thought you were mostly agnostic towards scala
13:32chousergood point -- if you can hire half the developers to get work done at the same rate, the job market is smaller.
13:32_fogus_cemerick: Oh I am... but truth is truth
13:32chouserRich, what have you done!?
13:33cemerickchouser: we are all in business to eliminate jobs...should happen to us every now and then.
13:33chouserhm, good point
13:34cemerickor, I should say, most interesting software exists to eliminate jobs.
13:34chouserI'll just try to stay on top of things so I don't have to find work painting houses or something.
13:34hiredman
13:34chouserhiredman: no offense!
13:34hiredman:P
13:35chouser:-)
13:35chouserhttp://www.indeed.com/jobtrends?q=clojure,twitter
13:36jcromartiewhat the hell
13:36chouserhttp://www.indeed.com/jobtrends?q=clojure,painting
13:36cemerick_fogus_: sexprs are a categorical imperative
13:36jcromartiewhat's a twitter job?
13:36ieureA job at Twitter.
13:36ieureThose dudes are hiring like crazy.
13:36chouserjcromartie: I assume any job posting that includes the word "twitter"
13:36jcromartiereally?
13:36jcromartiechouser: well yeah
13:37jcromartieI mean in a practical sense
13:37_fogus_gaining on the muffins market http://www.indeed.com/jobtrends?q=clojure%2Cmuffins&amp;l=
13:37ieurejcromartie, We’ve lost a number of candidates to Twitter.
13:37chousersocial advertising jobs, integration jobs, etc.
13:37jcromartieof course everything we are doing involves Twitter now, but I wouldn't call it a Twitter job
13:37jcromartieall you have to know is a few POST methods
13:37LauJensen http://www.indeed.com/jobtrends?q=clojure,drinking&amp;l=
13:37LauJensenStill more money to be made drinking :(
13:37ieurejcromartie, Their APIs are simple, but that’s not really true.
13:38jcromartiewell I exaggerate a bit
13:38ieureI wrote an app to stream the Twitter firehose into HDFS… In Clojure. :)
13:38jcromartieI have spent a lot of time with their APIs
13:38jcromartie:)
13:38jcromartieieure: nozzle, right?
13:38chouserLauJensen: that's hilarious.
13:38LauJensenchouser: how so? You thirsty ?
13:38ieurejcromartie, No, I had no idea that existed.
13:38chouserbut looks like lots of "drinking water sales" and "drinking water treatment specialist"
13:39ieurejcromartie, http://github.com/ieure/Twidoop is what I wrote.
13:39licoresse,(take 10 (iterate str 3))
13:39clojurebot(3 "3" "3" "3" "3" "3" "3" "3" "3" "3")
13:39licoressewhy is the first different?
13:39LauJensen,(Math/pow 10 999)
13:39clojurebotInfinity
13:39LauJensenCan I work with the actual number, instead of 'Infinity' ?
13:40stuartsierraLauJensen: use BigIntegers
13:40_fogus_Clojure overtakes the market for crap http://www.indeed.com/jobtrends?q=clojure%2Ccrap&amp;l=
13:40ohpauleezlicoresse: the first is the arg you passed in
13:40ieurelicoresse, Because iterate returns x (f x) (f (f x)) etc.
13:41licoresseI need to chew on that...
13:41ohpauleez(rest (take 11 (iterate str 3)))
13:41ieurelicoresse, You pass 3 in. 3 is an int. "3" is a string.
13:41ohpauleez,(doc iterate)
13:41clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
13:41ieureRight. And x is 3. And the second is (f x) -> (str x) -> "3".
13:42licoresseok
13:42licoresseand I got 9 "3"
13:42ohpauleezyou don' want to use iterate here though
13:42LauJensenstuartsierra: ah yes - Why wouldnt that be the default/default coersion ?
13:42ieurelicoresse, ohpauleez, Right, just use (repeat "3")
13:42licoresseohpauleez: I see that. Just needed to understand
13:42ohpauleezright
13:43ohpauleez(take 10 (repeat "3"))
13:43licoresseyou're so helpful! thanks!
13:45jasappmaybe someone did this already:
13:45jasapphttp://www.indeed.com/jobtrends?q=clojure%2Clisp&amp;l=
13:45jasappI thought that was really cool
13:46stuartsierraLauJensen: Math/pow is a Java method, returns a double
13:59jcromartiehmm, I guess you can't make middleware that operates on params in compojure?
13:59jcromartieor at least I can't just apply it to my main compiled route
13:59hiredmanwhy not?
14:00hiredmanI'm not entirely familar with it, but isn't it just function composition?
14:00jcromartiethere are no params at the point where the middleware is run
14:01jcromartiethat is I have a big defroutes that combines all of my routes, and then I decorate that with this middleware, and when the middleware runs :params is nil
14:02hiredmaninteresting
14:05LauJensenAnyone here who speaks fluently Ruby ?
14:05stuartsierrayes
14:06lancepantztrue
14:07jcromartiewhat's the best way to do several update-in on a map?
14:07hiredmanI guess you have to write your own defroutes-with-middleware macro
14:07jcromartiesomething like that
14:07hiredmanreduce
14:08hiredman,(reduce #(update-in %1 (first %2) (second %2)) {:a 1} {[:a] inc})
14:08clojurebot{:a 2}
14:09jcromartie-> seems to work for more varied situations
14:11jcromartieI think I could stand to write some kind of "how to read Clojure" or something to help myself and hopefully other noobs
14:12jcromartiebecause it took me a while to get -> and ->> and such
14:12jcromartiebut now I kind of read them in English
14:14ohpauleezjcromartie: http://java.ociweb.com/mark/clojure/article.html
14:14AWizzArdjcromartie: they are very helpful, aren’t they?
14:16defnjcromartie: -> was an idiom i was so well acquainted with i had trouble believing it worked the way it did
14:16defnoutside of clojure I mean
14:20jcromartiedefn: is it available in other lisps?
14:21the-kennyjcromartie: Should be possible to implement it in every other lisp which supports lisp-mactos
14:21the-kennys/mactos/macros/
14:21jcromartieyou say you were so well acquainted with it
14:22jcromartieI assume that means it's in other lisps?
14:22the-kennyI'm not sure if it's defined in the hyperspec for common lisp, but it's easy to implement
14:22the-kenny(yes it should be in other lisps too)
14:23AWizzArdin CL there is no ->
14:23defnjcromartie: im sorry -- what i meant was i was used to that order of computation
14:23defnand that i felt comfortable with -> as soon as i realized that's all it was
14:23defni was initally quite confused by it
14:23jcromartieah I see
14:24the-kennyAWizzArd: But it's easy to implement it. It just isn't defined in the hyperspec
14:24chouserroughly similar to foo().bar(5).baz(1,2) in C-ish syntax
14:24defnit clicked once i saw ..
14:25AWizzArdthe-kenny: right
14:28the-kennyIs there a name for "->"? It's impossible to search for "->" on google
14:29the-kenny(If there isn't a name, we should give it one)
14:29chouserno consistently used name
14:30ordnungswidrigbtw. can bing search for special characters?
14:31ohpauleezthe-kenny: I call it threading an expression, but someone else used a real good term for it just the other day
14:32ordnungswidrigperhaps the haskell boys have a name for it
14:32LauJensenI'm wondering about the Chunky seqs. Is a (lazy-cat) sequence chunked, and how is the chunk size determined?
14:32chouserwell, it's a little like composition of partials, but it's a macro not a function so it breaks down in the details.
14:33lancepantzthe-kenny: it's called a thread
14:33the-kennylancepantz: ok, thanks :)
14:33lancepantzin 'programming clojure' that is
14:34rhickeyis their paredit magic for turning (a (b ...)) into (b (a ...)) ?
14:34chouserLauJensen: lazy-cat will return a chunked seq for any of its args that are chunked seqs, and the chunks are passed through unchanged in size or any other way.
14:34rhickeythere
14:35LauJensenchouser: As I understood the chunky principle, if I realize 50 items, 75 could in fact be realized under the hood - its the number of calculations I'm looking for
14:35chouserLauJensen: yeah, and I'm saying "it depends" :-)
14:36LauJensenchouser: yeah, and I'm saying, on what ?
14:36chouserand I told you, on the size of the chunks of the seqs you give it.
14:36chouser(lazy-cat foo bar)
14:37chouserif foo is un-chunked, and bar is a chunked seq with all chunks of size 32, then lazy-cat will return a seq that is unchunked until you exhaust foo, then chunks of size 32 after that.
14:37LauJensenok, thanks, now go write a book :)
14:42chouserBut since you mention chunks, you saw that rhickey has exploratory code for something that could replace chunked seqs entirely?
14:43LauJensenchouser: No I didn't - Where is it ?
14:44chouserhttp://gist.github.com/306174
14:50LauJensenThanks
14:53a_strange_guychouser: that iter stuff looks wierd but interesting
14:53chouserI think that's accurate. :-)
14:53a_strange_guyoh damn, that not yours ^^
14:54chouserheh, nope. definitely not
14:55a_strange_guythe one thing that i dont understand is why one needs a deftype
14:55a_strange_guyfor Range
14:55rhickeya_strange_guy: for the mutable
14:55a_strange_guyhmm
14:55rhickeyno mutables in reify yet
14:55a_strange_guywouldn't a closed over atom not work?
14:56a_strange_guyor is that too slow
14:57brandonwlancepantz: where in programming clojure is -> mentioned? I didn't catch it on the first read through, although I might have missed it since it (also) uses -> to mean the result of an expression being evaluated
14:58chouserhm, not in the index, though .. is.
14:59chousera_strange_guy: I believe an atom would work fine for Range, though as you note the speed would be different
15:00lancepantzbrandonw: yeah, i don't see it in the index either, i may have been mistaken
15:02lancepantzit's in the core api docs though, http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/-%3E
15:02brandonwyep
15:02brandonwspeaking of the core api docs
15:02brandonwand clojure docs in general
15:03brandonwi found clojure.org/transients somehow, but i don't know if it is actually linked from anything else
15:03lancepantzi guess i just remember it being called the thread macro :/
15:04a_strange_guyhmm, i wonder if a dead-simple reference type would be as fast as a field
15:05a_strange_guylike a ref rom ML
15:05a_strange_guywith no concurrency semantics whatsoever
15:06chouser,(.val (clojure.lang.Box. 5))
15:06clojurebot5
15:07chouser,(let [box (clojure.lang.Box. 5)] (set! (.val box) 10) (.val box))
15:07LauJensenchouser: I dont think that code explains itself very well - How does it replace chunked seqs?
15:07clojurebot10
15:08a_strange_guychouser: nice (of course it isn't xD ), is that used anywhere?
15:08chouserLauJensen: it implements some of the seq library functions (takez, reducex, etc.) in a way that allows a chain of seq operations to run faster than similar chunked seqs.
15:09chouserLauJensen: since the only point of chunked was performace, this is a potential replacement.
15:09LauJensenWhat makes it faster ?
15:09a_strange_guyLauJensen: it doesn't allocate
15:09Chousukethe seq actually doesn't exist
15:10chousera_strange_guy: well, it's not a reference type. ...but yes, it's used in a few places internally in clojure
15:10LauJensenah ok, interesting
15:10chousera_strange_guy: mostly for "out" args, it looks like
15:11a_strange_guychouser: maybe a unsynchronized-box and a volatile-box could eliminate most uses of mutable fields in deftype
15:12duncanmdum de dum
15:12a_strange_guymutable fields "feel wrong" for me, as if the don't really exist because they arent objects
15:13duncanmwhat's an idiomatic way of generating a grid (vector of vectors), which each element is a pair (x, y)?
15:13duncanmi can write (replicate 10 (replicate 10 'x)), but then i can't specify the (x,y) easily
15:13LauJensenchouser: the old chunky-seq stuff was written in Java right ?
15:13Licenserdoes c.c 1.1.0 has templates already or is it a 1.2.0 thingy?
15:14hiredman,(((vec (replicate 10 (vec (replicate 10 'x)))) 0) 0)
15:14clojurebotx
15:14chousera_strange_guy: such boxes would each require an extra allocation, and couldn't support primitive values as well as a mutable field could.
15:14a_strange_guyLicenser: 1.1 has them
15:14AWizzArdwhar are templates?
15:14Licensera_strange_guy: thank you!
15:14hiredman,(get-in (vec (replicate 10 (vec (replicate 10 'x)))) [0 0])
15:14clojurebotx
15:14chouserLauJensen: some layers of it, yes.
15:15a_strange_guyAWizzArd: http://vimeo.com/8360422
15:16a_strange_guydon't think that anybody uses them
15:16duncanmhiredman: is it important that I put in the vecs?
15:17AWizzArda_strange_guy: thanks. I did not use them because I never heared about it.
15:18hiredmanduncanm: yes
15:18hiredmanthe other option would be a set of nested nth's
15:30Licenser*sigh*
15:35Licenser_why are simple things at times so complicated in clojure? Or other question, what am I doing wrong?
15:35Chousukewhat are you doing?
15:35Licenser_I just try to get my code work with clojure (and cc) 1.1, now noething works any more
15:36Licenser_slime is broken, saying it can't use swank any more, lein does not compile and refuses to allow me to use any of the new c.c classes like c.c.template
15:36Licenser_tecnically nothing is working correctly any more
15:37Licenser_I thought it would be as easy as changint 1.0.0 in the project.clj to 1.1.0, apearently it isn't :(
15:38chouser1.1 is almost completely backward compatible with 1.0. You may want to make sure you're cleaning everything before rebuilding.
15:39chouseris that what I mean? I mean code written to work with 1.0 will almost all work just fine on Clojure 1.1.
15:39Licenseryes I know but it seems something is not 1.1'ish
15:39clojurebotamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
15:40LicenserI mean i unpackt c.c-1.1.0.jar, and there is no c.c.template
15:40Licensersomething seems very much not correct
15:40somniumLicenser_: its clojure.template in 1.1, same for walk
15:41Licenseroh
15:41Licenserand what about c.c.io? is that c.io?
15:42Licenseror c.c.json seems odd too :(
15:42somniumLicenser: look in the respective jars?
15:47jcromartiestruct definitions don't support metadata?
15:47a_strange_guyjcromartie: no, but their vars do
15:48jcromartieah
15:49a_strange_guyeg: (defstruct #^{:my-meta :metadata} mystruct :a :b :c)
15:49a_strange_guy(meta (var mystruct)) => {:my-meta .....}
15:50jcromartieI am trying to attach validation to structs
15:50jcromartiebut I think I'll just keep it in a function
15:53chousera_strange_guy: I'm curious what horrified you.
15:56Licenser:) working again!
15:57a_strange_guychouser: Settable, Streamable, Stream, Range ... possibly more
15:58a_strange_guyi'm trying to find out which Interfaces/Methods/Classes are used where
15:58jcromartie(ancestors (type x))
15:58jcromartie,(ancestors (type []))
15:58clojurebot#{clojure.lang.Sequential clojure.lang.IEditableCollection clojure.lang.IPersistentCollection java.lang.Iterable java.util.List clojure.lang.APersistentVector java.lang.Comparable clojure.lang.Seqable clojure.lang.Obj java.util.RandomAccess clojure.lang.ILookup clojure.lang.IObj clojure.lang.IMeta clojure.lang.Reversible java.lang.Object clojure.lang.IFn clojure.lang.Indexed clojure.lang.IPersistentVector clojure.lang.Asso
15:59jcromartiethat's a lot
15:59chousera_strange_guy: http://tinyurl.com/clojure-classes
15:59chouserthat that chart is probably a bit out of date.
15:59chouserthough
16:00chouseryou can see that the seq types are grouped mostly at the top, collection types mostly in the middle, and reference types on the lower right
16:01a_strange_guythat's a big help
16:02a_strange_guythe Stream classes are obslete I suppose
16:03chouseryes, they were never officially in the language.
16:05a_strange_guyafter reading all that Java I *reaally* want to see clojure defined in itself
16:05chouser:-)
16:27jcromartieis lein test broken?
16:27jcromartie [null] java.lang.Exception: No such var: clojure.test/successful? (NO_SOURCE_FILE:1)
16:43a_strange_guyhttp://gist.github.com/312749
16:43a_strange_guyI think I found a compiler bug
16:43a_strange_guywith deftype
16:44hiredmanyou know clojure fn's are runnables, yes?
16:45a_strange_guythat's not the point
16:45a_strange_guymutable fields don't work
16:46a_strange_guycan someone explan this?
16:46chousera_strange_guy: you're using a very recent master branch?
16:46a_strange_guybrand new
16:47a_strange_guyin the same repl the Iter/Cell stuf works
16:47a_strange_guy^stuff
16:47duncanmhmm
16:48duncanmI thought (merge {:foo ["bar"] } {:foo "baz"}) would give me {:foo ["bar" "baz"]}
16:48duncanmwoohoo netsplit
16:48licoressewoohoo
16:48licoresse,(merge {:foo ["bar"] } {:foo "baz"})
16:48clojurebot{:foo "baz"}
16:49duncanmoh
16:49hiredmanI don't know what the syntax for the mutable stuff is
16:49chousera_strange_guy: I've got a simpler deftype with mutable field working here.
16:49duncanm"If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result."
16:49chousertrying yours now
16:49duncanmboo
16:49hiredmana_strange_guy: are you sure you have it right?
16:49duncanmis there a way to write that without having to get ahold of the original value and then conj onto it?
16:50duncanmotherwise, merge and assoc are kinda the same...
16:50a_strange_guychouser: same here, a simpler deftype works
16:51a_strange_guyclojurebot: paste
16:51clojurebotlisppaste8, url
16:51chousera_strange_guy: ok, I'm reproducing your exception.
16:52a_strange_guyeven stranger: http://gist.github.com/312749
16:52a_strange_guyusing an explicit "this" helps
16:52a_strange_guyit compiles, but doesn't run
16:56chousersimplest error case I've found yet: (deftype Bench [#^{:unsynchronized-mutable true} val] Runnable (run [] (let [x (loop [] (set! val 5))])))
17:00ska2342Hi. Has anybody ever tried to combine multi-methods with arity-overloading? Is that supposed to work at all?
17:01chousersure. the most common mistake is to not accept all arities in the dispatch fn
17:03ska2342I think I had some problem in the method (don't have access to that session right now). For the moment it's enough for me to know, that it's supposed to work. Thank you.
17:05hugodtechnomancy: did my patch for swank-clojure-find-package make sense?
17:06technomancyhugod: I've been hugely backlogged on incoming patches... haven't done any OSS in a week due to a big deployment at work. =\
17:06technomancy44 pull requests pending.
17:07hugodok, :-) just making sure it was in the queue
17:07technomancyI think someone volunteered to help with swank-clojure maintenance, but I haven't even had a chance to contact him.
17:22hiredmanso isMutable is called twice on val, first time is true, second time is false
17:23chouserso ... it mutated? ;-)
17:25hiredman,(identical? 'val 'val)
17:25clojurebotfalse
17:25hiredmanI wonder if that is the issue
17:25hiredmanmissing metadata?
17:26hiredmandebugging java is such a pain
17:26AWizzArdhiredman: I could imagine that two distinct and fresh symbols are created by the reader and they are thus not identical
17:26hiredmansure
17:26ska2342hiredman: 'val and 'val are not identical because a new symbol is created every time, if I understood things correctly
17:27hiredmanhey guys
17:27hiredmanthanks, but I am well aware
17:27ska2342hiredman: looked like a question. nevermind.
17:28chouserbleh -- I find myself tempted to copy data from a vaguely structure-like thing (protobuf message) into a deftype instance, just so I can use fast :keyword lookup. :-P
17:28hiredmandid you ask rhickey about the keyword lookup?
17:29chouseryes, and he seemed to suggest things that I could do, a way I could wrap the protobuf msg and have keyword lookup with site caching work. ...and then he took it all back.
17:29AWizzArdchouser: what is bad about this?
17:29AWizzArdI mean that you use deftypes?
17:30chouserAWizzArd: what's bad is it feels like exactly the kind of think clojure is generally good at helping you escape.
17:31chousermuch better would be to just wrap the protobuf msg -- ooh, or extend ILookup to it! -- but then I apparently can't have performance that matches using the protobuf msg directly.
17:32hiredmanit would be nice to see a document describing how the keyword call site stuff works
17:33chouserwhat, reading the byte-code producing ASM lib calls in Compiler.java isn't enough for you!?
17:33hiredmanactually I was reading the generated bytecode
17:33AWizzArdhiredman: so you can read the Matrix?
17:33hiredmanAWizzArd: I put it through javap first
17:34hiredmanthere is some kind of complex (at least when you don
17:34hiredman't under stand it) feedback between functions that use use keyword callsites and deftypes
17:36chouserjavap's a fantastic idea
17:37hiredmanyes
17:37hiredmanthe classes of fn's with keyword callsites in them have a few extra fields
17:39a_strange_guyI suppose only rhickey touches Compiler.java?
17:42chouserI've made a couple very minor patches.
17:44a_strange_guyI think that I found the reason why mutable fields fail sometimes
17:45hiredmanI added a new special form once!
17:45hiredman(not something that ever got merged or anything)
17:46a_strange_guyI'll just file a ticket with some pointers to the problem
17:46hiredmana_strange_guy: what is the problem?
17:47a_strange_guyhttp://gist.github.com/312749
17:48hiredmanright
17:48hiredmanthat is the symptom
17:48a_strange_guymutable fields + loop fails
17:48hiredmanoh, I thought you had found something in the compiler
17:48a_strange_guyi did
17:49a_strange_guyline 4857 in Compiler.jave is the problem
17:50a_strange_guythe loop special form gets turned into a fn sometimes
18:02duncanm,(doseq [{foo bar} [{:a 'b}]] (print foo bar))
18:02clojurebotjava.lang.Exception: Unable to resolve symbol: bar in this context
18:02duncanmdoesn't destructuring work in doseq?
18:05hiredmanduncanm: it would if you destructured correctly
18:05hiredmandestructuring?
18:05clojurebotdestructuring is http://clojure.org/special_forms#let
18:08duncanmhiredman: i don't see where i got it wrong
18:08duncanm(let [{k v} {:a 1}] (print k))
18:08duncanm,(let [{k v} {:a 1}] (print k))
18:08clojurebotjava.lang.Exception: Unable to resolve symbol: v in this context
18:10hiredmanduncanm: paste an example from that page please
18:11duncanmhiredman: oh, the names of the keys has to match?
18:12hiredmanright
18:13duncanmoh, but i don't know what the keys would be.... too bad
18:14scottjHow would you create a macro defn2 that's like defn but evaluates the name arg and converts to symbol instead of requiring a symbol w/o evaluation? are macros right for this?
18:15tomojwhy would you want to do that?
18:15hiredmanwhy would you do that?
18:16scottjI have some code that defines a bunch of functions and the names of the functions are things like (str "foo" "bar") and need to be evaluatd and turned into symbols then used in defn
18:17hiredmanwhy?
18:17clojurebotwhy not?
18:17the-kennyscottj: Are you sure you want this?
18:17the-kennyCouldn't you use a map which maps string to fn-objects?
18:17jcromartiescottj: there are other ways to attach things to namespaces
18:17hiredmanif you are doing dynamic stuff I oubt you want to use defn anyway
18:17jcromartieI create a map of keywords to functions
18:17jcromartiethen I can intern them if I want to or just use the map itself
18:18jcromartie(doseq [[k v] x] (intern *ns* (symbol (name k)) v))
18:18jcromartiebut I am not liking it so much anymore
18:19jcromartieI don't like magic variables
18:21duncanm,(doseq [[k v] (vec {:a 1 :b 2})] (print k v))
18:21clojurebot:a 1:b 2
18:21duncanmthat works
18:23scottjjcromartie: that's cool I didn't know I could do that. defn of course does the arglists and line/file for me.
18:23scottjthe-kenny: I guess I just want the functions to behave the same as if I'd written the code by hand
18:24hiredmansounds dreadful
18:24jcromartieso I feel like I've gone down the wrong path here
18:25scottjjcromartie: what's magic about the variables btw?
18:25jcromartiescottj: variables in namespaces that you didn't explicitly def
18:25jcromartienot cool
18:25jcromartieor variables that are available in a macro body that are not visible in the definition
18:26jcromartieI think I should be using the type system and multimethods to implement this data layer but I'm not sure
18:26jcromartieright now I'm creating maps that contain create/fetch/update/destroy function closures around the collection name
18:27jcromartiebut don't want to define the same insert/etc. functions in each namespace for each resource in the app
18:27somniumIve taken to using symbols like $magic-foo $magic-bar in macros with variable capture, is it really evil?
18:29somniumer, symbol-capture
18:34scottjin (defmacro defn2 [name body] `(defn ~(symbol name) ~'[x] ~body)) how do I tell it to evaluate name as well?
18:35jcromartiescottj: seriously, ask yourself why you want to do this
18:35jcromartieif you can create the fn you can define it another way
18:35jcromartieI mean create a var for it
18:35jcromartiebut try to figure out a way that doesn't create vars in namespaces that can't be seen and comprehended by human beings
18:36scottjjcromartie: I want the vars to be seen and comprehended by humans, that's why I'm doing this
18:38jcromartieif you can't just type them, then they're being generated in some other way, right?
18:38jcromartiei.e. you're probably iterating over something creating fns
18:40AWizzArdscottj: anyway, you could try ~(eval (symbol name))
18:40hiredmanAWizzArd: sshhh
18:40AWizzArdthough as jcromartie said, it may be worthwhile to think such a design over and see if it really is needed
18:40scottjAWizzArd: I have a version working w/ eval, but ppl always say not to use it so I was looking if there was something else in macros
18:41jcromartieso the big picture for me is that I want to map structs into mongodb
18:41AWizzArdin most cases where eval is used eval is not needed and an inefficient hack
18:41AWizzArdin most cases where eval is used by Lisp/Clojure beginners, eval is not needed and an inefficient hack
18:41hiredmanscottj: why listen to everyone when they tell you not to use eval if you are going to ignore everyone when they tell you not to do what you are doing?
18:41jcromartieAWizzArd: especially in JavaScript :)
18:42jcromartieI've seen some scary stuff
18:42scottjhiredman: bc I don't think any of the reasons given so far have been very good :)
18:42jcromartiescottj: what's the overall goal?
18:42jcromartielike, of the lib or whateever
18:42hiredmanscottj: you're not even listening when people tell you not to use def or defn for this
18:42scottjI don't see what's wrong with defining a bunch of functions that have good names and have proper metadata
18:43scottjjcromartie: unit conversions
18:43hiredmanscottj: the problem is def has particular compile time semantices, and you are going to run into issues if you try and use this macro in another namespace
18:44jcromartieOK so you probably are wanting to define functions like from-f-to-c etc.
18:44jcromartieright?
18:45scottjjcromartie: yep, http://gist.github.com/276662#file_units.clj
18:46scottjhiredman: so if the macro is defined in foo and called in bar then the functions (and their symbols) will be in namespace foo?
18:47hiredmanscottj: I forget exactly, to be honest
18:47hiredmanscottj: I don't get why
18:47hiredmanscottj: I don't get why 15:35 sarah : having been exposed
18:47hiredmaner
18:47hiredmanweird
18:48somnium scottj: why not just build the names you want in a helper and put them in the expansion?
18:48jcromartieyeah I'd say that's pretty weird
18:48somnium:P
18:48hiredmanscottj: I don't get why ["fahrenheit" "celsius"] is better than [fahrenheit celsius]
18:49scottjhiredman: defconv-3d doesn't have to be a macro
18:51scottjsomnium: I'm sorry, I don't understand. Can you explain?
18:55a_strange_guychouser: I did some (really unscientific) benchmarking on the idea of a "box" reference type I talked earlier
18:55a_strange_guyhttp://gist.github.com/312873
18:56a_strange_guyperformance seems to be equivalent to a normal mutable field
18:57somniumscottj: I just noticed that create-function is doing (eval (list 'defn (symbol s) ...))
18:58a_strange_guyallocation shouldn't be a problem in most cases
18:58a_strange_guyespecially if we get escape analysis
18:58somniumscottj: I dont understand why its not a macro
19:00scottjsomnium: I'm trying to write the macro version but having trouble having it evaluate a parameter that's a list and call symbol on that
19:03somnium,(let [f (fn [name] `(defn ~(symbol name) ...))] (f (str "bar" "foo")))
19:03clojurebot(clojure.core/defn barfoo ...)
19:03somniumor maybe Im not understanding...
19:06scottjthat evaluates name bc it's a fn not a macro right? I'm still new at macros but whereas that just returns the code, a macro would run the expansion I think, which is what I want
19:10jcromartiesometimes I wish I could thumbs-up a song on Pandora ten times
19:10somniumjcromartie: what song? (Ive been digging ratatat for clojure hacking)
19:10jcromartiehah, not really hacking music: Charlotte Sometimes by The Cure
19:12somniumscottj: where is the list argument coming from?
19:12scottjsomnium: I like ratatat 9 beats
19:12clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
19:13pthatcher,(def *a* "a")
19:13clojurebotDENIED
19:13jcromartieratatat, I'll have to check it out, is that some IDM or what?
19:14scottjsomnium: the arglist ([x])? it's always that
19:14jcromartie(sounds good so far)
19:15jcromartiethis guy is some good hacking music, but it's hard to get ahold of the actual songs http://www.myspace.com/signaldrift
19:16pthatcher,(case *clojure-version*
19:16clojurebotEOF while reading
19:16pthatcher *clojure-version* true
19:16pthatcher false)
19:16jcromartiea little bit Boards of Canada, a little bit Aphex Twin
19:16pthatcher,(case *clojure-version* *clojure-version* true false)
19:16clojurebotjava.lang.Exception: Unable to resolve symbol: case in this context
19:16pthatcherHmm.. not running Clojure 1.2?
19:16pthatcherIn Clojure 1.2, that evaluates to false.
19:17Knekkfor hacking I lean more towards the techno... I guess most people do
19:18jcromartiewow apparently Google is blocking the ol' intitle:"index of" trick
19:18jcromartieit thinks I'm a botnet
19:20Knekktry Infected Mushroom, Chemical Brothers, Prodigy
19:20somniumthis signaldrift is alright
19:21pthatcherExample of bug in Clojure 1.2 case macro, and a temporary work around: http://gist.github.com/312898
19:24scottjfirst song on infected mushroom's myspace is matisyahu. I heard some low-tempo dub before a matisyahu concert that I thought would be really good for hacking, if a bit repetitive
19:25KnekkBanco de Gaia, Aphrodite
19:25KnekkUnderworld
19:25Knekkanyway
19:25jcromartieyeah dub is good
19:26scottjjcromartie: any you especially like?
19:26jcromartieI have only ever heard some novelty stuff like Dub Side of the Moon, which I know is serious, but still :P
19:27Knekktry the RiverRun Project
19:27jcromartieKnekk: woah, it looks like a band of Stings
19:27Knekkwithout the suckage
19:28jcromartiehey don't know Sting... he might be a cheesy old bastard now but The Police are alright
19:28jcromartiedon't knock, that is
19:28Knekkthey had some decent songs, sure
19:32jcromartieOK I think attaching metadata to the var in defstruct is a much better way to get structs into the database
19:32jcromartieand some macros
19:32jcromartieI am liking this much better than my GIANT BALL OF FNs that I previously was using
19:32jcromartie(def users-resource (resource :users user-struct :validate validate-users)) ;; NASTY
19:33jcromartie(defstruct #^{:coll :users :validate validate-users} user :email :hash :created ...) ;; much better
19:34jcromartieoh and before it would be ((:fetch-one users-resource) {:email "whatever"}), where now it's (struct-fetch user :where {:email "whatever"})
19:37somniumscottj: last try, if you make defconv a macro, it seems that something like `(do ~@(for [[units eq] ...] (defn ~(make-name ...) ~(make-arglists ...) ...) would suffice.
19:38somniumer, missing a syntax-quote
19:43tomojanyone have any thoughts about testing side-effecty code (e.g. c.c.http.agent stuff)? I found http://github.com/amitrathore/conjure but something about this approach feels wrong to me
19:44jcromartiestructs in mongo with validation and delete rules: http://gist.github.com/312918
19:44jcromartieoops, I forgot update
19:47jcromartie(update and struct-conform is there now)
19:55scottjsomnium: you mean ` before (defn?
19:55somniumscottj: yeah
20:23jfkwIs there any java http server along the lines of unicorn (ruby) and gunicorn (python port), "designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels."
20:23jfkwfor hosting clojure http apps, of course.
20:25chouserjfkw: seems likely, but I'm sorry I don't know for sure.
20:26scottjjfkw: I don't know about those but netty uses NIO and will use some java 7 stuff that I think's like of like the linux kernel stuff nginx uses
20:26scottjs/like of like/kind of like
20:27chouserrhickey: Do you think there's any value in me trying to get ILookupThunk to work beyond deftypes?
20:27KarlThePaganjfkw, grizzly (or glassfish) with the right threadding strategy works well in high-bandwidth situations
20:29scottjjfkw: grizzly not netty is what I meant
20:42KarlThePaganyea grizzly has worked out all the java 7 kinks
20:48jcromartieugh with the circular dependencies again
20:49jcromartieI have users and messages in separate libs
20:49chouseris that valuable?
20:49jcromartieand since they are related, they both need to know about each other
20:49jcromartieI could probably just have a model.clj lib with all of the data models and validation logic in it
20:50jcromartieand then have api libs for the compojure stuff
20:50jcromartiehow about it?
20:50jcromartieugh I run into these all the time
20:50jcromartie84K of clojure code here already and I can't figure out the deps :P
21:03chouserI hardly ever run into these. maybe split things up less?
21:05jcromartieyeah that seems to be the answer
21:05jcromartiecoming from a lot of languages, having more than one thing in a file seems like a crime
21:06jcromartieI also feel like my validation functions are getting awfully close to being able to create a struct at the same time...
21:07jcromartieseems like it could turn into a declarative data model
21:30jcromartiehow can I attach metadata to a var created using def inside a macro?
21:33chousereither use with-meta on the symbol name of the def, or use alter-meta! afterwards
21:35jcromartielike this: (defmacro x [name y] `(def (with-meta ~name {:y ~y}) nil)) ?
21:35jcromartieah
21:35jcromartieno
21:35chouserright, no.
21:36chouser~(with-meta name {:y y})
21:36clojurebothttp://www.slideshare.net/mudphone/fun-with-vars
21:37jcromartieah ha
21:37TheBusbyfor compojure, what do you need to do to have it use grizzly instead of jetty?
21:42scottjTheBusby: it's really easy, in compojure.clj change jetty to grizzly
21:43TheBusbyscottj: That's great!
21:44TheBusbythank you
21:46chouserwell, implementing IKeywordLookup and ILookupThunk is sufficient for getting correction values out
21:46hiredmanwhat is ILookupThunk?
21:47chouserI think it's the think that gets swapped in at the call site
21:47chouserthe thing
21:49hiredmanhmmmm
21:51chouserbut I'm not sure how to confirm it's getting used in a way that gets all performance a deftype does
21:53hiredmanso what implements ILookupThunk? the same object that implements IKeywordLookup?
21:56chouserno, looks like one ILookupThunk obj per keyword*deftype
21:58chouserthe Thunk is passed only the object (an instance of a deftype) and returns the right value.
21:58jcromartieyay, defining a struct and its validation function in the same swipe
22:00jcromartie(defmodel user :users (required :email non-empty-str) (optional :first str) (optional :last str))
22:01hiredmanwhat about passing in a predicate function instead of str
22:01hiredmanlike string?
22:01hiredman,(doc string?)
22:01clojurebot"([x]); Return true if x is a String"
22:01jcromartieI want to actually transform the value sometimes
22:01jcromartielike parse-int
22:01jcromartieor parse-float
22:02jcromartie(required :key f) throws if the result is nil or false
22:02jcromartieoptional just takes whatever
22:02jcromartiethis is mostly for consuming parameters from a web request
22:03jcromartieand it uses update-in so it also works with key paths
22:03jcromartie(required [:loc :lat] parse-double)
22:04jcromartiebut that doesn't quite work yet (it only requires :loc, techincally)
22:04jcromartieor wait, does it work?
22:06dnolenjcromartie: that sound like a really cool piece of reusable code for RESTFUL resources.
22:07jcromartiethat's the idea
22:07dnolenRESTful, anyways, are you going to release when it's further along? I'd totally use that.
22:07jcromartiepossibly
22:07jcromartieI would like to
22:07jcromartiebut I have to just finish this stuff first :P
22:09dnolenheh, no rush. sounds like a great idea tho. I much rather validate that way over regexes. It would be cool if there was someway to map the model to urls. Like automatically provide the proper regexes.
22:09dnolen(defroutes (routify my-model)) would be cool.
22:10jcromartiealready on it
22:11dnolen:)
22:11jcromartie(defroutes user-api (json-REST-routes user))
22:11jcromartieit's all a little bit rigid for my current purposes
22:11jcromartieadds access restrictions etc.
22:49brandonwwhat is the easiest way to check for sure if your version of clojure.contrib has the seq library
22:49brandonwit is failing on a use call saying FileNotFoundException, but I checked the source and clojure.contrib.seq is pretty old, right?
22:49brandonwi'm not sure how arch linux's repo version of clojure.contrib couldn't have it...
22:50hiredmanuh
22:50hiredmanI don't think so
22:50hiredmanI think seq-utils was very recently renamed to seq
22:51brandonwoh actually
22:51brandonwyou're right
22:51brandonwmy mistake
22:52brandonwi just remembered when whoever told me about it initially, they called it seq-utils, too
22:52brandonwi looked up the docs and saw it was called just seq and just forgot about it
23:39radswhen does it make sense to use dynamic binding over passing around a struct everywhere?
23:40slyphonrads: i was told that it doesn't, really
23:41progskiI'm writing a loop that continuously reads data from a socket, and I was using a loop/recur to emulate something like while(true) {}. Inside the loop I will pass the data to a callback function. I feel like there may be something more idiomatic or is this okay?
23:41hiredmanit's annoying if you ever what to use the same functions on two structs
23:41hiredman,(doc while)
23:41clojurebot"([test & body]); Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. Returns nil"
23:41radsslyphon: is it a different case if you're passing something like a database connection around?
23:42progskibah, that was obvious, thanks
23:42slyphonrads: well, hiredman was the one that said "don't do that" so i defer to him
23:43slyphonrads: the problem is that dynamic bindings are thread-local only
23:43slyphonso you can run into trouble if you're dealing with agents, for example
23:45radswell, c.c.sql has with-connection, clojure-redis has with-redis, etc... is it just because it looks nicer?
23:45slyphonhonestly, i'm a n00b, so i can't speak with any authority
23:45hiredmanwell, I am just some dude on irc
23:46slyphonhiredman: you wrote clojurebot!
23:46hiredmanclojurebot is just some bot on irc
23:46slyphoni mean, wow!
23:46hiredmanclojurebot: hiredman
23:46clojurebothiredman <3 XeLaTeX
23:46slyphonhiredman: you're ruining my illusions
23:46slyphonpeople need heros, hiredman
23:48hiredmanrads: they do and they are fine in some cases, but if you ever want to operate on more than one of whatever you passing via dynamic binding at once it is a pain