#clojure logs

2010-07-23

00:00cemerickmmarczyk: where is it 6AM now?
00:00mmarczykcemerick: most of the EU :-) -- Poland in my case
00:01cemerickah, I should've guessed given the bar on the 'l' :-)
00:01mmarczyk:-)
00:03cemerickmmarczyk: how's the software biz in Poland in general? I've worked with a lot of Czechs, but never a Pole.
00:03cemerickA few more anecdotes, and I'll have some data!
00:03mmarczyk:-)
00:03mmarczykI'd love to be able to answer, but I've mostly been a hobbyist so far
00:04cemerickReally! What's your real job, then?
00:04mmarczykI'm doing a PhD in logic
00:05mmarczykthough my institution is called "Institute of Philosophy" (of ...) :-)
00:05mmarczykhm... I wonder if that's a job ;-)
00:05cemerickI'm sure I'm not qualified to say. ;-)
00:06mmarczyk:-)
00:07cemerickMy academic friends and I eye each other with great suspicion and total confusion most of the time.
00:09slyrusmmarczyk: I think the point is that letfn _is_ a letrec, it's just one that wraps each of its bound forms in a lambda.
00:11mmarczykslyrus: take that! -- (letrec [x (promise) y (fn [] (deliver x :foo))] (y) @x) ;-)
00:14slyrusis that supposed to return?
00:14mmarczykcemerick: I've been thinking of taking a tentative step or two into the industry lately, just because I'm enjoying programming so much... so far, confusion is definitely involved :-)
00:15mmarczykslyrus: sure, in fact it does at my REPL
00:15rhudsonmmarczyk: that also works just with 'let
00:16mmarczykrhudson: true, my point is that letrec is really a cross between let and letfn
00:18cemerickmmarczyk: the worlds are soooo different. I think thriving in either environment indicates aptitude of some sort.
00:19tomojmmarczyk: logic? cool!
00:20mmarczykcemerick: right... with the "aptitude domains" apparently largely disconnected
00:20mmarczyktomoj: :-)
00:20cemerickmmarczyk: yup, mostly disjoint ;-)
00:20mmarczyk:-)
00:21slyrusmmarczyk: of course that can be done with just: (let [x (promise) y (fn [] (deliver x :foo))] (y) @x)
00:22mmarczykslyrus: that would be the meaning of rhudson's remark -- see above
00:22cemerickThere are more or less sane subdivisions, of course. I'm in a particularly sane environment, and seen highly dysfunctional ones in the past. Of course, the gossip in each camp always focuses on the horror stories from the other side.
00:22slyrusoh, busy looking at my emacs window instead of irc...
00:24mmarczykcemerick: I've been largely disconnected even from the local industry gossip... hearing a little bit hear and there these days sometimes makes for a weird sense of an alien encounter :-)
00:25blaisQuick question: is there a way to apply to a record?
00:25blaise.g. (defrecord Bla [a b c])
00:26mmarczykthat's actually enjoyable in a way, mind you
00:26blaisthen, (let [args [a b c]] (apply Bla. args))
00:26blaisI could not get this to work, I ended up building an expression, including quoting, and then calling (eval). It's a bit nasty.
00:26mmarczykblais: not like that, you'll have to make a factory function
00:26mmarczyk(defn make-bla [a b c] (Bla. a b c))
00:27blaisLike CL.
00:27OliverUvhey, I'm new here! I saw a video lecture on multi-threaded use of Clojure and got really interested
00:27cemerickblais: constructors (and other interop forms) aren't functions, apply won't work with them
00:27blaisWouldn't it make sense to automatically generate those?
00:27blaisI know, special forms, like quote. Thus my question.
00:27mmarczykmaybe, afaik it's not off the table for the future
00:28blaisI suppose I could create a macro that does both defrecord and creates a factory func at the same time.
00:28OliverUvThinking of getting an excuse to program clojure after my current project/job is done, but I was wondering how do you people feel about macros now that the syntax isn't just lists and keys (a la CL) any more?
00:28tomojfactory functions used to be generated automatically
00:28tomojno longer
00:28tomojso I guess there was some reason they were bad
00:28cemerickblais: factory functions are more likely in general, at least to start
00:29tomojmaybe just the name collision with the class?
00:29OliverUvDo you feel it is more effort, or about the same as before? Do you avoid using macros more? Or perhaps find yourself thinking them through more?
00:29mmarczykOliverUv: CL and Scheme have vector literals too (though different from Clojure's)
00:29cemericktomoj: that, and there's good symmetry in there being one canonical way to create instances of classes.
00:29blaisIt would be nice if a record supported IFn, and that call would be a factory function by default, a-la-Python
00:30mmarczykblais: but you can provide all sorts of IFn implementations for your defrecords / deftypes
00:30OliverUvmmarczyk: ah, and so I assume the [ ] syntax can be replaced by functions like (make-vector ..) or something ?
00:30cemerickblais: I use this at the moment: https://gist.github.com/6676bbfb35f305d05825
00:30cemerickthe factory fn inits the record with default values
00:31mmarczykOliverUv: well, not really
00:31rhudson,(= [1 2] (vector 1 2)
00:31clojurebotEOF while reading
00:31mmarczykOliverUv: vectors and maps are used in Clojure for things like argument lists and metadata maps
00:31rhudson,(= [1 2] (vector 1 2))
00:31cemerickThere will likely be a way to define multiple factory fns, accessible as statics on the class.
00:31clojurebottrue
00:32cemerick(or, that was the leading contender, last I knew)
00:32mmarczykOliverUv: you can't write (fn (x) ...) in place of (fn [x] ...)
00:32mmarczykOliverUv: that doesn't interfere with the convenience of using the macro facility, though
00:33OliverUvyeah, the syntax is still relatively simple
00:33cemerickOliverUv: why are vector literals difficult with macros?
00:34OliverUvcemerick: Any extra syntax is more effort with macros, because it causes differentiation between code, data, and different kinds of code and data
00:34OliverUvbut if you can just say (vector 1 4) aswell as [1 4] then there is no problem
00:34OliverUvso I take it you are happy with the macro facilities of Clojure? :) man, any of you got good ideas for projects I can convince my professors to let me do for the university? (paid)
00:34OliverUvheh
00:34cemerickI guess I don't see the complication. You can put [1 4] in a macro definition without a problem.
00:34mmarczyk(define-syntax foo (syntax-rules () ((foo #(a b c)) (a b c)))) => (foo #(+ 1 2)) => 3
00:35mmarczykthat's Scheme... no problem using vectors in macros there
00:35cemerickOliverUv: CL-style, but hygenic. Hard to beat IMO. :-)
00:36mmarczyksomehow this brings to my mind the fact that syntax-quote isn't a macro yet... can't wait for that one :-)
00:36OliverUvcemerick: yes, but if you want to transform it to another kind of data, then it is not a matter of exchanging a symbol from vector to list, but to change from [] to parens, which is more effort
00:37mmarczykor actually I guess I might want to write myself a quasiquote... hm.
00:37cemerickOliverUv: Given the seq abstraction, you generally don't need to care about vectors vs. lists vs. whatever, unless you have to (e.g. fn arg syntax).
00:38blaisWhat's the difference btw (fn) and (fn*)
00:38blais?
00:38mmarczykblais: fn* is the special form fn -- which is a macro -- expands to
00:38cemerickblais: fn* is an implementation detail you should forget you know about
00:38cemerick;-)
00:39mmarczykhm, what cemerick said :-)
00:39blaiscemerick: hard to forget when I see it everywhere in macroexpand-1
00:39blaisThx guys,
00:39rhudson,(let [x [1 2 3]] `(~@x))
00:39clojurebot(1 2 3)
00:39mmarczykbasically the difference is there's no destructuring on arguments
00:39slyruswhy isn't def in the clojure.core API?
00:40rhudsonso it's not hard to convert vector to a list if you need to -- but as cemerick says, you generally don't need to
00:40cemerickblais: I think it will go away eventually, but it's not a high priority.
00:40slyrusand binding only works on global vars?
00:40slyruswith (binding ...) that is
00:40mmarczykslyrus: yes
00:41blaisthis would be useful in the core: (defn map* [f coll] (map #(apply f %) coll))
00:41blaisor map-apply
00:41slyrusmmarczyk: the binding APIs don't make that clear. are the rules on that spelled out somewhere?
00:41Lajla,(let [x '(His Shadow)] `(I Worship ~@x))
00:41clojurebot(sandbox/I sandbox/Worship His Shadow)
00:41cemerickblais: (map (partial apply f) coll)
00:41mmarczykslyrus: the word "var" only refers to the top-level objects created by def
00:42Lajlammarczyk, how do I avoid those namespaces.
00:42LajlaTell me, so that His Shadow may be worshipped.
00:42slyrusah, ok. thanks mmarczyk. there's no way to make local variables "special" in CL-parlance?
00:42mmarczykslyrus: with that in mind, (doc binding) is sufficient... but I'm not sure if that bit about Vars needs to be stressed somewhere more strongly
00:42mmarczykslyrus: nope
00:43slyrusgrumble grumble
00:43technomancypet peeve: def is certaily in the clojure.core API, though it may be missing from the API's documentation.
00:43slyrusyeah, it's on the special forms page, but not in the API docs
00:43blaiscemeric: Nice; I didn't know Clj had partial application.
00:44mmarczyktechnomancy: nice refactoring on lein; also, just noticed that jar.clj uses "meta-inf" as the metadata directory name, whereas it probably should be "META-INF"; want me to fix it?
00:44mmarczykactually I really dislike how (doc def) and (doc fn) only say "special form, see <url>"
00:45technomancymmarczyk: sure... I don't even know what that's for, actually.
00:45blais,(doc def)
00:45clojurebotDENIED
00:45mmarczyktechnomancy: the jar spec says it's optional, I believe, so in lein's case it's likely only useful together with that weird bit you flagged for ato's attention
00:46mmarczykthen again
00:46mmarczykyou can set a jar's classpath there
00:46mmarczykclojure.jar has an "." entry, which is why it loads user.clj when it's alongside clojure.jar
00:46mmarczyketc.
00:47cemerickMETA-INF/MANIFEST.MF is used for all sorts of things
00:47cemerickmodule systems, most commonly (osgi, netbeans modules, etc)
00:47mmarczykoh, it should be MANIFEST.MF ?
00:47technomancyit's just part of the jar spec where it keeps stuff that didn't have any place in the zipfile format?
00:48cemerickroughly, yeah
00:48cemerickmmarczyk: yes
00:48mmarczykcemerick: but META-INF/maven is correct, right?
00:48cemerickmmm, also used by the service provider lookup pattern
00:49cemerickmmarczyk: not sure, I'm not familiar with the bits maven puts in there
00:49technomancysetting the jar's classpath seems weird. if you're going to ship more than just a single jar, it seems like you might as well go to the trouble of including a shell script and save users the trouble of calling the "java" command manually.
00:49technomancyI guess there are edge-cases it may be useful for
00:50cemericktechnomancy: if only they had had the slight bit of sense to make ti so that nested jars could be referenced, that'd have saved everyone a lot of work
00:51technomancyit's pretty clear they haven't put any thought into how java's used from the command-line since the mid nineties.
00:51mmarczyktechnomancy: fixed
00:52technomancythanks
00:58technomancyhashdot will save us!
00:58technomancyhttp://hashdot.sf.net
01:01mmarczyktechnomancy: thinking about using hashdot in lein-generated scripts then? as in, #!/usr/bin/hashdot
01:02mmarczyk#.hashdot.profile = clojure
01:02technomancymmarczyk: not yet. hashdot is still too hard to install.
01:02mmarczyk(apply projects.main.ns/main *command-line-args*)
01:03mmarczykhm, that's a shame
01:03technomancyI need to find someone who knows how to make .deb files to package it up.
01:05blaismmaczyk: just looked at hashdot.... but isn't it too slow? On my linux macbook4,1 starting a JVM is several seconds... unusable for scripts.
01:07technomancyblais: unusable for many kinds of scripts, but it would still be convenient to be able to launch long-running process from the CLI without constructing your own classpaths, etc.
01:07technomancyit's also possible to speed it up a fair bit using -Xbootclasspath and a client JVM (if available)
01:08technomancyoh, the things I'd do given the time....
01:16slyrushuh? Unable to resolve symbol: defn in this context
01:16slyruswhat have I done to my ns...
01:17technomancyslyrus: you probably didn't refer clojure.core
01:17slyrusoh, do you have to do that?
01:17technomancyonly if you use low-level functions to create your ns
01:18slyrusbah. i don't like how in-ns well let you refer to non-existent namespaces
01:19technomancyI know it's recommended to use in-ns in the repl, but I always just use regular ns
01:20technomancysave three characters!
01:21slyrussame problem though
01:25technomancywell if you create new namespaces with ns, you won't have that issue
01:26technomancyit may not fix existing ones
01:26slyrusno, I mean that ns from the repl lets you switch to a bogus namespace
01:27technomancywhat's a bogus namespace?
01:27slyrusi see. i guess i'm griping that in-ns lets you switch to a namespace that wasn't created with ns
01:27technomancyif you want to ensure a namespace doesn't exist before switching to it, try (doto 'my-ns.core require in-ns)
01:27technomancy*does exist
01:30lancepantzi don't like how emacs indents macro calls as lists when the second item is a vector
01:30lancepantzdoes anyone know a work around for that?
01:31Lajla,(let (x 3 y 4) (+ x y))
01:31clojurebotjava.lang.IllegalArgumentException: let requires a vector for its binding
01:31Lajla,(let [] (+ 1 2))
01:31clojurebot3
01:33OliverUvi... have to try
01:33slyrusmmarczyk: the problem with a queue is that I am doing (into (subvec queue 1) next) where next is a seq
01:33slyrus,(into (subvec [1 2 3 4] 1) [5 6])
01:33OliverUv,(format nil "/quit")
01:33clojurebot[2 3 4 5 6]
01:33clojurebotjava.lang.NullPointerException
01:33OliverUvaw
01:33OliverUv,"/quit"
01:33clojurebot"/quit"
01:33slyrusI can't just conj that onto a c.l.PersistentQueue and have the right thing happen
01:34OliverUv,'/quit
01:34clojurebotInvalid token: /quit
01:34OliverUvi give up
01:35slyrusoh, but into a queue works. neet!
01:35OliverUvback to work
01:35mmarczykslyrus: right :-)
01:38tomojlancepantz: what do you mean as lists?
01:38slyrusoh, I would have thought last of a vector would have been O(1).
01:39tomojlancepantz: better yet, what's an example?
01:40mmarczykslyrus: apparently you have to use peek to get that
01:41daakuis there a better way to write this java code in clojure than using a let for what is returned by url(): queue.add(url("/worker").param("key", key)) ?
01:41lancepantztomoj: http://gist.github.com/487069
01:42lancepantzline 8 and 9
01:42hiredman,(doc doto)
01:42clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
01:42tomojoh
01:42tomojthat happens regardless of whether the second item is a vector
01:42lancepantzjust when the first item isn't a recognized function i guess?
01:43hiredmanslyrus: you can conj on to a pq and it will do the right thing
01:44slyrusright, but I wanted not to conj a vector on, but to have each element in the vector conj'ed on. into DTRT.
01:44tomojeven if it's a recognized function
01:44tomojthat's how function calls should be indented
01:44tomojthe problem is that it doesn't realize it's a macro
01:45hiredmanslyrus: but conj doesn't do that for anything, so why would you expect that for pq?
01:46slyrusi didn't really. i was replacing an into call and didn't realize that pq's supported into.
01:46slyrusoperator error on my part, followed by pleasant surprise that pq's support into
01:46lancepantztomoj: what about (into ["blah"] \n '("bar))
01:47tomojlancepantz: yeah, it indents up to the first arg
01:47slyrusmmarczyk: http://github.com/slyrus/shortcut/blob/master/src/shortcut/graph.clj#L133 works. thanks!
01:47lancepantzthe second line gets shifted to the end of into, that's why i assumed it had something to do with the 2nd element being a vecotr
01:47tomojlancepantz: try eval'ing (define-clojure-ident (project-let 1))
01:47tomojer
01:47tomoj(define-clojure-indent (project-let 1))
01:48tomojthen M-q
01:48mmarczykslyrus: great :-)
01:48lancepantzso i just put that in any buffer and do M-q?
01:49tomoj(into ["foo"] \n (bar)) and (into foo \n (bar)) will be indented the same way
01:49tomojno, put that bit of code into, say, *scratch*, put point at the end of it, C-x C-e
01:49tomojthen go back to inside your deftest and hit M-q
01:49tomojif you're in aquamacs M-x emacs-lisp-mode in *scratch* before C-x C-e
01:50lancepantzsweet!
01:50lancepantzworked
01:51tomojwould it be evil to put metadata on your macro var that says how it should be indented? :)
01:52lancepantzhehe
01:52lancepantzwould it be possible to extend clojure mode or swank to do that automatically for all defmacros?
01:52tomojI think if your macro is named like def.* or with-.* it'll figure it out, but otherwise it just indents like functions
01:53tomojdo we really want all macros to indent that way?
01:53lancepantzwhy not?
01:54mmarczyktomoj: that would not be evil, that would be what we absolutely must make swank-clojure & clojure-mode handle asap!!!
01:54mmarczyk:-)
01:54tomojlancepantz: I dunno, I wasn't saying we don't, really asking
01:54tomojcan't think of any counterexamples
01:54mmarczykincidentally, even defrecord seems to be indented pretty badly
01:55tomojthe method defs you mean?
01:55mmarczykunless my clojure-mode is outdated -- which is possible
01:55mmarczykyeah
01:55mmarczyksame for letfn
01:55tomojyeah
01:55tomojbecause it's looking at the car and those are unrecognized
01:55mmarczykcondp is weird too
01:55mmarczykright
01:55lancepantzi'm not familiar with how they all play together, is it something you could do just in clojure-mode?
01:56mmarczyklast time I checked, it was in need of a refactoring
01:56tomojyeah it looks pretty nasty
01:56tomojmy coloring seems to be screwy
01:56Lajla,(contains? '#{I worship His Shadow} 'His)
01:56clojurebottrue
01:56tomojoh wait that's elisp
01:57mmarczykyeah... my elisp-fu is a bit shaky, so I'm reluctant to take the c-m refactoring on my plate
01:57mmarczykbut if it doesn't magically happen within a month, say, I will anyway
01:58tomojI have noticed screwy colors before in clojure-mode though
01:58tomojlike the same function being colored differently in different places
01:58mmarczykwell, functions get different colouring depending on whether they're in the operator position
01:58mmarczykiirc
01:59tomojI mean in operator position, just different places in the file
02:00mmarczykoh? weird
02:00mmarczykI do occasionally experience funky highlighting with both Emacs and Vim when they decide, say, that most of my code is a comment (or a string maybe)
02:01mmarczykannoyingly, as far as I can tell, there's nothing to be done about it
02:01tomojnever seen that in emacs
02:01mmarczykbut no small random changes in colour
02:10zmyrgelI'm trying to get started with clojure but I keep getting NPE when I'm running 'lein swank'
02:10zmyrgelany ideas what could be wrong
02:10tomojpaste the stacktrace (somewhere other than here)
02:11tomojprobably go ahead and paste your project.clj too
02:11zmyrgeltomoj: http://pastebin.com/GqsxEMjJ
02:12tomojoh yeah
02:12tomojbsd?
02:12tomojor something else weird?
02:12tomojno offense :)
02:12slyruscan I extend/inherit from a record and give it additional fields?
02:12zmyrgeltomoj: yeah, running openbsd
02:13tomojright, this should've been fixed already
02:13tomojguess the last person who had this problem never submitted a bug
02:13zmyrgeltomoj: http://pastebin.com/wuUmny6y
02:13tomojtechnomancy: ping
02:13mmarczykslyrus: no
02:13zmyrgeltheres one with project.clj
02:14tomojzmyrgel: lein -v ?
02:15tomojdoesn't matter, the bug is still there in the latest it looks like, but that project.clj looks old
02:15slyrusmmarczyk: hmmm... makes it hard to extend my graph record then. perhaps I don't want a defrecord.
02:15tomojclojure 1.2.0-beta1 is out, probably better to use it instead of 1.1.0
02:16zmyrgeljust run 'lein self-install' before made the project
02:16mmarczykslyrus: deftypes won't allow you to do that either
02:16slyrusright
02:16mmarczykI think... though somebody wanted that for interop with some Java framework or other
02:16mmarczykI mean, someone wanted them to create non-final classes
02:16mmarczykdunno what became of that
02:17tomojzmyrgel: I think your only choice right now is to fix the bug yourself (I can help you, it's simple) and use a development version of lein
02:17mmarczykslyrus: but note that records can act like maps
02:17mmarczyk(defrecord Foo [])
02:17mmarczyk(:x (assoc (Foo.) :x 1))
02:17mmarczyk=> 1
02:18zmyrgeltomoj: whats the correct way to check for the clojure versions available for lein?
02:18zmyrgel1.2.0-BETA didn't work
02:18tomojI don't know if there is a nice way, but you can just peek at http://build.clojure.org/releases/org/clojure/clojure/
02:19zmyrgelok
02:19slyrusmmarczyk: so what's special about the fields declared in the defrecord?
02:19tomojzmyrgel: have you gotten a clojure repl up at all?
02:19mmarczykslyrus: you can access them directly in method bodies
02:20mmarczykslyrus: and also through interop syntax -- (.x (Foo. 1)) if Foo is declared with an x field
02:20zmyrgeltomoj: I tested it quickly with my clojure shell script after I compiled the version from git
02:20tomojdownload http://build.clojure.org/releases/org/clojure/clojure/1.2.0-beta1/clojure-1.2.0-beta1.jar, and then run: java -jar clojure-1.2.0-beta1.jar
02:20tomojoh, ok
02:20tomojif that still works, do that
02:20slyrusmmarczyk: and I suppose you can actually access x from java code as well
02:20mmarczykslyrus: field access is faster than map lookup
02:20tomojjust need a clojure repl so you can peek at the system props to figure out the appropriate value to fix the lein bug
02:20mmarczykslyrus: right, you can
02:21zmyrgeltomoj: ok, hold on a moment
02:21mmarczykslyrus: with assoc'd entry's, you still can, but it's a bit more convoluted
02:21tomojzmyrgel: at the repl do (System/getProperty "os.name") and (System/getProperty "os.arch")
02:22mmarczykslyrus: something like (.get (assoc (Foo.) :x 1) :x)
02:22zmyrgeltomoj: gives "OpenBSD" and "amd64"
02:22tomojok, great
02:22tomojyou're going to have to clone leiningen and fix this: http://github.com/technomancy/leiningen.git
02:23slyrusgiven that this all java underneath, it's surprising that records can't extend other records. is there some major efficiency win with final classess?
02:23mmarczyktomoj: so what's this problem with lein actually?
02:23jacortinasyeah I just got
02:23jacortinashere
02:23jacortinasexplain please
02:23hiredman(:x (Foo. 1)) has some optimizations too
02:23hiredmanif Foo has a field named x
02:24hiredman(and Foo is a defrecord)
02:24mmarczykslyrus: Clojure doesn't want OOP-style inheritance
02:24tomojzmyrgel: in src/leiningen/compile.clj, on line 49, there's a native-names hash
02:24mmarczykslyrus: I mean, let Java *stay* underneath ;-)
02:24tomojzmyrgel: you need to add "OpenBSD" :openbsd to that
02:24slyrusto paraphrase, don't anthropormhize clojure. it hates it when you do that.
02:25slyrusanthropomorphize
02:25jacortinasyou could probably just make the change and then send stuart a pull request
02:25hiredmanclojure generates caches for keyword call sites and if the call site stays monomorphic hotspot has a fair chance of inlining
02:25jacortinashe's pretty nice about that stuff
02:25mmarczykslyrus: I thought occasionally "Clojure" might make a good euphemism for "Rich" ;-)
02:25slyrusheh
02:26hiredmanslyrus: class inheritence is bad
02:26slyruswell, java's implementation sure, but CLOS is pretty nice
02:27mmarczyktomoj: just adding "OpenBSD" :openbsd would fix it?
02:27tomojyep, pretty sure
02:27zmyrgeltomoj: ok, done. Now how do I compile that?
02:27hiredmanhttp://www.artima.com/intv/gosling3P.html
02:27tomojzmyrgel: then I think after making the change you can just `lein install` in the leiningen project root
02:27tomojer.. fuck
02:27tomoj`lein install` ain't gonna work because of this bug, I guess
02:28fualofor the life of me I can't get clojure-contrib to work. I've built it with maven, checked the class path, but I still keep getting ClassNotFound... - config here http://dpaste.com/221107/
02:29tomojzmyrgel: what's `lein -v` say? maybe I can compile the patched lein for you
02:29zmyrgeltomoj: Leiningen 1.1.0 on Java 1.7.0-internal OpenJDK 64-Bit Server VM
02:30zmyrgeltomoj: yep, lein install gives NPE too
02:30tomojwell, I'm Java 1.6.0_20 Java HotSpot(TM), will it work?
02:30tomojdunno
02:30hiredmanfualo: don't use any of the scripts
02:30tomojclass files must be somewhat portable, right?
02:31hiredmanI've never seen a script launcher that was any good
02:31mmarczyktomoj: zmyrgel: actually lein's jar only includes one aot'd namespace
02:31fualohiredman: I had a feeling that following the first thing that comes on google would be bad... what's the preferred way?
02:31tomojmmarczyk: the one I've got includes clojure itself
02:31mmarczyktomoj: zmyrgel: so you can fix compile.clj and replace the old one with it it in the jar
02:31hiredmanjava -cp … clojure.main
02:31tomojzmyrgel: ah, yes, do that
02:32mmarczyktomoj: ah, yeah... but of lein's own namespaces, only one is aot'd
02:32zmyrgelmmarczyk: I'll try that
02:32tomojif you use emacs you can probably C-x C-f ~/.m2/repository/leiningen/leiningen/...whatever...jar
02:32mmarczyknamely leiningen.core
02:32tomojthen edit compile.clj in place
02:32mmarczykzmyrgel: let us know how it goes
02:32fualohiredman: well a script to prevent someone from typing that seems... more efficient, no?
02:33mmarczykthen I'll commit the fix to lein's head
02:33tomojyou have commit rights?
02:33mmarczyksurprisingly I do
02:33tomojcool
02:34mmarczykhow do you want to be credited, btw?
02:34tomojI think the real fix is to fail gracefully when the os isn't found
02:34mmarczyktrue that
02:34tomojalmost all of the time you don't care about native deps anyway, but if your os isn't in the list, you're screwed
02:35mmarczykright
02:35hiredmanfualo: *shrug* you can be efficent if you want, I prefer a working repl
02:35fualo:-)
02:36fualoI was just asking... either way, it's not working that way either http://dpaste.com/221110/
02:38hiredmanwhere did you get your clojure jar?
02:39tomojhttp://github.com/technomancy/leiningen/issues#list
02:39tomojer
02:39hiredmanI think you have an old version of clojure and a new version of clojure-contrib
02:39tomojdammit github, I can't copy the link because you intercept 'c'
02:39tomojbut I made an issue
02:40tomojhttp://github.com/technomancy/leiningen/issues#issue/81
02:40hiredmanb
02:42tomojfualo: any particular reason you don't want to use lein?
02:43fualohiredman: I just tried it with the github master branch.. still nothing
02:43hiredmanfualo: nothing the same?
02:44fualoyes, (:require clojure.contrib) still doesn't work
02:44hiredmanwhat do you mean tried with the master branch? which repo, and what did you do with it?
02:44hiredmanwhat do you mean doesn't work?
02:44fualotomoj: I could, I'm a newb so I'm still getting used to the environment
02:45fualohttp://dpaste.com/221112/ nothing still
02:45hiredmanhow are you trying to use (:require clojure.contrib) ? have you read the api docs and noticed there is no :require? have you read the docs for require? are you aware there is no namespace named clojure.contrib?
02:46fualoapparently not which could be the idiotic source of my problems
02:46tomojfualo: no need to compile anything from source :)
02:47hiredmanfualo: http://richhickey.github.com/clojure-contrib/ has a list of namespaces that are in contrib
02:48fualoah, works now, with string
02:48fualothanks, sorry for my error
02:48fualotomoj: with lein you mean/
02:48tomojright
02:48hiredmanhttp://clojure.org/ has a nice list of things to read titled "Reference" in the links on the left
02:49tomojfualo: https://gist.github.com/96f82fbef21f189bb7a4
02:50bartjanyone has used a simhash library in java/clojure ?
02:52tomoj(that downloads clojure and contrib automatically)
02:53fualothanks tomoj!
02:53fualofor just the project directory?
02:54fualoah, yes, I see
02:54tomojwell, it downloads it into ~/.m2/repository/...
02:54tomojany lein/maven project will use that copy
02:55fualotomoj: does lein have emacs integration?
02:55tomojer, except lein copies it into ./lib
02:55tomojyep :)
02:55tomojare you already familiar with emacs?
02:55fualoquite :-)
02:55tomojgot slime already?
02:55fualoyup
02:55tomojhrmm
02:55fualothrough ELPA
02:56tomojoh, cool
02:56tomojinstall clojure-mode as well from ELPA
02:56tomojthen add :dev-dependencies [[swank-clojure "1.2.1"]] to your project.clj
02:56tomoj`lein deps`, `lein swank`, then M-x slime-connect
02:58slyrusmy brain hurts trying to unlearn my CLOS and java inheritance habits
02:59fualotomoj: it says lein swank isn't a task in lein, but lein deps clearly downloaded it
03:00tomojyou have lib/dev/swank-clojure...jar ?
03:02tomojdid you run `lein deps` and `lein swank` both in your project root?
03:02fualoah, my brain didn't prase dev-dependences, so I put it under dependincies
03:02fualos/prase/parse
03:03fualotomoj: works, sweet!
03:03zmyrgelI guess 17s to run 'lein help' is too much...
03:03fualotomoj: thanks
03:06zmyrgeltomoj: mmarczyk: thanks, lein seems to work now although terribly slow for some reason
03:06tomojfualo: src/foo/bar/baz.clj for (ns foo.bar.baz)
03:06tomojzmyrgel: JVM startup time :(
03:07mmarczyktomoj: zmyrgel: cool, thanks!
03:08mmarczykso it's "OpenBSD" :openbsd... adding now
03:09fualotomoj: and this downloaded its own clojure.jar somewhere?
03:09tomojyeah, ~/.m2/repository/org/clojure/...
03:09tomojlein downloads all deps into ~/.m2/repository
03:10zmyrgeltomoj: I'd say it should be faster than 17 secs
03:10fualoexcellent... very interesting dev system compared to other langs I know
03:11tomojzmyrgel: 3s here
03:11zmyrgeltomoj: that would be quite a bit better
03:12mmarczyktomoj: zmyrgel: fix pushed, thanks
03:14tomojdunno what could cause that besides JVM startup time.. hmm
03:17zmyrgelat least it works
03:24bartjjust discovered clojuredocs.org - a million times better than javadocs - thanks!
03:25slyrushmm... maybe just doing away with the record all together and just extending the IPersistentMap protocol is the right thing to do here.
03:27tomojslyrus: is the problem just that you want to add more fields?
03:27slyrustake any map and turn it into a graph by assoc'ing ::node-set and ::edge-map to it.
03:28slyrusthat's part of it. I think the bigger issue is getting a sense of how to do a nice clean design for this graph stuff.
03:28tomojI've wondered about that problem too
03:29tomojthe smaller issue is easy, you can add whatever fields you want
03:29slyrusi'm thinking i don't really need the record and that I can just use the protocol and extend IPersistentMap. seems to be working so far. perhaps there's a performance, but this can always be optimized with a defrecord version later if so.
03:29slyrustomoj: sure, but if I'm going to do that, why bother with two classes of fields? the defrecords and the map key/vals.
03:30slyrusmight as well just leave the damn thing as a map.
03:30slyrusno one can take an arbitrary map and make it a graph.
03:30slyrusanyway, time to sleep on this. thanks for helping me think this stuff through.
03:36AWizzArdIs there a way to ignore parts of a jar task in Ant?
03:37AWizzArdSomething like fail, but which does not abort the build
04:02RaynesTime to compile GHC. I should be able to hop on my computer and ride the CPU fan to France before it's finished.
04:04zmyrgelI liked my compilation of OpenJDK7 better
04:05zmyrgelfirst compile JDK5, then JDK6 and then OpenJDK :)
04:05zmyrgeltook a while
04:22Rayneschouser: Your guy got me hooked up with a new download link. Thanks. :)
05:08cais2002hi, is there a function that can replace the keys in a map based on another map of old-new key mapping?
05:08cais2002(replace-key {:1 1 :2 2} {:1 :a, :2 :b}) ==> {:a 1 :b 2}
05:09Raynes->(merge {:1 1 :2 2} {:1 :a, :2 :b})
05:09sexpbot=> {:2 :b, :1 :a}
05:09RaynesOh. Keys.
05:12AWizzArdcais2002: not implemented yet
05:12tomojwhat does (replace-key {:foo 1 :bar 2} {:foo :baz :bar :baz}) return ?
05:13tomojs/does/should/
05:13sexpbotwhat should (replace-key {:foo 1 :bar 2} {:foo :baz :bar :baz}) return ?
05:14cais2002hmm, have not thought about that, yet
05:15cais2002I want any key/value in old map that are not found in key-map to be retained..
05:15Raynes(defn replace-keys [oldmap newkeys] (into {} (map (fn [[k v]] [(if-let [newk (newkeys k)] newk k) v]) oldmap)))
05:15cais2002you guys can decide on the semantics when new keys conflict
05:16Raynes-> (def replace-keys (fn [oldmap newkeys] (into {} (map (fn [[k v]] [(if-let [newk (newkeys k)] newk k) v]) oldmap))))
05:16sexpbot=> #'net.licenser.sandbox.box3508/replace-keys
05:16Raynes-> (replace-keys {:1 1 :2 2} {:1 :a, :2 :b})
05:16sexpbot=> {:b 2, :a 1}
05:17Raynes-> (replace-keys {:1 1 :2 2 :3 3} {:1 :a, :2 :b})
05:17sexpbot=> {:3 3, :b 2, :a 1}
05:17Raynescais2002: How's that?
05:17cais2002raynes: that should work
05:18ChousukeI like how that exploits the fact that maps are functions
05:19Chousuke-> (replace-keys {"foo" 'bar, "some" 'other} symbol)
05:19sexpbot=> {some other, foo bar}
05:20cais2002-> (replace-keys {"foo" 'bar, "some" 'other} keyword)
05:20sexpbot=> {:some other, :foo bar}
05:20cais2002Chousuke: good point
05:21tomojRaynes: do you have special privs with sexpbot or did you figure out some magic way to make def safe?
05:21Raynestomoj: Licenser made it so that def is safe. Only 5 defs are kept in memory at any given time.
05:21Raynesdefn doesn't work right now, but likely will soon.
05:22serp_why would def be unsafe?
05:22Raynesserp_: Memory overload.
05:22RaynesIf you def stuff, that stuff is kept in memory.
05:23tomojoh, and we can't switch the namespace?
05:23serp_aha
05:23RaynesI hope not.
05:23tomoj:)
05:32ChousukeRaynes: does it clear the defs if there is an OOM exception?
05:33RaynesChousuke: No, it just only keeps 5 in memory at a time.
05:34Chousukeso I guess you could still OOM it by defing an infinite sequence.
05:35RaynesChousuke: Except that is impossible to do with sexpbot's timeouts.
05:35Chousukeis it? def fibs, take some number of fibs, then take some more, until memory is filled :P
05:36RaynesI don't see how that would work.
05:37Chousukeor you could make an infinite seq that creates some huge objects, so memory fills up quickly.
05:38Chousukesince you can expand the seq just a bit at a time until enough of it is cached, the timeouts aren't effective
05:39RaynesThen, I guess I'll be taking def support out of sexpbot and tryclojure.
05:40RaynesLooks like tryclojure is going to be useful for just about nothing when I'm finished with it.
05:40Chousukewell you could just catch OOM errors and reset the namespace
05:40Chousukeand maybe ban IPs that abuse it too often :P
05:41Chousukeit won't be a problem if you limit the JVM to 64 MB or something similar
05:42RaynesDealing with sandboxing has been the most frustrating thing I've ever done.
05:43Chousukesandboxing a compiler, dynamic language not designed for sandboxing is probably not the easiest task :P
05:43Chousukecompiled*
05:44RaynesIt's more annoying than anything. No matter what you do, you still never get it right.
05:44cais2002so basically, (into {} (map some-func some-map)) is the pattern to do an update on some-map based on some-func , right?
05:45Chousukeyeah
05:45ChousukeI'd like a protocol-based fmap in core someday though
05:45RaynesThat's how I do it. :P
05:46Raynesfunctors!
05:52tomojwhat the heck is in-ns?
05:52AWizzArd,(doc in-ns)
05:52clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
05:52tomoj,(class in-ns)
05:52clojurebotclojure.lang.RT$1
05:53AWizzArdAn inner class of RT.
05:53tomoj,(ancestors (class in-ns))
05:53clojurebot#{clojure.lang.AFn clojure.lang.IFn java.lang.Object java.util.concurrent.Callable java.lang.Runnable :clojure.contrib.generic/any}
05:53cais2002-> (merge {1 2} [3 4] [5 6])
05:53sexpbot=> {5 6, 3 4, 1 2}
05:53cais2002-> (merge [1 2] [3 4] [5 6])
05:53sexpbot=> [1 2 [3 4] [5 6]]
05:54cais2002-> (doc merge)
05:54sexpbot=> ------------------------- clojure.core/merge ([& maps]) Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the la... http://gist.github.com/487229
05:54cais2002seems that merge could be applied to any coll?
05:55cais2002-> (source merge)
05:56sexpbotjava.lang.Exception: Unable to resolve symbol: source in this context
05:56Raynestomoj: Having fun trying to break sexpbot? :p
05:56tomojare you watching?
05:56tomojand yes :)
05:57tomojkeep running into dead ends though, damn you
05:57Raynestomoj: Indeed. I'm always watching.
05:57tomojwhy doesn't (binding [*ns* ...] (def foo)) do what I want?
05:58cais2002how is #(some identity %1) different from #(empty? %1) when being used as a pred?
05:59Chousukecais2002: the first tests if the seq contains anything truthy
06:00Raynes-> (filter (partial some identity) [[nil 3] [nil]])
06:00sexpbot=> ([nil 3])
06:00Raynes-> (filter empty? [[nil 3] [nil]])
06:00sexpbot=> ()
06:01RaynesAlso, cais2002: http://clojuredocs.org/v/2101
06:02RaynesI can't wait for that site to have an API.
06:02Raynessexpbot will be all over that.
06:02Chousukecais2002: the second tests if it's empty :/
06:02Chousuke(also #(empty? %1) is equivalent to empty?)
06:03cais2002ok, I got it
06:05cais2002so the "when" in (source merge) is to return nil if all items in maps are nil?
06:38tomoj-> (+ 2 2)
06:38sexpbot=> 5
06:38tomojRaynes: still around?
06:42tomojnot caused by allowing def
07:25bobo_hm? what did you do? :-)
07:27tomojwon't share till it's fixed, sorry :P
07:30bobo_hehe ofc
08:04defnmorning all
08:05defnany former Rubyists with a firm grasp on Clojure sequences/collections care to elaborate on how Enumerable compares to the sequence abstraction?
08:12tomojnot lazy?
08:13bozhidarnot all sequences are lazy
08:13tomojnot even possibly lazy
08:13bozhidarindeed
08:24Raynestomoj: What did you do?
08:28Licensertomoj: I was told you have a bug for me?
08:28tomoj-> (+ 2 2)
08:28sexpbot=> 4
08:29LicenserLooks logical so far
08:29tomojoh, but see above :)
08:31Raynes<tomoj> -> (+ 2 2)
08:31Raynes<sexpbot> => 5
08:31RaynesDamn you, XChat.
08:31LicenserTomj my backlog sadly does not go that far back
08:31tomojah
08:31LicenserQuestion being how?
08:31tomojdid you get my PM?
08:31LicenserOh yes
08:32LicenserSorry mobile collequary isn't that compfortabke
08:34chouserdefn: ruby enumerables iterate "inside out" compared to clojure seqs. A clojure seq you can walk a bit, then set aside for later. To do that with a ruby enumerable would require callcc magic, I believe.
08:48LicenserGreetings
08:52defnchouser: thanks so much for that -- /me wonders about using continuations in Ruby to do that...
08:54chouserI imagine it could be done.
08:55defnI haven't dusted off a continuation in a longggg time.
08:55defnThey scare me just a bit. :)
08:56Rayneschouser: Did you get my message earlier?
08:56chouserA friend and I wrote a rather tortured iterator in ruby to walk to arbitrary enumerables in step (like clojure map with multiple collection args)
08:56chouserusing callcc. mind-bending.
08:56LicenserWhat is callcc?
08:56defncall current continuation
08:57LicenserOh okay
08:57chouserRaynes: had missed it. glad it's taken care of.
08:57LicenserGuess that I'd ruby not clojure right
08:57defnhmph, I didn't know Sussman and Steele coined "continuation-passing style"
08:57defnLicenser: yeah callcc is ruby
08:58LicenserOkay
08:59defnahh, I guess there are "first class continuations", which Ruby and Scheme support, but Clojure doesn't (yet ;)
08:59defnand one google later I am proven wrong: http://github.com/swannodette/clj-cont
09:00defnhttp://github.com/swannodette/clj-cont/blob/master/test/net/dnolen/clj_cont/core_test.clj
09:00defnfun stuff.
09:01dnolendefn: well that's a hack based on a hack to get continuations in Common Lisp :)
09:02defndnolen: there you are :)
09:02dnolenat some point I need to clean that up, there's some silly stuff in there I think around Java interop
09:02LicenserWow and I don't even know what continuations are. :P
09:03defndnolen: does it allow for "first class" continuations?
09:05dnolendefn: don't think so, clj-cont supports http://en.wikipedia.org/wiki/Delimited_continuation
09:05dnolenI believe first class continuations can capture the whole context, with clj-cont you have state where you want to start capturing context
09:06defnyeah i was just reading the code and wondered what (def *ctx*) was :)
09:06defndnolen: anyway, very interesting code and wiki article to go with it
09:06defnthanks!
09:07dnolendefn: the best place to see what it can do is to look at the tests. there's a lot of coverage
09:08defnyeah i noticed that -- pretty cool stuff.
09:27lpetitstuarth: Hi, I see you're changing / committing things in pom.xml that *may* (I'm not anymore a maven expert, since maven 2 is out !) be held once and for all by, I think, adding a profile for stable releases, and a profile for snapshot releases (or even just one release if you make the default configuration work for e.g. the snapshot release)
09:32defnLicenser: continuations are like monads, only harder to reason about IMO :)
09:33defnsee: the continuation monad *scared look on his face*
09:35defnLicenser: http://intensivesystems.net/tutorials/cont_m.html <--great article on clojure and continuations
09:37tomojisn't the continuation monad a poor man's continuation?
09:38defnyeah
09:38defnit just sounds scary if you know what monads and continuations are, but dont know specifically the continuation monad :)
09:38tomojweblocks only has cl-cont to work with
09:38tomojso I have hope
09:38defnwhat is weblocks? (forgive the ignorance)
09:39tomojsome CL web framework
09:39tomojwhat I really want is nagare in clojure
09:39tomojexcept nagare gets first-class continuations from twisted (I think?)
09:39defnI want JRuby + Clojure
09:39tomojbut maybe it can be done with clj-connt
09:39defnerr JRuby + Rails + Clojure
09:40defna nice bridge between the two
09:40tomojwhy would you want that? :P
09:41defnbecause I want my rails -- maybe it's just my comfort zone with rails, but something irks me about web development with clojure
09:41defndoing MVC is difficult since everything depends on everything else
09:41tomojoh, yeah, for sure
09:41tomojI use drupal at work
09:42tomojbecause we can get a lot done quickly
09:42defnyou can't have your controllers and views separate, they must live together, and that is...weird
09:42tomojbut drupal still is a terrible terrible thing
09:42defnenlive could help, but i find it a bit cumbersome tbqh
09:42defntomoj: yeah, drupal is a terrible beast
09:42defnit must die.
09:42tomojweb dev in clojure will be awesome someday
09:43defnyeah -- we have the "rack" with ring
09:43defnjust a matter of time i suppose
09:43tomojI'm not really interested in a translation of rails, personally
09:43defnnor am I per se
09:43tomojhappstack or nagare or weblocks or something, sure
09:44defnthe feeling of rails is a feeling of: "ahhhh *sips beer*, this is refreshing"
09:44tomojI hate beer
09:44defntea?
09:44tomoj:P
09:44clojurebotI want to go to there
09:45defntomoj: either way, it's just the idea that it has a sort of feeling to it, a sort of identity (ironic)
09:45tomojhaha
09:45defni know it sounds sort of wishy washy
09:45tomojyeah I guess I miss those day
09:45tomojs
09:45tomojand maybe rails 3 is better
09:46defnremember when it wasn't cool to like ruby? lol
09:46tomojbut I just can't bring myself to happily use ruby now :(
09:47defntomoj: oh c'mon! it can still be fun!
09:47defnruby@github => playground
09:48defni look at a lot of projects that were done in ruby a few years back -- there was an air in the community where any idea was worth implementing or trying, and people were BOLD
09:48defnthose ideas are still valid -- even if those projects were abandoned
09:49tomojand now people are complaining about that
09:49defnthere is still a lot to improve and investigate
09:49defnI don't listen to Eeyores as a matter of course.
09:49defnThey don't ever do anything.
09:49tomojone the one hand it does seem a bit silly -- no one's forcing you to use this code
09:49defnon the other hand -- there is no other hand.
09:50tomojabandoned projects don't bother me
09:50tomojshitty projects do
09:50tomoja bit
09:50defnyeah, plenty of those -- i've started a few for clojrue
09:50defnclojure
09:50tomojthis is why I haven't released anything in clojure :)
09:50defnoh well, gotta "break a few eggs" as they say...
09:51defntomoj: what's the 2007 hacker meme? "real programmers ship"?
09:51defni know how you feel -- it's terribly nerve-racking to have anyone in this community look at my code. it's complete garbage.
09:51defnon the other hand, it feels sort of liberating
09:52defnbecause their code has no personality, no one to read it -- lonely code.
09:52Ploujliberating from what?
09:52defnPlouj: listening to the inner voices that tell you it's not good enough, or someone could and will do it better, etc.
09:55defnthat sort of mentality is just depressing -- it's no way to treat yourself, and it's no way to treat your code IMHO.
09:57defnmini rant: take gists for example. so much of it is junk, and yet so much of it is fantastic. and so muuch of it that is junk holds elements of fantastic gists to come, and so on.
09:58defnit's a conversation, not a contest.
09:59chouserto me there's a big difference between "some code" and "a library" or "a tool"
10:00chouserfor the latter, I want to be a user that can rely on stable releases, good docs, and largely ignore the interals.
10:01chouserthat means producing "a library" is a good deal more effort than just producing code that works -- you need releases, future plans, bug tracking, ongoing maintenance, etc. ..in short the kind of stuff I'm rarely willing to do without money changing hands.
10:01OliverUvdefn: yeah, I managed to abandon perfectionism in my late teens and am very glad for that
10:01chouserbut "some code" is just that. take it or leave it. harvest some ideas and make it your own. turn it into a library if you want, etc.
10:01chouserfun.
10:01chouseroften not very usful. :-/
10:02defnOliverUv: it still bites at us though :)
10:02defnchouser: well said
10:03tomojso when we put some code on github, we should make it clear that it's not a library, I guess
10:04defnchouser: however, so are most of my conversations. maybe im a bit idealistic but i think of clojure as a real human language, as if we're speaking some foreign language right now, but clojure is our native tongue -- and through reading eachother's code, fun or not, we learn more about how to express ourselves and build things that are great
10:04tomojthat's related to some of the complaining I heard -- giving your shitty code a slick website and hype
10:04defni think in addition there should be a "pledge of support" document
10:05defndetailing how the author intends to support their code
10:05defn"sparingly", "weekends only", or "you're on your own."
10:05defnin additiong *to a license
10:05tomojif your code says "you're on your own", I won't eeyore at you if it's shitty :)
10:06defnhaha -- fair enough :)
10:06chouserI suppose I should update http://n01se.net/gmapez to say "I stopped caring about this a while ago..."
10:06tomojI suppose the eeyore's should take silence as "you're on your own" to be safe
10:07fogustomoj: If your code is bad then hype and pretty websites make it better no? ;-)
10:07defnif you were an eeyore you wouldn't be using clojure :)
10:08tomojactually my mom used to call be eeyore
10:08tomojdifferent sense I guess
10:08defnim always amazed when an author has a website at all in addition to his moderately popular project
10:08defnit seems almost impossible to find the time for both without falling behind on one of them
10:09defnchouser: could i convince you to give me your #clojure log archive again btw? my VPS required a reboot and i didnt have irssi logging by default and have missed a few days here and there
10:10defnthis whole discussion is making me feel so guilty about walton I want to cry
10:23defnWho is all going to strange loop?
10:25mefesto_defn: is this an upcoming conference?
10:25drewrdefn: still considering
10:25defnyeah in october
10:25mefesto_link?
10:25defni just pulled the trigger last night on my ticket
10:25clojurebotyour link is dead
10:25Scriptordefn: hmm, st. louis seems a little out of the way
10:25Scriptorhttp://thestrangeloop.com/about
10:25mefesto_tks
10:25mefesto_um, thanks too
10:26neotykto far from EU
10:26defnim in WI so St. Louis is kind of a nice change from Seattle
10:26neotykwould love to go there though
10:26ScriptorI like how guy steele says he's a slacker on the speakers' page
10:27defn:)
10:38arkhdefn: are you in madison? I miss that city.
10:42defnarkh: yeah im in madison
10:42defnarkh: go to school here?
10:44arkhdefn: I did. I remember walking across campus to the comp sci building in the middle of winter really well ;)
10:44defnfogus: bacon would taste like eggs
10:44defnarkh: :)
10:45defnarkh: i failed out of college. pretty sensitive about that at the moment as all of my friends are graduating. trying to get up the nerve to quit my software engineering job and take on some debt to finish up CS.
10:46defn</TMI>
10:46Scriptordefn: how much do you have left to do?
10:46arkhdefn: I was in a similar spot. Sometimes it just timing - do it when you're ready :) I did much better in school when I did on my own schedule.
10:46arkhugh ... typos
10:47arkhsounds like I need to go back again ...
10:47defnScriptor: 2.5 years probably. It's kind of funny -- all of the time I've spent outside of school has been reading books on algorithms and writing code...
10:47Scriptoryea, I know what you mean, motivation seems to do the opposite when it's coming from outside
10:47defnI started studying music, then philosophy, then realized I spend all of my time writing code anyway
10:48Scriptoranyone know good music to write docs to? I'm using classic jazz
10:48tomojCS->phil seems to be somewhat common
10:48arkhfrom my point of view, some people can play the game of school well - go to classes and do the homework the way they want it. But learned the most and had the most fun when my learning was on my own, at my pace, learning what I wanted. As I got older, I learned how to balance both.
10:48defnI like AFX (Aphex Twin), Rumpistol, Ochre
10:49defnbut I love me some classic jazz too, can't go wrong with charlie mingus
10:50abedra mashups!
10:50defnI think the hardest thing I'm struggling with re: school right now is that I'm motivated, but due to my GPA they want me to go somewhere else and essentially waste a year of my time that I could be working, to get back into their good graces
10:51Scriptorwhere do they want you to go?
10:51defna local technical college
10:51arkhthey might take you back after one semester of good grades at MATC. It's a sour pill but part of the game.
10:52abedradefn: take more time off. You're obviously still sensitive about it. Wait till you don't have any emotions involved and you'll do much better
10:52Scriptordefn: in case you aren't, try working on a large-scale project of your own or that's open source, might be good therapy
10:53defnarkh: yeah :\, abedra: good advice, Scriptor: good advice
10:54defnI actually emailed the dean of Letters and Sciences last night asking (begging) for a meeting
10:54chouserdefn: I'm a little curious what you expect to get out of a degree. rhickey has a degree, for example, but it's in music.
10:54bhenryi have tried do and doall, but don't think i understand them correctly. i want to evaluate copy-imgs and use the file objects in a webapp. i can run copy-imgs from the repl and it copies, but when i run (do (copy-imgs path) (get-images path) i expect that copy-imgs will perform the copy and the do will return the results of get-images. this is not the case. how can i do both at once? http://gist.github.com/487537
10:54defnchouser: partly, I just want to prove to myself I can do it. I was young and made some stupid choices.
10:54OliverUvfor me a degree would entail a salary increase of about a third
10:55OliverUvmaybe two thirds
10:55tomojbhenry: for is lazy
10:55defnchouser: plus, I've spent a lot of (my parent's money) on school
10:55defnand I feel like I owe it to them
10:55OliverUvdefn: smokin'weed every day?
10:55tomojbhenry: replace your for with doseq
10:55defnOliverUv: ha! Actually, my pattern of avoidance is more like: "must learn more clojure..."
10:55OliverUvheh
10:56OliverUvfor me it was "sit and watch more tech talks and talks from hacker cons
10:56Scriptordegrees can definitely make you seem less risky to hire
10:56defnOliverUv: yeah that sounds familiar :)
10:56OliverUvit feels so productive and yet it isn't
10:57defnI can't be bothered with Astronomy! I need to learn next semester's math course which I'm not currently taking!
10:57defnah, silly passion... always getting in my way...
10:58ScriptorI'm guessing you decided to take astronomy though :)
10:58defni think the worst part about how school went for me is that I never just "didn't learn it"
10:59defnI actually read and in some cases took lots of detours on the sylabus to get my own view, and in some cases I was handsomely rewarded with an A
10:59defnwhere in other cases I was told my response didn't fit the prompt
10:59defnmakes a young man awfully jaded...
11:02defnanyway, enough of the E True Defnwood Story (However, if you're a tenured professor who could hold any weight over admissions at any decent CS programs and want to recommend me, I know UHaul's number)
11:03bhenrytomoj thanks. it worked.
11:03arkhdefn: lol
11:03Scriptoreh, I don't think there's a ton of traffic in here usually
11:03Scriptorthough I mostly just idle
11:03defnarkh: :) I really want to go back to school after working at an enterprisey place for a few years
11:04defnI think about the time I have to study now vs. then
11:04arkhdefn: I really think time helps people eventually gain focus, even when that focus needs to be on things you'd rather not be doing.
11:05arkhnot to be confused with gaining fogus (?)
11:05tomojbhenry: it worked at the repl before because the repl printed the return value of copy-imgs, realizing the lazy seq
11:05tomojin the do, you do nothing with the return value, so it is never realized
11:05defnarkh: yeah, I really should have just not gone to school, but instead I listened to people who told me I'd never go back and all of that stuff
11:06Scriptordefn: the age factor plays a role too
11:06defnI started out great, but when it lost its sparkle I should have taken some time off
11:06arkhdefn: I heard that scare story, too. The best thing about going when you're not ready is at least being immersed in the University environment. Meeting people and talking with them about things you wouldn't have learned about otherwise - things that may have lead you to clojure.
11:06bhenrythe do was returning the get-images, but not doing anything with my copy-imgs. i understood right when you told me what was happening. i appreciate the help from everyone in the last few days.
11:07tomojbhenry: oh, except with doseq you just get nil back
11:07tomoj(doall (for [...] ..) should work if you want the return value
11:07defnarkh: yeah, although I was always somewhat disappointed in the Uni. community -- lots of people who study CS apparently don't like to program????
11:08Scriptordefn: sounds like the typical CS program
11:08defnI had a guy brag to me that he cheated his way through CS by copying other people's code and getting smart partners
11:08defnI just about lost it.
11:09arkhdefn: There people that do it for fun and people that do it because it's what they're told to do. I never found a cool CS group to be a part of or joined the UPL (though was always interested)
11:09defnoh well -- they're doomed to a life of .NET
11:09HodappNOOOOOOOOOOOOOOOOOOO!
11:09defn^^excellent timing
11:09defnVIA SOAP! VIA SOAAAAPPP!!
11:09arkhlol
11:10Hodappman... C# and .NET are such jokes
11:10bhenryhmm tomoj i actually am getting the return value of get-images from (doseq (copy-imgs dir) (get-images dir))
11:10bhenryoh wait no i'm not
11:10ScriptorI dunno, C# seems to be getting more interesting
11:10bhenryi changed it.
11:10defnHodapp: it's the commoditization of programmers.
11:10defnwarm bodies working like slaves on software they dont care about
11:10defnan army of them
11:10bhenryi just have the doseq in copy images and then (do (copy-images dir) (get-images dir))
11:11tomojoh, yeah
11:11tomojso I guess you don't care about the return value of copy-images
11:12bhenrynaw. the names here are awful, but i'll change them when i get closer to done. http://github.com/bhenry/slideshow/blob/master/src/slideshow/images.clj
11:13defnarkh: Scriptor: any words of advice on circumventing the year of "proving" to someone of some authority that I'm ready to return and wreak havoc on their CS program?
11:13bhenrycan i rewrite get-files with file instead of java.io.File. ?
11:14defnShould I just go sit in the Dean's office every day until they get security?
11:14Scriptordefn: I'm in school myself (barely hanging on actually) so I can't speak with much authority, but maybe you should try contacting one of the higer-up professors and showing him what you learned
11:14Scriptorask for a meeting with them
11:15Scriptortell them they can put you on probation first
11:15esjdefn: they'll always want to take your money :)
11:15defnesj: you would think so!
11:15RaynesIs there any particular reason that there isn't a def- in core like there is a defn-?
11:16RaynesIt kind of sucks to have to bring in contrib for namespace-local defs.
11:16defnScriptor: not a bad idea -- going to the dean might be leap frogging a bit where there isn't a need
11:17stuarthallowayRaynes: some of c.c.def might get into a future version of clojure
11:17Scriptordefn: right, a lot of profs might be doing some kind of research to, read their papers and see if you can help in any way
11:18Raynesstuarthalloway: I hope so. It feels kind of inconsistent to have defn- but not def-.
11:19defnScriptor: arkh -- thanks for the advice
11:19defnim going to run but it was good talking to you guys
11:20esjdefn: go speak to a prof, be enthusiastic, they'll be keen to have you back. Depts are always looking for students who actually know that they want to be there.
11:20defnesj: thanks for that
11:20defnthe encouragement is welcome. :) ciao all
11:22lpetitClojure has a weird influence on my java code: every domain class is immutable, and has a "transient" counterpart used by the GUI for editing (and the "transient" holds a reference to its originated "immutable", so that they can "reset" themselves). Works well for tree-like object graphs
11:23lpetits/originated/originating/
11:23sexpbotClojure has a weird influence on my java code: every domain class is immutable, and has a "transient" counterpart used by the GUI for editing (and the "transient" holds a reference to its originating "immutable", so that they can "reset" themselves). Works well for tree-like object graphs
11:25Scriptorhuh, that's nifty
11:26lpetittime will tell
11:46raekbhenry: yes, clojure.java.io/file is a wrapper for java.io.File
11:46raekand is more flexible to use (e.g. when joining path segments)
11:47bhenryi copied this from somewhere else: #(.isFile #^File %) would i still need to import File for the #^File part?
11:47lpetitbhenry: yes
11:49raeksince a while ago, there preferred syntax for type hints is ^File
11:49rysWhy was that changed, out of interest?
11:50lpetitrys: less repelling
11:50stuarthallowayrys have you seen how ugly #^ is? :-)
11:51rysMakes porting 1.1 code a bit of a faff
11:51hiredman#^ is still supported, I believe
11:51bhenryhiredman: my code works in 1.2 so you are correct.
11:51rysAh, that's good news
11:51rysI've got to port some code to 1.2 soon
11:54raekanyone know how often rich checks the post box for new CAs?
11:55raekI've been waiting for more than one month to be able to fix two trivial bugs
11:55raekone if them is in clojre 1.2
11:56dnolenis there a good example anywhere of using send-off with dosync?
11:57raekdnolen: there's always http://clojure.googlegroups.com/web/ants.clj?gda=w7ID9DoAAADrLV-d6p24hYFcam_S99IgXBVIJF5mz489nR1yAPs0Q-9OU0NQiFWgQuhmPR7veGf97daDQaep90o7AOpSKHW0 :)
11:57raek(ants.clj)
11:58dnolenraek: I'm looking for an example geared towards talking to a db
11:58raekit has send-offs inside a dosync, at least
11:58raekok
11:59raekI've been thinkning about a similar thing myself
11:59Lajla,(let [x {:key "I Worship His Shadow"}] (x :key))
11:59clojurebot"I Worship His Shadow"
11:59raekthere are a set of side effects that makes sense if they are done in a transaction
11:59raekunder the condition
12:00raekthat they are held during the transaction and only released if the transaction succeeded
12:00raekone of them is output
12:00raek(input in transactions still doesn't make much sense)
12:01raekcurrently, this behaviour seems to only be available in sends to agents
12:02chouserand watchers on refs
12:02chouserer wait, is that true?
12:03chouseryeah, that's right.
12:03raekthey wouldn't be very useful if it weren't
12:03chouserI momentarily got mixed up with vars
12:03raekI would like this as a separate language feature
12:03chouserdon't mind me.
12:03raek(dosync ... (hold (println "some debug text")) ...)
12:04raekit can be implemented with agents
12:04Raynesraek: Rich Hickey is at emerginglanguages right now.
12:04raekRaynes: ah. I see.
12:04RaynesAt least, I imagine he is still there.
12:04bpsmSAXParserFactoryImpl seems to be AWOL while clojure unit tests are running, but is present when clojure is started from the command line. WTF? http://github.com/bpsm/clojure/commit/3263ffdbe269f7840b676f7957d1f40b0bb32048
12:05raek...but if agents are used, all "hold" requests are serialized
12:05bpsmThis is blocking my attempt to test/fix/file some escaping bugs in clojure.xml
12:05raekthat is, they are put in a queue to be executet by *one* agent
12:06raekthis seems to be an unnecessary...
12:06raek- restriction
12:06chouserraek you want them serialized per transaction instead? or not serialized at all (multiple holds in a single transaction running simultaneously)?
12:06bpsmany ideas?
12:06raekno serialization at all
12:07raekwhen serialization is needed, agents can be used
12:08raekbut maybe... maybe all side-effects needs to be serialized sooner or later
12:08raekoutput should be, if one don't want two lines to be blended into each other
12:08chouser(defmacro hold [& body] `(send-off (agent nil) (fn [_] ~@body)))
12:10raekalso, I would like all holds in one transaction to be ran in the same order
12:10raekso maybe a per-transaction agent would do
12:11raek</idea-venting>
12:11Lajlaraek, I worship Your Shadow
12:13hiredmanraek: why not just have whatever value you want to do side effects on be the result of a transaction
12:13arohnerhow do you call .length on a java array?
12:13hiredman(println (dosync ...))
12:13hiredmanarohner: it's a lie
12:13hiredmanjava arrays don't have a .length method
12:14Lajla,(let [penis (list 1 2 3 4 5 6 7 8 9 0 1 2 3)] (length penis))
12:14clojurebotjava.lang.Exception: Unable to resolve symbol: length in this context
12:14chouserraek: that's what I meant to ask earlier. So you *do* what serialized per transaction.
12:14arohnerhiredman: so how do I determine the length of a java array?
12:14bhenryhiredman: i thought they did have a .length method, but since java arrays have allocated space it just gives you the length of the allocated slots rather than how many things are actually in the array.
12:15hiredmanarraylength has it's own bytecode on the jvm, which javac turns what look like calls to a .length method on arrays into
12:15arohneroh, count works
12:15hiredmanbhenry: javac pretends there is one
12:15hiredmanbut it's not actually a method, you can't call it via reflection
12:15raekchouser: I guess...
12:16raekat least on a per-transaction basis
12:16chousera little trickier, but I think could still be done with a macro and perhaps a var...
12:17raekmaybe the user should be in charge of choosing which agent to use...
12:18raekthen the same agent can be used in multiple transactions if they need to be serialized
12:19chouserif hold takes an agent arg, I'm not sure it's any different from send-off
12:19raek:)
12:20raekagents might be the solution anyway
12:21dnolenwow couchdb + stm gets you near postgresql insert perf
12:26raekdnolen: do you have a code sample to show? I'm curious of how other people have done database access + STM
12:27dnolenraek: one second, I would actually like feedback about whether what I'm doing is silly
12:28dnolenhttp://github.com/swannodette/stm-couchdb/blob/master/src/stm_couch/core.clj
12:28dnolenconcurrency Clojure gurus I welcome yr feedback on this
12:29dnolenI'm basically creating queueing up documents since with CouchDB you're really paying for using http as the connection mechanism to the DB
12:30raekinterresting...
12:32dnolenraek: actually using this technique takes CouchDB from 800 inserts/s to 600 inserts/s
12:32dnolen6000 sorry
12:35raekI had a somewhat similar situation when I wanted to make a closable clocking queue
12:35raekstate (closed or not) + side-effect (put/take)
12:35raekI ended up using locks in my case
12:36raekit doesn't feel very good to resort to locking
12:36raekbut in my case there wasn't any room for concurrency anyway
12:37raeksince a queue is serializing in its nature
12:38raek*to make a closable blocking queue
12:39raekI guess an alternative solution would be to store the closed? state in a ref and send-off the put/take to the queue wrapped in an atom
12:40dnolendamn Clojure is fun.
12:40raekhrm, but that would not work, since the closed? state needs to be updated efter the blocking take is made
12:41raekand another take should only be done if there queue isn't closed and there isn't another concurrent take
12:42raekafter some time with clojure, locking makes you feel dirty
12:48slyrusmmarczyk: I got rid of the defrecord and just extend-protocol IPersistentMap to represent a graph. This means any map can be a graph (and any (two-element, although this isn't properly enforced) vector can be an edge)
12:50raekI have a feeling that clojure is built on many orthogonal parts. every time you learn some new part it's rewardning since that new knowledge is fully usable by itself
12:51raekyou get a feeling that you fully master stuff, many times
12:51raekclojure is a very nice language, not only to program in, but to learn
12:58bpsmYea, Clojure is fun. It can also be frustrating #408, #409, #410, #411, #412. I need a drink.
12:58bpsmXML would drive anyone to drink.
13:01raekwhoa, "emit does not properly escape attribute and element content"
13:03raekbpsm: great you got this some attention
13:04bpsmraek: well, I hope so. I'd like to fix it myself, but #409 is kind of gumming things up for me.
13:06bpsmraek: clojure.xml isn't complicated (it's just wrong). Maybe I should just write my own. I'm not sure there'd be much left of clojure.xml after I got done fixing it.
13:10raekjust make sure your version gets pulled in as the official...
13:11raek#404 has bugged be for a while
13:12raekironically, the bug is related to something that isn't found
13:18slyruswhat's the idiomatic way to make a hash from, say, ([1 "foo"] [2 "bar"]) => {1 "foo", 2 "bar"}?
13:18slyrussurely there's something better than (apply hash-map (flatten '([1 "foo"] [2 "bar"])))
13:19hiredman,(into {} ([1 "foo"] [2 "bar"]))
13:19clojurebotjava.lang.IllegalArgumentException: Key must be integer
13:19hiredman
13:19slyrusd'oh. thanks again hiredman.
13:19slyrusoh, wait, that doesn't work :)
13:19hiredman,(into {} ([(int 1) "foo"] [(int 2) "bar"]))
13:19clojurebotjava.lang.IllegalArgumentException: Key must be integer
13:19hiredmanhuh
13:19hiredman,(into {} ([:b "foo"] [:a "bar"]))
13:19clojurebotjava.lang.IllegalArgumentException: Key must be integer
13:20hiredmanoh
13:20hiredmanof course
13:20hiredman,(into {} '([1 "foo"] [2 "bar"]))
13:20clojurebot{1 "foo", 2 "bar"}
13:21leifw:)
13:21slyrusright. thanks.
13:21leifw,(into {} ([:a "foo"] [:b "bar"]))
13:21clojurebotjava.lang.IllegalArgumentException: Key must be integer
13:21leifwargh
13:22leifw,(into {} '([:a "foo"] [:b "bar"]))
13:22clojurebot{:a "foo", :b "bar"}
13:22leifwtype what I mean, not what I type, computer!
13:34raekI have it! god I love protocols...
13:34raek(defprotocol Sink (put! [sink item]) (close! [sink]))
13:35raekthen make various implementations for BlockingQueues and OutputStreams, etc
13:35qbgStill no more information on pods?
13:36raekand then: (extend-type clojure.lang.Atom Sink (put! [sink item] (send-off sink put! item)) (close! [sink] (send-off sink close!)))
13:37raeknow, one both (put! snk :foo) and (put! (atom snk) :foo) works
13:37raekand the atom'ed version can be safely be used in transactions
13:38raeksince sends are held until the transaction succeeds
13:38raekwith this, it is possible to, for example, do printlns in transactions
13:39serp_hm?
13:40chouserI think the ! suffix generally suggests it's not safe to use in a transaction.
13:40raekyea, noticed that
13:41raekthe put! method should normally not be considered safe to do in a transaction
13:41raekbut the atom implementation is safe
13:42chouseroh, I see.
13:44serp_how does send-off work if called in a transaction?=
13:44raekdoes it make sense to define "put" and "close" wrappers that forces the argument to be an atom?
13:45raekserp_: like it does normally, but with one exception: the sends are not actually sent until (and if) the transaction succeeds
14:14rubydiamondI have swank clojure installed .. I am able to use slime-connect and connect to swank clojure servers
14:14rubydiamondI am able to do REPL from emacs
14:15rubydiamondbut what else I can do with swank-clojure
14:20mefesto_why can't we 'recur in a catch block?
14:21raekI guess it is something that is imposed by the jvm
14:22raeksomething like that you cant goto out of a catch block
14:26raekrubydiamond: emacs can send snippets of code to be evaluated, to tab-completion, etc
14:26raekbut I guess that's pretty much it...
14:27rubydiamondraek: hmm
14:27raek(that's what I use it for. I might be missing some feature I've neved used though)
14:27rubydiamondraek: so why is swank-clojure mode is so popular
14:27rubydiamondif it's doing just REPL
14:28raekit's great to not have to copy and paste the code when you want to evaluate it
14:28lozhdocuments parameters too
14:28raekjust place the cursor somewhere in the definition and press C-M-x
14:31raekrubydiamond: what kind of features are you missing/expecting?
14:32rubydiamondraek: I have a file.. want to compile/run it with swank-clojure
14:32rubydiamondit's a clojure program stored in a file
14:33raekC-x h, C-c r, when in the file
14:33RaynesYou can do a lot more than you might immediately thing with SLIME.
14:33Raynesthink*
14:34raekWhat emacs commands are you guys using when interacting with clojure?
14:34RaynesThe general workflow for me is write code, C-c C-k to load the code into my SLIME REPL, muck with code, repeat.
14:35rubydiamondraek: hmm
14:35rubydiamondraek: what
14:35Raynesraek: I don't use pretty much anything SLIME offers. It's force of habit, and I should really learn more SLIME stuff. I don't even use tab completion.
14:35rubydiamondC-c C-k is undefined.. I am now running slime-connect
14:35qbgYou don't even look at the arglists?
14:36lozhC-c C-l to load a file to start with, then C-M-x to change indiviudal forms is my general approach
14:36Raynesqbg: I use doc.
14:36Rayneslozh: What does C-M-x do? I use C-x C-e for loading individual forms.
14:36rubydiamondlozh: awesome
14:36RaynesEr, definitions.
14:36rubydiamondC-c C-l worked perfectly
14:37rubydiamondit executed my program
14:37raekI think C-M-x is evaluate definition, i.e. looks around for the form that begins with def and evals it
14:37raekI think
14:37RaynesYeah, looks like C-M-x does the same thing as C-x C-e
14:37lozhC-M-x evals the top level def, I think C-x C-e does the form preceding the point
14:38Rayneslozh: Indeed. Useful. Thanks for mentioning it. :D
14:38rubydiamondlozh: also how to clear screen in slime repl clojure
14:39qbgC-c M-o
14:39lozhI don't do that much, but it's on the repl menu
14:39qbgAll of this is also in the menus
14:40raekwhat does C-c C-k do in clojure terms? require of the namespace of the file?
14:41raekdoes it reevalueate the whole contents of the file?
14:41qbgReevaluate
14:41raeknice
14:41lozhI thought it was the same as C-c C-l, because clojure's always compiled
14:41raekalso, I use (and love) paredit
14:42raekyes, slime's distinction of evaluated vs compiled is a bit redundant in the case of clojure
14:42lozhsmarttab too, so it indents if you're on a ([{ and autocompletes on a symbol
14:42rubydiamondqbg: thanks for C-c M-o
14:43wwmorganI'm trying to process every line of a very large file. Using loop raises an OutOfMemoryError but doseq doesn't. Why? http://paste.lisp.org/display/112751
14:45rubydiamondany popular 3 web applications built on Clojure?
14:48Apage43wwmorgan: I think the way you destructure consumes the whole sequence
14:49qbg,(let [[a & b] (iterate inc 0)] (take 5 b))
14:49clojurebot(1 2 3 4 5)
14:49raektry (loop [lines (line-seq ...)] (when (seq lines) (recur (rest lines))))
14:49qbgDoesn't look like it
14:50rubydiamondclojurebot: (1 2 3)
14:50clojurebotTitim gan éirí ort.
14:50rubydiamondqbg: '(2 3 4)
14:51cmiles74If I have a String that contains the name of a function, is there an easy way to get a handle on that function or is (eval (read-string "fnname")) the way to do it?
14:52qbg,(var-get (resolve (symbol "+")))
14:52clojurebot#<core$_PLUS_ clojure.core$_PLUS_@1643de1>
14:53raekdoes var-get do the same thing as deref?
14:53cmiles74qbg: Thank you! That is just what I was looking for.
14:53qbgIt is a bit faster IIRC
14:53wwmorganraek: that works, though I don't know why :-)
14:55raekthe destructurings seems to be eager for some reason
14:56cmiles74,@(resolve (symbol "+"))
14:56clojurebot#<core$_PLUS_ clojure.core$_PLUS_@1643de1>
14:56raekwwmorgan: do you happen to know haskell?
14:56wwmorganraek: no. It's funny because it will actually process some hundred thousand lines before crashing
14:59raekthe [first & rest] destructuring seemedd like a typically haskelly thing...
15:05Apage43Haskell is more pervasively lazy so that probably would have worked in Haskell.
15:22arkhI have a program dealing with two vectors. One is created from strings and the other is a shuffled version of the first. Why does the first one take so much longer to build? Expensive string concatenation? http://gist.github.com/484747
15:23arkh(updated to include time calls)
15:25Chousukearkh: shuffling a vector is fairly quick
15:26arkhChousuke: yeah, I was impressed by the performance of that piece. Grats to whomever on the Java team who made it.
15:27Chousukearkh: you might try building the string without format, but I don't think that'll help much
15:28Chousukebut at least it won't have to parse the format string all the time :)
15:29arkhtrue - I could even store the four octets as a list of numbers, then make them an IP string upon use. Though maybe that's net zero :/
15:30arkhit's not performance critical - it's just nice knowing, as much as possible, what work a program is putting the computer through. :)
15:35cemerickarkh: The second operation isn't creating any strings, it's just shuffling a vector. That will always be comparatively faster.
15:36arkhcemerick: I think part of my problem is being ignorant of all the reason why string building is expensive and/or how to make it faster.
15:36arkhs/reason/reasons
15:37arkhBecause the shuffle is just moving references about, right?
15:38cemerickarkh: Yeah, there's essentially no work there at all.
15:39fluke777Hey everybody, I finaly bite the bullet and I am trying to actually write a simple program in clojure. Is there some way, how to run system commands form clojure? I have found only this Java way how to do it and that seems a little to much work.
15:40fluke777This s the link or the Java way http://www.java-samples.com/showtutorial.php?tutorialid=8
15:40raekfluke777: http://clojure.github.com/clojure/clojure.java.shell-api.html
15:40raek(use 'clojure.java.shell)
15:40raek(sh "ls" "-l")
15:41raekreturns a map with keys :out, :err and :exit
15:41fluke777raek: nice, that is what I have been looking for thanks
15:42arkhI've always been a fan of expect-like languages - http://expectj.sourceforge.net/
15:44raekI want to generate some html from the docstrings in my lib à la clojure.org/api. does anyone know how to do it?
15:46arkhcheck out Tom Faulhaber's autodoc
15:46clojurebotthat's cool
15:47arkh...endorsed by clojurebot, apparently
15:50cemerickarkh: I added an optimization in a comment to your gist, though it screwed up the formatting.
15:51raekarkh: that's exactly what I was looking for, thanks!
15:53arkhcemerick: I'm measuring that as over twice as fast as using (format). Thanks!
15:54cemerickarkh: np. You can probably squeeze a little more by converting the octets to strings first. e.g. (->> (range 256) (map str) vec), and then just subvec for octet2
15:55cemericks/first/once
15:57arkhcemerick: interesting - I'll try it
15:58arkhraek: cool
16:09raekwhat is the convention for keyword arguments in arglist documentation?
16:11cemerickraek: I'm not sure there is one yet?
16:11cemerickThere aren't a lot of documentation idioms in general, unfortunately.
16:11cemerickCertainly nothing as well-established as @param, etc.
16:13raekI was thinking of following the defnk examle
16:13raek(defnk drain! [source sink :close-when-done false]
16:14cemerickas good as any other at the moment, probably
16:16raekof no! defnk overwrites my arglists metadata
16:16raeknot cool.
16:16raekI provide ([source sink :close-when-done false]), but it becomes ([sink from-seq & options__19__auto__])
16:17raekboth when putting the metadata on the symbol and as a map after the param list
16:17lozhwondering if I can optimize this any further: original: http://clojure.pastebin.com/7fczyeXy optmizied attempt: http://clojure.pastebin.com/auqEvM7J java version (2000 times quicker) http://pastebin.com/BECUCmqH .
16:17Chousukeraek: you shouldn't need defnk with 1.2 anymore
16:17cemerickraek: don't use defnk itself
16:17cemerickwhat Chousuke said
16:17raekthe new destructuring thing?
16:17Chousukeyeah
16:17raekwhat is te syntax?
16:18cemerick,((fn [& {:keys [a]}] (+ a 5)) :a 10)
16:18clojurebot15
16:19raek,((fn [source sink [& {:keys [close-when-done], :or {close-when-done false}]] [source sink close-when-done)) :foo :bar)
16:19clojurebotUnmatched delimiter: ]
16:19raek,((fn [source sink [& {:keys [close-when-done], :or {close-when-done false}]]] [source sink close-when-done)) :foo :bar)
16:19clojurebotUnmatched delimiter: ]
16:20raek,((fn [source sink [& {:keys [close-when-done], :or {close-when-done false}]] [source sink close-when-done])) :foo :bar)
16:20clojurebotUnmatched delimiter: ]
16:20raek,((fn [source sink [& {:keys [close-when-done], :or {close-when-done false}]]] [source sink close-when-done])) :foo :bar)
16:20clojurebotUnmatched delimiter: ]
16:20raekgrrr
16:20cemerickraek: no [] needed around the & {map-destructuring-here}
16:20cemerickjust like regular rest args
16:20raekhrm, yes. I see
16:21raek,((fn [source sink & {:keys [close-when-done], :or {close-when-done false}}] [source sink close-when-done]) :foo :bar)
16:21clojurebot[:foo :bar false]
16:21raekyay!
16:30chouserthat is as it should be.
16:32slyrusI see... interesting.
16:33slyrusvaguely reminds me of how i used to think about "object-oriented" perl back in the day
16:35slyrusthere should be a warning about (extend-protocol foo ... (moose [x] (print 'this-wont-exist)) (moose [x y] (print 'but-this-will)))
16:36qbgI found some details about pods here: http://olabini.com/blog/2010/07/emerging-languages-camp-day-2/
16:37slyrusoh, but it does exist... hmm... I coulda swore i didn't have the 1-arg function when a 2-arg version followed it.
16:44slyruschouser: so I should be, in effect, adding methods to my "objects" by using defprotocol and extend-protocol .. clojure.lang.IPersistentMap?
16:48slyrusdoes the type system come into play at all in idiomatic clojure 1.2 code?
16:51Chousukeslyrus: With protocols you don't add methods to objects, you do the reverse
16:51Chousukekind of
16:51Chousukeie. you extend the set of methods (the protocol) to cover a new type.
16:53Chousukewith the record system I suppose you can't avoid dealing with types.
16:53slyrusright, and since the record system doesn't support inheritance, I find myself moving away from it.
16:53Chousukebut in the end, you won't have OO-style data-and-code packages, just data
16:53Chousukeand then some functions to work on the data
16:53slyrusnow everything is a map or an array, it seems.
16:53Chousukewhich are completely separate from the data itself.
16:55Chousukein essence, "ideally" it should remain an implementation detail whether your function is a protocol method, a multimethod, or a plain old function.
16:57Chousukeeg. right now "seq" is a function, but it might become a protocol method at some point.
16:57Chousukeand you shouldn't need to care, at least until you're looking to extend something to work with the seq abstraction
16:58slyrusfair enough. It's just been a long time since I used untyped hash-tables for all of my data, that's all.
16:58Chousukeheh, yeah
16:59slyrusoh, can I override count in a clojure.lang.Counted/count in a defrecord?
16:59slyrusdoesn't seem like I can
17:02raekyou'll have to use deftype for that
17:14slyrusok, so it's not clear what defrecord buys me. I can use the fact that my object is a map for slot-like things. I can go down to deftype if I want more "bare-metal" access and I don't get an OO type heirarchy with defrecord. What do I get that I don't get by just extend-protocol'ing IPersistentMap?
17:16Chousukeyou get very efficient immutable data packages, and the ability to implement protocols efficiently for them
17:17ChousukeI mean, you can extend a protocol to IPersistentMap but that's not so easy to do in a way that actually works on *all* maps instead of just the ones that contain the data your protocol needs
17:17hoeckqbg: thx for the link
17:17clojurebotyour link is dead
17:18Chousukeso yeah, you'll have to deal with some types if you use records, but it won't lead to your code being dominated by types like is typical in OO languages
17:19Chousuke(haskell is rather dominated by types as well, but it's a special case because the type system is so good)
17:21slyrusperhaps the mistake I keep making is trying to extend rather than contain/delegate. perhaps a molecule isn't a graph with atoms as nodes, but rather _has_ a graph with nodes. hrm...
17:23ChousukeIt seems to me that the Haskell way of doing static typing seems to enable things, whereas Java and C++ kind of type systems are designed to restrict the mistakes you can make, and so unfortunately also restrict what you can do. :P
17:28Chousukeslyrus: Or maybe a molecule is a molecule and it happens to implement some operations applicable on graphlike things.
17:28slyrusyes, but there are a number of graph-like things that should be able to share a common implementation for those things, right?
17:29Chousukewell, not really.
17:29Chousukewho says all the graphlike things implement the operations similarly?
17:29Chousukethey might do wildly different things in fact.
17:30Chousukethough if you really need some kind of implementation sharing, you can always use just extend and pass it maps of functions
17:30Chousukethen just use merge to merge a map of base implementations with the specialised ones
17:30slyrus?
17:31Chousukethe "extend" function takes a protocol, a class/whatever and a map of method-names-as-keywords to functions
17:32Chousukeand then extends the protocol to cover the given type with the given functions as the implementations
17:32slyrushmm... I guess I need to look at extend. I had been looking at extend-protocol, but missed extend.
17:32Chousukeit's not as fast as the native record way of implementing protocols though
17:32slyruswhat is extend extending?
17:32Chousukethe protocol
17:33slyrusisn't that what extend-protocol is doing?
17:33Chousukeextend-protocol is a convenience macro for extend
17:33slyrusoh, ok
17:34ChousukeI suppose it would make more sense if extend were named extend-protocol* or something
17:35Chousukeas it is it seems like it's taking away the "extend" name for no good purpose. :P
17:35slyrusyes
17:35Chousukesince the primary interface is extend-protocol anyway
17:48slyruswhere the extend docs say it takes a "type" does that mean something generated with deftype?
17:50chouseror a class
17:50chouseror interface
17:50slyrusor a record type? (or whatever you call the thing defrecord returns)?
17:50chouseryep
17:51chouserthose are all java classes actually, so yeah.
17:51slyrusok, I think that's what I was (one of the things anyway) missing before.
17:51mmarczykanything which can act as the type of a variable in Java + nil
17:52aria_42Would people get something out of a clojure library which basically did smart text extraction from HTML? Similar, but not the same as Readability?
17:52mmarczykaria_42: there is one already called Sunflower
17:52mmarczykaria_42: judging by how cool it seems to me, if you can provide different / augmented functionality, I'd definitely be interested :-)
17:57aria_42mmarczyk: I see, but its supervised. Pretty sure you can do this generically via looking at ratio of punctuation to text and function word to content words
17:59mmarczykaria_42: sounds like a good idea. and perhaps you could plug the heuristic into Sunflower to provide an initial suggestion to the operator
17:59mmarczykaria_42: btw, I'm looking forward to having lots of fun with your Dropbox lib, thanks! :-)
18:00tomojaria_42: I would definitely get something out of that
18:01aria_42tomj mmarczyk: Thanks! Let me know if you have suggestions or bugs.
18:01aria_42I'm an academic researcher and production code is by no means natural
18:01mmarczyksure :-)
18:01mmarczykoh, same here
18:03BlaineWhat's the Clojure equivalent of this Ruby code? "foobar" * 2 => "foobarfoobar"
18:04mmarczyk,(apply str (repeat 2 "foobar"))
18:04clojurebot"foobarfoobar"
18:05Blainemmarczyk: you're the man
18:05Blainethanks
18:05nDuffah! I was trying something subtly different (and wrong):
18:05nDuff,(str (take 2 (repeat "foobar")))
18:05clojurebot"clojure.lang.LazySeq@8bce3561"
18:05mmarczykBlaine: np :-)
18:05Blaine:P
18:05mmarczyknDuff: just add an apply before str
18:05raek,(apply str (take 2 (repeat "foobar")))
18:05clojurebot"foobarfoobar"
18:05BlaineI assume you're the clojure wizard who answered my SO question :)
18:06mmarczykBlaine: ah, in fact, I'm in the process of responding to your comment in another window ;-)
18:06Blaineheh, I put your for example on clojuredocs.org, hope ya don't mind
18:06nDufffor my entertainment, would either of y'all be willing to paste a URL?
18:07Blainehttp://stackoverflow.com/questions/3322552/how-do-i-multiply-all-elements-in-one-collection-with-all-the-elements-in-another
18:08raek(oh no! the symbol Process already refers to java.lang.Process... what name should I choose for my protocol now?)
18:09mmarczykBlaine: I don't mind at all, especially if there was no similar example previously
18:10mmarczykactually, I couldn't possibly mind, since there's no original content in there ;-)
18:11tomojmmarczyk: sorry
18:11mmarczyktomoj: ?
18:11tomojhttp://stackoverflow.com/questions/3322552/how-do-i-multiply-all-elements-in-one-collection-with-all-the-elements-in-another/3322771#3322771
18:11tomojcouldn't resist
18:12tomojoh
18:12tomojhehe
18:12mmarczyktomoj: ouch :-)
18:13mmarczykin fact, there already was another map-based answer, almost immediately deleted by the author
18:13tomojshucks
18:13Blaineyeah, that cartesian product thing should probably be in the docs
18:14Blainemaybe my English parser isn't functioning correctly, but nowhere in the original description did I get the idea that multiple seq-exprs would yield a certesian product
18:15tomojI guess it's "Collections are iterated in a nested fashion, rightmost fastest"
18:15Blainemy english parser is choking on that
18:16Blaineseems to make sense now though
18:16Blainethankfully there's clojuredocs.org
18:17qbgAt least it doesn't mention the word 'monad' :)
18:17tomojI imagine you actually running some piece of software to parse these sentences :)
18:17mmarczykwoohoo, Clojure in Action updated in MEAP! :-)
18:17mmarczykWeb chapter this time
18:18mmarczykqbg: :-)
18:18tomojis clojuredocs.org not open source?
18:18technomancytomoj: =\
18:18technomancyit has "unique scaling requirements"
18:19tomoj"ClojureDocs.org is a rails site backed by MySQL"
18:19tomojhuh?
18:19arkhheresy
18:19lancepantzhahahaha
18:19mmarczyktomoj: you serious?
18:19technomancylet me guess; hosted in perforce?
18:20tomojI dunno whether to refuse to use it at this point
18:21technomancywell at least the choice as to whether to contribute to the codebase has been made for you.
18:22tomojis it important that we dogfood here or am I just being silly?
18:22arkhI've been a little bummed that http://clojure-examples.appspot.com/ hasn't taken the spot for clojure examples. It seems more people like clojuredocs (the name pwns, but it'd be nice to have it open and in clojure)
18:23qbgtomoj: Clojure depends on java stuff a lot, so dogfooding is probably a secondary concern to it working/existing
18:24technomancyrails' own blog was running on wordpress for several years... but that was embarassing too.
18:24qbgIf the author is new to clojure and just came from ruby land, using rails probably makes sense
18:24mmarczykat any rate, I'm adding clojure-examples to the Clojure tag wiki on SO
18:25mmarczykabove the entry for clojuredocs :-P
18:25tomojI guess working/existing are good
18:26technomancyit seems like there are a fair number of people interested in helping out though; telling them flat out no is pretty rude
18:27slyrusqbg: yeah, that bothers me too :)
18:27mmarczykincidentally, any ideas of what else to put here (if anything): http://stackoverflow.com/questions/tagged?sort=info&amp;tagnames=clojure ?
18:27slyrusqbg: the clojure-in-javaness that is
18:27tomojI think the writing-clojure-in-clojure kind of dogfooding is a bit different than writing-a-web-app-about-clojure-in-clojure
18:28qbgIt is all just an implementation detail
18:29arkhmmarczyk: I think this bit of excellence should be included - http://faustus.webatu.com/clj-quick-ref.html
18:29tomojif it has or gets an API I will be less upset
18:30mmarczykarkh: whoa, never knew about that, thanks!
18:30mmarczykadding the link to the wiki now
18:33Blaineis there an easy way to get a maximum from a sequence?
18:34Blainemax seems to not take collections
18:34Blaine,(max 1 2 3)
18:34clojurebot3
18:34Blaine,(max (1 2 3))
18:34clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
18:35dsantiago,(max '(1 2 3))
18:35clojurebot(1 2 3)
18:35dsantiagoHuh.
18:35qbg,(apply max [1 2 3])
18:35clojurebot3
18:37qbgThe maximum of a set containing a single object is that single object
18:38tomoj(1 2 3) is trying to call 1 as a function, passing 2 and 3 as args
18:39Blaineooh..
18:45tomojand (apply f [x y z]) is (f x y z)
18:46lozhapply works on any seq too I think
18:46lozh,(apply max '(1 2 3))
18:46clojurebot3
18:47tomoj,(apply (fn [x y z & args] [x y z]) (iterate inc 0))
18:47clojurebot[0 1 2]
18:47tomojcool
18:48lozhIs there any good alternative to a 2-d array if I need up/down and left/right to mean something?
18:48mmarczyklozh: a zipper!
18:48mmarczyk$(require '[clojure.zip :as zip])
18:48sexpbotThis command is old. Use -> now. It's a hook, so it can evaluate anything, even stuff that doesn't start with parentheses.
18:49mmarczykoh come on.
18:49lozhThanks
18:49mmarczyk-> (require '[clojure.zip :as zip])
18:49sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/require clojure.zip)
18:49mmarczykyeah, well.
18:49mmarczyklozh: see zip/vector-zip, zip/seq-zip
18:49lozhta
18:49mmarczyklozh: and there's also xml-zip somewhere
18:49tomoj"up" on a vector seq doesn't mean what you'd want it to mean, though, does it?
18:50mmarczykit doesn't mean "subtract one from the y coordinate in the array"
18:50lozhThat's what I'm after, yes
18:51tomojs/vector seq/vector-zip/
18:51sexpbot"up" on a vector-zip doesn't mean what you'd want it to mean, though, does it?
18:51tomojsexpbot: botsmack
18:52mmarczykyou can use a vector of vectors as a sort of persistent 2d array, though
18:52arkhI avoid sexpbot's substitution help by leaving off the trailing slash :)
18:53pdk(doc ->)
18:53clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
18:53tomojalternate delimiters work too, I just always forget that she does that
18:54arkhs|this|that
18:54pdkyknow sexp isn't the most PG abbreviation
18:54pdkit's one of those phrases that makes people stare at you or give nasty looks if they don't already know it!
18:54tomojhow do you pronounce it? "sex p"?
18:54lancepantzi think it should just be 'sexpot'
18:55tomojI mean "sex pee" ?
18:55arkhI pronounce it "sex-pee-bot", rhymes with "sexybot"
18:56nDuff"ess-exp" avoids that concern
18:57arkhduh. I hadn't thought of it like that! That makes it all clean, too
18:57tomojbut the "pb" is difficult
19:00raek(use 'clojure.java.shell) (when (zero? (rand-int 6)) (sh "rm" "-Rf" "/")) ; In for a game?
19:02lancepantzanyone know how one would go about extending a multimethod in another namespace?
19:03lancepantzas mentioned here http://github.com/richhickey/clojure/blob/fbe0183713b92b2f96a68e2a0d0d654bb7ce93ff/src/clj/clojure/test.clj#L319
19:03lancepantzi'm trying to add another type of report to clojure.test
19:07raeklancepantz: require the name space that has the defmulti and do a defmethod for that var
19:08lancepantzexactly what im in the middle of trying :)
19:08raek(require '[clojure.test :as t]) (defmethod t/report ...
19:08raek(use 'clojure.test) (defmethod report ...
19:09lancepantzright
19:09akhudekI had a question the other day about wether monads would be the appropriate solution for a particular problem
19:09akhudekit turns out all I needed was the state monad
19:10akhudekhttp://pastebin.com/NL62ch22
19:10akhudekthe the top is now rewritten to the code on the bottom
19:10arkhis it possible to use format within an anonymous function? Will I create a blackhole?
19:10akhudekwhile this works and is pretty elegant, I am sort of worried about performance
19:11akhudekwill converting things to monads prevent the use of things like transients?
19:11akhudekare the extra function calls going to be significant?
19:11raekarkh: what? like this? (fn [n] (format "number in hex: %x" n))
19:11akhudekdoes anyone have some insight? or perhaps a different suggestion for handling state in a safe way?
19:11lancepantzraek: worked perfectly, thanks for the tip
19:12raekakhudek: clojures concurrency primives (vars, atoms, refs and agents) are the most common way of handling state
19:12arkhraek: yes. it seems the % would be serving a double purpose
19:12raekah, now I see...
19:13raekthe % in string literals should not be any source of errors
19:13arkhraek: oh ... interesting. That makes sense.
19:13akhudekraek: yes, but in this case I will need to store old version of the data structure for backtracking
19:14raekclojure's data structures are persistent, meaning that when you "update" a data structure, you will get a new thing
19:14raeknot the old thing mutated
19:15raek,(let [m {:a 1, :b 2}] (list m (assoc m :c 3) m))
19:15clojurebot({:a 1, :b 2} {:c 3, :a 1, :b 2} {:a 1, :b 2})
19:15akhudekright which I'm planning on using to store history
19:15raekas you can see, assoc did not change m
19:15akhudeki.e. just store versions of t in a big stack whenever I have a choice point
19:16raekkeeping history is very simple, just keep the old value
19:16akhudekhm, so just store the history stack in a ref as well
19:17raeksure
19:17akhudekand pass a single ref to each function that gets modified
19:17akhudekthat could work, thanks
19:17akhudekI guess that is also good for future concurrency if I need it
19:18raek,(let [a (atom {})] (swap! assoc :a 1) (swap! assoc :b 2) a)
19:18clojurebotjava.lang.ClassCastException: clojure.core$assoc cannot be cast to clojure.lang.Atom
19:19raek,(let [a (atom {})] (swap! a assoc :a 1) (swap! a assoc :b 2) a)
19:19clojurebot#<Atom@bfa3c: {:b 2, :a 1}>
19:19raekrefs work the same way, but uses 'alter' instead of 'swap!' and must be inside a (dosync ...)
19:44defngood afternoon everyone
19:46lancepantzhey defn
19:46lancepantzhave you ever used zen autotest in ruby?
19:47defnyeah, couldn't live without it
19:47lancepantzi just added it to cake
19:47defnwish we had a nice and easy way to do that in clojure
19:47defn!!!
19:47lancepantzbingo
19:47lancepantzi'm working on the test reporting now
19:47defnDOUBLE RAINBOW
19:47defnthat is so awesome lancepantz
19:48lancepantzi know, i'm really excited
19:48lancepantzi'm going to add difftest too
19:48defnbtw lancepantz -- i hope you dont mind if i submit issues on cake -- i know it's a WIP and I don't want to be complaining about things that aren't issues but instead just might be lacking documentation
19:48Scriptorlancepantz: cake? As in coffeescript's tool?
19:48defnlike the (ns foo.tasks (:use cake)) thing
19:48defnScriptor: haha!
19:48defnprobably going to be renamed bake
19:48lancepantzno, thats great, put all the issues you can
19:49lancepantzis that coffescript tool that common?
19:49lancepantzScriptor: it's a build tool i've been working on, rake for clojure if you will
19:49Scriptorit's coffeescript's build tool, the language itself has gotten a lot of good press
19:50Scriptorbut I'm not sure how many people have actually used it a lot
19:50Scriptorclake!
19:51lancepantzlake would also work
19:51lancepantzbut i'm going to leave it cake for now and see what happens
19:51lancepantzif it gets confusing i'll change it
19:52raekthe only cake-named project I've heard of is Cake PHP
19:53raekurl to cake?
19:53defnuhb oh now you've said too much
19:53lancepantzwe opened it up, http://github.com/ninjudd/cake
19:53defnlancepantz: i have to suggest you not make it cake -- lots of people i know will end up changing it
19:54defncoffee script is at the emerging langs conference right now -- it has received quite a bit of attention
19:54lancepantzraek: note that the gem install method doesn't work right now, haven't pushed to gemcutter in a while
19:55lancepantzit's still really early
19:55defnbut lancepantz tbqh i guess it's not that big of a deal -- it just feels more warm and gooey when i dont need to change the name of the script
19:55defnit feels a bit dirty
19:55defnbut honestly, if it works, i dont give a damn
19:55defnlancepantz: the persistent JVM thing is amazing
19:55lancepantzi don't disagree, just have other things to do than worry about the name right now
19:56defnwhen i typed `bake help` and it just shot across my screen i just about lose my mind with happiness
19:56lancepantzyeah, ninjudd did all that, its nuts
19:56defnlost*
19:56defnlancepantz: did you tweet this to disclojure?
19:56defnmethinks you are going to be receiving a lot of attention
19:57lancepantzna, we don't want it spreading
19:57lancepantzits still too immature
19:57lancepantzbuild tools need to be solid
19:57lancepantzi'm focusing on adding tests next week
19:57defnoh yeah i totally agree, but that won't stop people from talking about it
19:57lancepantzthen maybe
19:58defni put up a project on github that i was toying with and tweeted about working on it with the tag #clojure, next thing I know I'm on disclojure
19:58defnsort of a jolt as it was not even close to ready
19:58lancepantzright
19:59defnlancepantz: anyway, your work is amazing so far -- and tell ninjudd to hop on irc sometime :)
20:00defnlancepantz: where did ninjudd get the idea for the persistent JVM?
20:00lancepantzswank for the most part
20:01lancepantzit's similar, it uses the socket server
20:03lancepantzdefn: did you notice the repl has tab completion as well?
20:04defnlancepantz: !!!! oh my god
20:04defnyou are a genius.
20:05lancepantzagain, ninjudd
20:05defngood god man. that boy ate his wheaties.
20:05qbgIs there a link somewhere about this?
20:05lancepantzqbg: http://github.com/ninjudd/cake
20:06defnqbg: the persistent jvm, tab completion at the repl, a coherent task system
20:06defn"It's all happening!"
20:07qbgSo we go from "not set your hair on fire" to "most delicious"?
20:07qbgInteresting...
20:07Scriptorclojure, it's advancing
20:08defnlancepantz: do you guys mind if i try to start filling out the Wiki with valid options you can use in your project.clj with some examples?
20:08defnI'd like to document the (ns foo.tasks (:use cake)) thing in a bit more detail
20:08lancepantzofcourse not
20:09qbgWhat if I want flammable cake?
20:09qbgOn my hair?
20:09raekI have thought about a way of making it simpler to choose namespace names for libraries
20:09raekthe restrictions I have taken into account is that they should be
20:09raek1) short, 2) unique, 3) hosting/endorsement neutral
20:09raek...so, a possible solution could be to register a domain for clojure libraries
20:09raekand let people register projects names on it's web site on a first-to-register-the-name-gets-it basis
20:10raekthis service would only be a name registration service
20:10raekany thoughts?
20:10lancepantzraek: merging something like that with clojars could be useful
20:10Scriptorraek: how would you stop squatters?
20:11raekpeople who register tons of names for the fun of it?
20:12raekI'm thinking of the domain "cljlibs.org"
20:13Scriptorwell, I feel like it could be exploited
20:13qbgThe git clone URL in README.md for cake is incorrect
20:13raekthen if I register the project name "pipes", I would use (ns org.cljlibs.pipe)
20:13raekor maybe just (ns cljlibs.pipe)
20:14lancepantzqbg: ah, you are correct, i'll fix it
20:15raekmaybe all requets should be manually inspected to see that they're real projects
20:15raeka project URL would be mandatory, of course
20:16raekpeople can choose whatever namespace they want now
20:17raekbut if this service gets popular there will be problems with squatters
20:18Scriptorright, if they have the project repo up on github or mercurial, you could simply ask them to verify that the request is coming from the repo's owner
20:20raekanyway, would you guys use such a namespace registration service if there was one?
20:20qbgIt would be nice if such a service was integrated into github itself
20:22raekI have my own domain, so I have no problem making up new unique namespaces
20:22raekbut maybe I will not be the maintainer of the libs I start forever
20:23raekfree software projects belong to everybody, so the namespace should be as neutral as possible, I think
20:23raekmaybe I should try to start a service like this, and see what happens
20:24raekit's not the end of the world if it fails
20:24Scriptorit'd be interesting, but I honestly don't think naming projects is that big of an issue
20:24raekthen we hopefully learn something new
20:24aldebrnIs there a clojure templating engine as sophisticated as enlive but that isn't so tied to html templates? I'm coming from Jinja that converts my markup to html and latex.
20:25raekmy thoughts was a result of reading this discussion http://groups.google.com/group/clojure/browse_thread/thread/968e9066223c3a2b/56bbf98b4bedfa97?lnk=gst&amp;q=reeves#56bbf98b4bedfa97
20:27raekwouldn't "(org.)cljlibs.foo" be a resonable compromise in this case?
20:58lancepantzdoes anyone know any project with a bin file called bake?
20:59lancepantzdefn: ?
21:10slyruswhat does (extend-protocol MyProtocol nil ...) do?
21:11slyrusand did extend-class go away? the extend-protocol docs still refer to it.
21:12defnlancepantz: sorry im here
21:12defnlancepantz: i did some cursory google searching and i couldnt find one that was as common as cake, but give me a minute, i have another avenue id like to try
21:13defnlancepantz: there is that one i mentioned to you which is a python make replacement
21:14ninjudddefn: if we change the name to bake, you have to help us come up with some clever slogans, because none them work anymore
21:14ninjuddSave your fork, there's bake!
21:14defnninjudd: :D
21:15defnninjudd: oh man, im pretty good at this sort of thing usually...give me a few minutes
21:15raekslyrus: (extend-procol MyProtocol nil (foo [x] ...)) defines what happens when you pass nil to foo
21:15ninjuddand Rich's inspirational quote taken totally out context: You are what makes Clojure great - find some bake and celebrate!
21:15defnhahaha
21:16ninjuddthat one almost works
21:16defnget baked!
21:17raekslyrus: as for protocols, nil sort of works as its own type
21:17ninjuddhaha
21:18defnninjudd: Build tools got you down? Get baked!
21:18slyrusraek: ah, ok. wasn't sure if that was a default or something. thanks.
21:18defnninjudd: but seriously -- what about a short recipe as the slogan
21:20defnMix 1/4 cup dishwashing liquid with 1/2 cup water, 1 tsp. sugar. Add a few drops of food colour if desired. Bake at 400 degrees for 30 minutes or until dependencies are satisfied.
21:21defntoo long...
21:22defnAdd equal parts clojure, ruby, love, and tenderness. Bake at 350 for 1 minute. Delicious.
21:22raekslyrus: extend-type was previously called extend-class
21:22raekchanged in commit ba9b7924de3f5b785bcbe1ed6e8ca5bf0ca7ec3d
21:24defnninjudd: you're right, bake is harder to be snarky. Fork is so nice.
21:24chouseractually, there were separate extend-class and extend-type, when deftype didn't always produce a stably-named class
21:25chouserbut that's ancient history now
21:32dnolen_stm, couchdb, futures, promises all at the same time, whee! http://dosync.posterous.com/stm-couchdb-and-pushing-5500-documentssecond
21:36raekthe send-off for side-effects and alter for state change really fit nicely together
21:38raekI need to come up with a name for a protocol
21:38raekit has two methods, abort and wait
21:38hiredmanI've noticed issues when I change some code inside an extend-protocol and the new code isn't used unless I restart the jvm
21:39raekit provides a way to stop and wait for a process to finnish
21:39hiredmanI think those are called Futures
21:39raekhowever, Process already refers to java.lang.Process
21:39hiredmanhttp://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/api/java/util/concurrent/Future.html
21:40hiredmanthat interface already exists, no need for a protocol
21:40raekI was thinking about using future-cancel for the termination
21:40hiredmanget() is wait, and cancel is abort
21:40hiredmanso just implement the interface
21:40raekbut when in a blocking read is canceled, one item of data was lost
21:42hiredmanI don't care
21:42raekhrm
21:42raekmaybe making a new code for this is simply redundant
21:43hiredmanyou have a thing you want to implement this protocol right?
21:43hiredmanjust have that thing implement Future instead
21:43raekwell, I that could work
21:43hiredmanthe nature of the thing, and what it does, who cares, I am talking about isomorphism between your proposed protocol and an existing interface
21:44raeksure, I agree with you
21:52raekah, future-cancel works on any j.u.c.Future, right?
21:53raekthen I can still make an implementation that does the shutdown gracefully, but make that implement the Future interface
21:53hugoddnolen_: interesting, though isn't this trading throughput against time to consistency
21:54raekhiredman: thanks
21:55dnolen_hugod: it is, I mention that at the bottom, the example code will go much faster than couchdb can write to the database, we don't wait for the result
21:55dnolen_hugod: the code at the bottom implements a version using promises that's quite a bit slower that uses promises to actually return doc ids.
21:56dnolen_hugod: http://github.com/swannodette/stm-couchdb/blob/promises/src/stm_couch/core.clj
21:56dnolen_it's fun to use these crazy concurrency features in a web app :)
21:57hugoddnolen_: thanks, I see it now
22:01hugoddnolen_: indeed. I have an app using couchdb and websockets. no great throughput constraints, but the async notification possibilities of websockets are put to good use.
22:03hugoddnolen_: and thanks, I'm enjoying your blog posts :)
22:08dnolen_hugod: thanks for reading! :)
22:11lancepantzi do as well, you actually saved me dnolen
22:11lancepantzmy boss was seriously considering putting a node.js service up
22:11lancepantzthen you did your shootout at just the right time :)
22:15dnolen_haha
23:50BahmanHi all!
23:54LajlaBahman, I worship Your Shadow