#clojure logs

2010-02-10

00:01somniumah, I had to call them something for the multimethod (::A->B->C) would involve a parser
00:01somniumso I just gave them random letters and put the haskellish types in the comments
00:01devlinsfAh, okay
00:02somniumwas loosely based on (my incomplete) understanding of the state-monad
00:03devlinsfStill, I like the idea of typed fns... sometimes :)
00:03devlinsfIt would be a good option to have occasionally
00:04somniumyeah, when they cause compile failures they suck, but if they can help build things theyre interesting
00:05devlinsfI'm more interesting in multimethods/protocols
00:05devlinsfI'd like a promise that implementations will behave kind correctly
00:06devlinsfReturns a seqable when expected, etc.
00:07devlinsfHmmm... I guess that would require a speed hit in a dynamic language, though
00:07devlinsfOh well
00:11somniumwith :pre :post, and possibly primitive args and return types, might be inching towards an occasionally static dynamic language
00:12devlinsfYeah, I was thinking about that. Do they work with multimethods? I thought :pre & :post are specific to closures.
00:13somniumright now they just expand to (assert ...), so you could put them in the dispatcher
00:13somniumwill be interesting if they eventually get used by the compiler
00:13devlinsfAh. Makes sense
00:20maxhodaki'm trying to call a variably named java method using the dot syntax and can't get it to work
00:21maxhodak(. impl method-name) keeps giving me "No matching field found: method-name for class"
00:21maxhodakand i can't figure out how to quote it properly if that's the right way to do it
00:24devlinsfmaxhodak: (.method-name impl) is generally considered better form
00:24devlinsfmaxhodak: Also, try adding type hints. This will fix this error some of the time
00:25maxhodak(.method-name impl) gave the same error
00:26devlinsfAnd type hints?
00:26maxhodakas in, #^double
00:26maxhodaker
00:26devlinsfYeah
00:26maxhodak(.#^double method-name impl) ?
00:27devlinsf(.method-name #^ImplClass impl #^Double ar1 #^Object arg2)
00:27maxhodakoh; i'm using apply and have the args in a list
00:27devlinsfOh
00:28maxhodak(let [impl (new ServerImpl)]
00:28devlinsfI'm 99% sure you can't do that
00:28maxhodak(apply (.method-name impl) args)))
00:28chouserthat's not going to work
00:28devlinsfYou need a memfn call
00:28maxhodakgrr
00:28maxhodakgoogling memfn
00:28chouserand memfn won't help
00:28devlinsfNo?
00:28clojurebotda da king of the road
00:29chouserdevlinsf: no, memfn does nothing the #() can't do better.
00:29devlinsfAh.
00:29maxhodakchouser: how would you work around?
00:29chousermaxhodak: are there actaully a variable number of args?
00:29devlinsfmaxhodak: Can you point to the real javadoc?
00:29maxhodakchouser: yes, it's a way to access the class methods from the commandline
00:29maxhodakchouser: so you don't know what method you're trying to access ahead of time
00:30chouserthe java method probably accepts an array then, doesn' it?
00:30maxhodakdevlinsf: i haven't generated javadoc for this
00:30devlinsfmaxhodak: Oh, okay
00:30maxhodakchouser: no, it takes two integers
00:30chouserjava "varargs" compile to actually accepting an array.
00:30maxhodak(the one im trying right now away)
00:30chouser"two integers" doesn't sound like a variable number of args. it sounds like 2. -)
00:30chouser:-)
00:30maxhodakchouser: for this method, but there's a bunch in the class
00:31maxhodaksome are void, some take 1 arg, some take 3
00:31maxhodaketc
00:31maxhodakand im basically doing
00:31chouserdo you not know the name of the method ahead of time either?
00:31maxhodakjava -cp myfoo.jar myfoo.test methodname arg1 arg2
00:32chouserok, for that you probably want either reflection or 'eval'
00:32chouserthese are instance methods or static?
00:32maxhodakinstance
00:32maxhodakthough i could probably declare a bunch of them static
00:33maxhodakbut really instance
00:33chouserok, doesn't really matter. for something like this 'eval' might be easiest.
00:33maxhodakok
00:33maxhodakso like
00:33chouserin fact, if you're taking different arg types, that is not always strings, you might use the Clojure reader too.
00:33maxhodak(eval `(.~method-name impl ~(map ...))
00:34TheBusbychouser: in way to get prxml to return the generated string?
00:34TheBusbyer, _any_ way...
00:34chouseryes, but the lone-dot format is better when you're constructing the form like this.
00:35chouserso (eval '(. impl ~method-name ~(map read-string args-strings)))
00:35maxhodakchouser: what's the best way to unroll my args list?
00:35maxhodakok thanks
00:35chouserer, but with `
00:36maxhodakchouser: what's the big difference between a syntax quote and a quote?
00:36maxhodak(i know, i know, basic question)
00:36chouserTheBusby: with-out-str might do it
00:36chouser,(with-out-str (println "stuff"))
00:36clojurebot"stuff\n"
00:36tomoj,`(~foo)
00:36clojurebotjava.lang.Exception: Unable to resolve symbol: foo in this context
00:36tomoj,'(~foo)
00:36clojurebot((clojure.core/unquote foo))
00:37tomoj,`foo#
00:37clojurebotfoo__6489__auto__
00:37tomoj,'foo#
00:37clojurebotfoo#
00:37maxhodakso, basically do i need to declare my bindings *inside* the quote?
00:37maxhodakit looks like that's the only way to get impl in scope?
00:38chousermaxhodak: I wrote a section on that in chapter 1, but not the version that's out yet. :-/
00:38TheBusbychouser: thanks! Seems like odd default behaviour for Clojure's default XML generater though...
00:39chousermaxhodak: syntax-quote aka ` has a couple differences from quote. here all we're using is the ability to unquote with ~
00:39tomoj,(namespace `foo)
00:39clojurebot"sandbox"
00:39tomoj,(namespace 'foo)
00:39clojurebotnil
00:39chousermaxhodak: no, sorry, my eval example was bad.
00:40chouserso (eval (list '. impl method-name (map read-string args-strings)))
00:40chouserthere, try that.
00:40tomojdon't the args need to be spliced?
00:40chousereh. that's just a slow way to get to reflection. :-/
00:41chousertomoj: bleh. yeah.
00:41chouser(eval (list* '. impl method-name (map read-string args-strings)))
00:41tomojwhoa
00:41tomojawesome
00:41maxhodak(eval (list '. impl method-name (map read-string args))) won me "Malformed member expression
00:41maxhodak"
00:41chousermaxhodak: yeah, sorry. try list* instead
00:42maxhodakok. i appreciate you helping me here.
00:42chousersorry I keep being wrong. :-P
00:42maxhodak(the clojure community is one of the best things about it)
00:42chousernow I'm thinking eval is just a red herring
00:42chouserI mean, it should work, but kinda lame
00:42maxhodakjava.lang.ClassCastException: clojure.lang.ArraySeq
00:42devlinsfchouser: Why won't a normal macro cut it?
00:43chouserdevlinsf: he doesn't know anything about the which method to call or what the args are until runtime.
00:44devlinsfBut you've got strings... which can easily be turned to symbols.... eh, okay
00:45chouser,(let [method-name "toUpperCase", impl "FooBar", string-args []] (clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map read-string string-args))))
00:45clojurebot"FOOBAR"
00:46chouser,(let [method-name "lastIndexOf", impl "FooBar", string-args ["\"B\""]] (clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map read-string string-args))))
00:46clojurebot3
00:46devlinsfmaxhodak: Do you have a fixed pool of methods? Is it easy enough to wrap them in normal fns?
00:46chousermaxhodak: probably best to just use Reflector like that. That's what eval will do (after a whole lot of mucking about with bytecode) anyway.
00:47maxhodakyeah, saw the examples... trying it
00:48devlinsfWhy not a hashmap of strings->fns ?
00:48maxhodakthis is totally mystifying
00:48maxhodaki kind of want to say screw it and hardcode it to test it
00:49maxhodakbut i also feel like that won't lead to me learning the intricacies of clojure
00:49devlinsfmaxhodak: You come from a Java background?
00:50devlinsfIf so, start at java.lang.Reflect. Then look at Chouser's example
00:50maxhodakdevlinsf: no; hacking background: i hate java. ocaml, php, c++, python, ruby
00:50devlinsfOh
00:50maxhodakunfortunately java is useful since everyone else uses it
00:51chouserit's not working?
00:52maxhodakno
00:52chousergetting an error?
00:52maxhodaki'm just going to hardcode it for now and move on
00:52maxhodakjava.lang.ClassCastException: clojure.lang.ArraySeq
00:53chouserI'm happy to keep helping if you're not ready to give up.
00:53maxhodakhmm, ok
00:53chouserI would (prn string-args) and (prn (map read-string string-args)) ... paste them here to see if they look like what we're expecting.
00:55maxhodakso
00:55maxhodaki added both of those statements, and got one line printed back
00:55maxhodak(("010121" "12121"))
00:55maxhodakfor
00:55somniumthe build.xml is gone from contrib?
00:56maxhodakjava -cp myfoo-standalone.jar myfoo.run mymethod 010121 12121
00:56chousersomnium: yeah. read the readme for how to build with maven.
00:57chouserhuh
00:57maxhodaki just removed the (prn args) to see which line it corresponded to
00:58maxhodakit was (prn args), so (prn (map ...)) did nothing
00:58chousermaxhodak: get rid of the prns and try (prn (map read-string (first string-args)))
00:58chouserthe (prn (map ...)) probably threw the same exception you were seeing before
00:59maxhodakchouser: it did
00:59maxhodakso, that time it printed: (4177 12121)
00:59maxhodak(how did it get 4177 from 010121?)
00:59chouserhaha! octal!
00:59maxhodakhaha, yes
01:00maxhodakvery strange
01:00chouserso ... if you don't want that, then you don't want to use read-string
01:01chouseranyway, the problem was that string-args is apparently a list of arrays of strings or something, instead of just an array of string. so try (first string-args) in your Reflector call as well.
01:02maxhodaktrying (clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (first args)))
01:02maxhodakgot: java.lang.IllegalArgumentException: Unexpected param type
01:03chouserthat's probably because your method doesn't want strings, but that's what you're giving it.
01:04maxhodakhmm
01:04chouser,(let [method-name "charAt", impl "FooBar", string-args [["3"]]] (clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map read-string (first string-args)))))
01:04clojurebot\B
01:04maxhodakcan i do something like (map (meta double) (to-array (first args))) ?
01:04maxhodaker, #^double maps to (:tag double), right?
01:05chousersure. (map #(Double/parseDouble %) (first string-args))
01:05maxhodak%s/double/integer
01:05underdevarrgh! One last emacs problem... so close...
01:05underdev(add-hook 'closure-mode-hook (lambda () (paredit-mode +1)))
01:05maxhodakwhat's the purpose of the % in that statemetn?
01:06chouser,(let [method-name "charAt", impl "FooBar", string-args [["3"]]] (clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map #(Integer. %) (first string-args)))))
01:06clojurebot\B
01:06chousermaxhodak: #(Integer. %) is the same as (fn [x] (Integer. x))
01:06underdevis 'closure-mode-hook the hook for clojure mode?
01:06underdevparedit's catching in everything else
01:06underdevjust not clojure mode
01:07underdevwhich, of course, is the entire point
01:08maxhodak(clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map #(#^Integer %) (first args)))) -> java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String
01:09chouser#(Integer. %) ...that's a ctor call, not a type hint
01:09somniumunderdev: usually (add-hook 'clojure-mode-hook 'paredit-mode)
01:09maxhodakchouser: ok, will try that
01:11maxhodakchouser: finally! that worked.
01:11maxhodakwow that was way more work that it should have been
01:11maxhodak(clojure.lang.Reflector/invokeInstanceMember method-name impl (to-array (map #(Integer. %) (first args)))) to call a variably named java method
01:11underdevsomnium, thank you
01:12underdevsomnium: as i was pasting into #emacs, i realized i spelled "closure" and not "clojure"
01:12chousermaxhodak: now try it in Java. ;-)
01:12underdevdurr dee durr
01:12somnium:-)
01:13maxhodaklol
01:13maxhodakchouser: thanks
01:13chousermaxhodak: np. sorry for all the pain.
01:24underdev
01:24maxhodakchouser: hmm, so now i have to run a variably named fxn inside clojure
01:24maxhodakat least here i have a fixed arg length
01:24maxhodakmy naive (filters/'filter-name triples) is failing miserably
01:28chouser,((resolve (symbol "+")) 2 4)
01:28clojurebot6
01:59slyphonany vimclojure users at home?
02:44underdevLau, i had first installed clojure box, but being a geek i couldn't stand not knowing what was working and why. So i started from scratch, using a lot of the .emacs you posted on your blog. Thank you.
02:44underdevalso, i didn't want the win32 stuff, so the emacs i know is portable :)
02:45underdevi thought that .emacs was a screenshot, what did you use for the syntax highlighting?
02:48LauJensenGreat :)
02:48maxhodakhow do you set a method's return type to byte[] in gen-class :methods ?
02:58hoeckmaxhodak: maybe (Class/forName "[B") or bytes, not shure
03:01maxhodakhoeck: nope
03:01maxhodakhoeck: well, bytes tries to become java.lang.bytes rather than clojure.core.bytes
03:01maxhodakbut still get a class not found err for clojure.core.bytes
03:12hoeckmaxhodak: and what about "[B", at least compiles here, but I have no disassembler at hand to check it
03:18maxhodakgen-class :methods is basically a macro that's substituting in directly anything you enter
03:18maxhodakto java.lang.%
03:18maxhodakand byte[] doesn't work
03:18maxhodak(byte does, but then i get return value mismatches)
03:21LauJensenunderdev: Sorry missed your last line, syntax highlighting is done by Clojure-mode, colors are from charcoal-black color theme, conversion to html is htmlize
03:22hoeckmaxhodak: yes, but it seems that :methods expects classnames as strings
03:22hoeckmaxhodak: and "[B" ist the jvm-classname for byte[]
07:12ordnungswidrigping?
07:12clojurebotPONG!
07:40chousercemerick: http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/lazy_xml.clj#LID137
07:41cemerickheh
07:41cemerickthat's cheating, just a little bit :-)
07:42cemerickoh, wait
07:43cemerickchouser: sorry, I thought you were going from clojure.xml -> strings -> inputsource -> sax
07:44cemerickit's too bad about that .toCharArray call
07:50chouseryeah, it's a shame
07:50chouserbut at least it ought to be constant memory usage rather than O(n)
07:51cemerickyeah
07:51cemerickchouser: in this case, *out* is simply not appropriate IMO -- if it's a Writer, wonky things will happen if there's a mismatch between the writer's encoding and the encoding output property.
07:51cemericks/wonky/bad
07:52cemerickthe doc can provide the necessary warnings, but it's going to be a beartrap
07:52chouserok. there are other details to be improved as well. for example I think my concept of QName may be wrong for both tags and attrs
07:54chouserand indentation may not work on Java 1.5: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6296446
07:55chousercould emit pick up the encoding setting from *out*?
07:55cemerickchouser: yes, qname and localname are only the same if there is no declared namespace
07:56cemerickno, wait, qname and localname are the same if the elt is in the default namespace :-/
07:57cemerickwhich will always be the case until namespaces are supported in general
07:58chouserok. how clojure.xml will store namespaces is TBD. I've had some thoughts, but none that aren't a bit of a mess.
07:58cemerickyeah, that's something that can stew for a while IMO. It's fiendishly hard to get right.
07:59cemerickchouser: OutputStreamWriter is the only one that provides encoding info, and it can be wrapped. So, probably not.
07:59chouseris qname like "foo:bar" for localname "bar" and uri "http://blah.blah/foo" ?
08:00cemerickalmost
08:00chouserdepending on xmlns delcarations?
08:00cemerickright, the prefix is the ns declared name, not the last portion of the url or whatever.
08:00chouserright, ok.
08:01cemerickexcept! :-P
08:01cemerickns declarations can be made in any element
08:01chouseranyway, it was everything inside that (.transform ...) call that tortured me all evening.
08:01chouseryes, I know that. painful.
08:01cemerickso foo:bar could turn into blah:bar given a different ancestor for bar.
08:01chouserright
08:02chouserwhich is why, when parsed, each clojure.xml node should include a complete prefix->namespace map for that level
08:02cemerickwhy the #^void hint on parse?
08:02chouseror something.
08:03chousercemerick: reify requires hints on everything if you provide hints on anything, and requires hints on parse because there's more than one
08:03cemerickah, right
08:03cemerickfundamentally, you don't want to carry around prefixes at all -- I remember being deep into this when doing a lot of xml in python, and libs like lxml only carry around namespace URI's, never prefixes.
08:04chouserall of that is like a magic incantation. for example, that InputSource is never used, but if you don't create it .transform says it can't use the SAXSource
08:04cemerickto the point where they can't parse prefixed xml, and then emit it again with the same prefixes.
08:04chousercemerick: and that's good?
08:05cemerickI wonder if I can dig up the mailing list thread. Apparently, various XML wizards say it is, that prefixes (or any details of a particular serialization) are inconsequential.
08:06avarushi!
08:07chouserugh. I'd hate to see {tag: :http://foo.bar/a :attrs [:http://foo.bar/href "http://clojure.org"] :content [{:tag :http://foo.bar/b :content ["home"]}]}
08:12avarusI need coke
08:12chouser"a coke" I hope?
08:12avarusdon't ever say that at a spanish airport
08:12avaruslike I did
08:13avarusyes :P
08:13underdeva coke, and a smile
08:13cemerickchouser: found the "relevant" thread. See http://www.mail-archive.com/python-list@python.org/msg120086.html , but it starts at http://www.mail-archive.com/python-list@python.org/msg119559.html
08:14cemerickIt's a very long thread, and I couldn't find the money quote about how prefixes are irrelevant, but the first link points in that direction. And lxml is pretty highly-regarded, last I knew. *shrug*
08:15cemerickSo fundamentally, I think whoever adds namespaces to clojure.xml needs to have a sit-down with a dozen XML "experts" from various schools of thought before we make a move there.
08:16chousersounds like a formula for getting nothing done. :-)
08:16cemerickheh
08:16ohpauleezhaha zing
08:17chouser"A committee is a life form with six or more legs and no brain." --Lazarus Long
08:17avarus:P
08:17cemerickinsofar as XML is about interop, it seems like we should make sure we're meeting external expectations
08:17chousercemerick: but you're probably right. It'd be easy to do something that any number of them could have told you was wrong on its face.
08:18Chousukein general, the time required to make a decision is proportional to the number of decisionmakers
08:18cemerickChousuke: except that, there should be no decisions here -- only finding out what is acceptable and expected elsewhere
08:19chouserChousuke: that would be one thing, but if only the quality of the decision weren't so often inversely proportional...
08:20cemerickchouser: helluva spike, though. I need to float more ideas out there and see who else will do my work for me. ;-)
08:20chousercemerick: hehe
08:21chouserI'm a known sucker for such things among my friends. They regularly talk loudly about things they wished existed, hoping I'll take the bait. :-/
08:21chousercemerick: so are you interested in cleaning that up and submitting a patch for clojure.xml?
08:22cemericksure, I'll take the credit ;-)
08:22chouserwfm
08:22cemerickSeems that "" should be the namespace until we figure that out.
08:22cemerickwfm?
08:23chouserworks for me
08:23cemerickah
08:23chouseryeah, you're probably right.
08:23cemerickchouser: thoughts on *out*, etc?
08:24chouserthoughts, sure. solutions, not at all.
08:25chouserfor example, returning strings is inapporpriate when combined with an xml declaration that includes an encoding, right?
08:25chouserjust as bad as printing to an Writer that already has an encoding if the encodings don't match.
08:26cemerickright, we have to let the transformer drain to an outputstream-based StreamResult
08:26cemerickI'm inclined to have emit take an OutputStream, and punt on the *out* issue until someone figures out the right wrapper.
08:27cemericke.g. emit-with-out
08:27chouserbut does that mean casual use such as at a repl requires building an outputstream chain?
08:28cemerickwell, I can make emit into emit*, and have emit bind *out*
08:28cemerickso, yes :-)
08:28chouserhm. or perhaps add an option to take the outputstream
08:29cemerickin the optseq?
08:29chouserthat's what I was thinking
08:29chouserseriously, why does the SAX spec use char[] instead of a String? bleh.
08:30cemerickbecause it was designed by a language-agnostic committee and implemented transparently in java
08:30cemerickbut yeah, bleh
08:30cemerickhaving the outputstream in the optseq doesn't seem right. It's decidedly not a peer to :indent or :encoding, etc.
08:31chouserok
08:32chouserso two fns, one that emit's to *out* (with appropriate warnings about encoding) and one that takes an outputstream?
08:33cemerickI think so. Naming? emit and emit-with-out or emit and emit*?
08:33chouseremit-to ?
08:33cemerickah
08:33cemericksure
08:34chouserhm
08:34chouserwhat about allowing the user to pass in *out*, but printing a warning everytime when they do?
08:35cemericknot sure who wins in that scenario
08:35chouserok
08:36cemerickI'll have a ticket + patch up later today
08:37chouserthanks!
08:37cemerickthank you :-D
08:37chousercemerick: cgrand just responded on this subject from yesterday.
08:37cemerickwhere?
08:37clojurebotwhere is your source code
08:38chouserhttp://clj-me.cgrand.net/2010/02/10/why-enlive-templates-return-seqs-of-strings/
08:38cgrandon my blog, since "everyone" was asleep
08:38chouser:-)
08:39cemerickcgrand: how do you manage to get so much done when it's dark out? ;-)
08:39cemerickcgrand: did you catch what chouser put together?
08:46cgrandcemerick: I'm just back from lunch, and reading the logs
08:46cgrandI agree: prefixes are a serialization thing and should not be in the tree
08:47cemerickheh
08:47cemerickgood to have more confirmation on that
08:50cemerickcgrand: we'd have to set up a pipe from the outputstream that chouser's emit writes to an inputstream that could be passed off to ring/compojure, but I wonder what you think of it as a general replacement for enlive's emit?
08:53cgrandfor enlive it means that each serialization incurs a full traversal of the tree :-(
08:53cemerickindeed
08:54cemerickThe price we pay for using the stdlib.
08:56cgrandI guess one could cache seqs of sax events instead of strings for static nodes
08:57chouserring and definitely a specific environment -- perhaps it makes sense to have different emits for enlive vs. clojure.xml?
08:58cemerickcgrand: wouldn't those cached events be roughly the same size as the equivalent clojure.xml tree?
08:59cemerickI'd hate to see this not be generally applicable.
08:59konrI'm in a ->> form, and I want it to behave like -> in one step. Is there a more elegant way to do that besides something like (->> 3 (- 10) (#(%1 %2) #(- % 5))) ?
08:59underdevLOOK! ITS PERL!
09:00underdev:)
09:00konrhaha, almost :)
09:01cgrandon chouser's new emit: it's cool and I think there's real value in extracting the clojure.xml tree -> sax events transformer (eg for interop with DOM consuming libs)
09:02powr-tocwith the ns macro... is there a difference between (:use [foo.bar]) and (:use (foo.bar))?
09:02chouserkonr: when I'm in such circumstances I generally decide it's not worth using the ->> form anymore.
09:03rhickeycgrand: did you have any thoughts on ->/->> flipping and env arg to resolve?
09:03powr-tocOr rather... why does (:import (use lists)) and (:use [use vectors)) ?
09:03cemerickpowr-toc: the latter won't use anything, whereas the former will use foo.bar. The first element in a parenthesized :use is the prefix applied to all other elements in the :use form.
09:03chouserit's hard to argue that the transformer-based emit isn't better than what's in clojure.xml and lazy-xml now. Not sure about enlive though.
09:05cemerickI'd like to know what could be improved to make it usable by enlive. That's exactly the sort of use case that emit should fill.
09:05powr-toccemerick: not sure I follow...
09:06cemerickpowr-toc: parens in :use, :require, and :import treat the first symbol as a prefix. e.g. (:use (clojure.contrib def core)) (:import (java.util List ArrayList))
09:07powr-toccemerick: ok, what about vectors, do they have a different behaviour?
09:08cemerickpowr-toc: yes. See the docs for require and use for more info.
09:08cgrandrhickey: yep, I have problem with aliases (and there's the same problem in chouser's patch for -> and ->> destructuring): so I tried to 'resolve the symbol and see if this returns #'-> or #'->> but when the tested symbol is String. or .foo I get an exception. That's why I asked about fixing resolve. (or adding a resolve restricted to vars)
09:08powr-tocahh require... has a lot more docs than the others... I find the namespace docs a bit confusing, and dispersed.
09:09avarushow can I check if compojures (params :foo) and (params :bar) contains something != empty in an elegent way?
09:09cgrandcemerick: enlive's emit is optimized for _repeated_ serialization
09:09ordnungswidrigavarus: (not (empty?) (params :foo))
09:10ordnungswidrigavarus: is a number empty?
09:10avarusordnungswidrig: exactly how I am doing it now but how would you check more than one?
09:10avarusa number is not empty
09:10ordnungswidrigavarus: anyway (params :x) returns a string....
09:11cemerickcgrand: OK. I guess I would ask why -- at least in the context of ring/compojure, a template's tree is only ever serialized once, no?
09:11ordnungswidrigavarus: check a set of parameters?
09:11avarusordnungswidrig: e.g.? :)
09:11ordnungswidrigavarus: got me wrong. Do you want to check a set of parameters, say :foo :bar for not emptyness?
09:12avarusyes
09:12rhickeycgrand: but what you asked about 'fixing' was this.that, not this. or .that
09:12avarusbut in a short way, ordnungswidrig :)
09:13rhickey(resolve 'String.) is broken
09:13rhickey(resolve '.that) is harmless
09:14rhickeyI think you can fix the former without doing away with classname correctness checling
09:14rhickeychecking
09:14cgrandrhickey: true, my fault: I wasn't specific enough (as usual :-/) in defining what I wanted
09:15rhickeypatch welcome for (resolve 'String.) -> nil
09:15cgrandrhickey: ok, I create a ticket, attach a patch and update the patch for ->/->>
09:16ordnungswidrigavarus: (every #(-> % params empty? not) [:foo :bar]))
09:16avarusach du scheisse :P
09:16avarusok, I'll try it :)
09:16ordnungswidrigavarus: this is short for (every #((not (empty? (params %)))) [:foo :bar])
09:17ordnungswidrigavarus: "short" in a sense of "short of parens"
09:17avarusok :)
09:18ordnungswidrigavarus: i'd probably define some helper (defn param? [n] (-> n params empty? not)) and then (every param? [:foo :bar])
09:18ordnungswidrigor like that
09:22cgrandcemerick: when you define a template the serialization of its source tree is cached. When you call the template only "dirty" nodes are serialized. See, in my blog post, the difference between "<h1>This is a static title</h1>" and "<h2>" "Replaced dynamic title" "</h2>". Hence static parts are only serialized once: at definition time.
09:25cemerickah, see, I hadn't read your post yet :-/
09:26avarusordnungswidrig: big thanks! I think the example with the helpfer function is the most readable one
09:26avarushelper*
09:26avarusat least for me
09:27cemerickcgrand: Perhaps I've been using enlive "all wrong" then, but there is virtually no content in my templates -- everything is being injected from other snippets being pulled in from elsewhere, which have no cached serialization.
09:29cemerickWhere I'm going with this is, it seems that serialization of relatively small bits of static content is a minor issue, given that most of the serialization going on is over dynamic content.
09:30cgrandsnippet also performs pre-serialization (because snippet and template noth rely on snippet*: http://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L318)
09:30jcromartieI wonder how enlive compares (performance-wise) to things like ERB or JSP
09:31cemerickcgrand: right, I'd forgotten that.
09:31cemerickjcromartie: templating (regardless of the flavor) is almost always inconsequential to an app's perf
09:31jcromartiewell yeah, it's rarely a bottleneck
09:31jcromartiewhen my DB might take 200ms to respond
09:32jcromartiebut I'm looking at some serious scaling in the future
09:33cemerickcgrand: won't you have to abandon that approach entirely if enlive is to support different encodings and namespaces?
09:33cemerickjcromartie: heh, and that certainly won't depend on your templating system. :-)
09:33cemerickor your DB perf, for that matter
09:34cgrandcemerick: if one can make chouser's emit to work on fragments (I haven't checked yet) then it could be used by enlive without sacrificing the serialization cache.
09:34cgrandon encoding: no, I serialize to Strings not to bytes
09:35jcromartiehmm, this is interesting...
09:35jcromartie,(nil)
09:35clojurebotjava.lang.IllegalArgumentException: Can't call nil
09:35jcromartie,(let [x nil] (x))
09:35clojurebotjava.lang.NullPointerException
09:37cgrandnamespaces are a problem but I think I have a solution for serialization. The real pain with namespaces is how to integrate them in the selector syntax.
09:40jcromartiehttp://blog.n01se.net/?p=85 <- these should be made to be defaults
09:40djpowellxpath apis generally let you use prefixes in your selectors, but pass a prefix->namespace map for their interpretation
09:43cemerickcgrand: by fragments, I presume you mean seqs of strings that when concatenated, would result in a complete element. If emit were to work with such a thing, it would require reparsing the fragment into elements that would be used for the basis of the sax events. Not so great.
09:43cgrandno by fragment I mean an XML fragment
09:44cemerickcgrand: oh, just a clojure.xml tree?
09:45cgrandyes, I have to go
09:54jcromartieI'm trying to make a .cljrc.clj or something like that
09:54jcromartiewhat do you all do for such things?
09:56jcromartiei.e. a startup script
09:57devlinsfjcromartie: I think the convention is to include a user.clj in your classpath
09:57devlinsfAt least it used to be
09:57jcromartieI have seen a dozen different ways
09:57jcromartiemany of them incomplete or outdated
10:02jcromartieI'm just not sure how to mix my startup .clj with clojure.main and running a repl
10:03jcromartieas it seems that passing any arguments after clojure.main means that it just runs that script and quits
10:03chouseruser.clj doesn't work for many of the repl settings you want
10:04cemerickjcromartie: are you really running a repl from the command line?
10:04jcromartiecemerick: yes I am really running a repl from the command line
10:04jcromartieis that surprising?
10:04jcromartieI thought people did that
10:04chouserthe repl-launching script I use does: rlwrap java clojure.main -i ~/.clojure/repl-init.clj
10:05jcromartieah, I see user.clj in here http://clojure.org/getting_started
10:05cemerickonly hardcore hackers like chouser use a repl on the command line except as a last resort ;-)
10:05chouser...and then either -r or if foo.clj is supplied on the command line, -i foo.clj
10:05jcromartieI don't understand what's special about running a repl on the command line
10:05chouserI think I'm more "fuddy-duddy oldtimer" than "hard core hacker" :-/
10:06cemerickenclojure, inferior-lisp, slime, all provide better tools around the repl
10:06chouserjcromartie: everyone else uses IDEs or emacs
10:06jcromartieah yes
10:06jcromartiewell I am not running emacs on my servers (and yes I run my servers in repls)
10:06chouserand then go around posting questions when things break. :-)
10:06jcromartieheh
10:06jcromartiechouser: where are these -i and -r options documented?
10:07cemerickjcromartie: you don't have to run emacs or whatever on your servers -- just a repl-server, which is extraordinarily lightweight.
10:07jcromartierepl-server, eh?
10:07avarusjcromartie: I'm using emacs with clojure mode but still firing up the repl by hand :)
10:07chouserjcromartie: -h
10:07_fogus_What about if it someone like me who's too lazy to setup my IDE? Is that l33t also?
10:07cemerickjcromartie: in enclojure's case, a 200-line file that opens up a socketserver on a port that you can connect to.
10:07jcromartieyeah really I mean rlwrap with tab completion makes for a decent repl
10:08AWizzArdAnd for emacs you can just start the swank-server.
10:08jcromartieJLine is awful... it's just completely utterly terrible compared to rlwrap, and I think it has to do with a lot of why people don't like command line repls
10:08AWizzArdThen you can connect to it with your external emacs, over a ssh-tunnel for example.
10:08jcromartieI wish everybody would stop recommending it
10:08jcromartiehmm
10:08DeusExPikachu*sighs* snowed in again :)
10:08jcromartieDeusExPikachu: you must be in my neighborhood :)
10:09avarusI believed textmate was a good editor but it's not (for clojure :))
10:09jcromartieOK so still, what about these -i and -r options?
10:09avarussnow here, too :(
10:09DeusExPikachujcromartie, just woke up (a bit late) in Baltimore
10:09avarusI fucking hate snow (outside the nose)
10:09jcromartienot here http://clojure.org/repl_and_main
10:09jcromartieDeusExPikachu: I'm down the road in Frederick
10:09chouserjcromartie: -h
10:09_fogus_My heat pump looked like Han Solo at the end of Empire Strikes Back
10:09jcromartiechouser: ah you mean run clojure.main -h
10:10jcromartiefor help
10:10chouseryeah, I figured if I just kept saying the same cryptic thing over and over somebody would eventually get it.
10:10chouser:-P sorry
10:10ordnungswidrigposition in collection? (position [:a :b :c] :b) -> 1
10:11ordnungswidrigis there sth like that?
10:11ohpauleezI too run the repl from the command line
10:11ohpauleezvim + command line repl
10:11ohpauleezchouser and I are going to do an entire workshop at the first clojure con
10:11ohpauleez:)
10:11chouser,(#'clojure.main/help-opt 0 0)
10:11clojurebotUsage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*] With no options or args, runs an interactive Read-Eval-Print Loop init options: -i, --init path Load a file or resource -e, --eval string Evaluate expressions in string; print non-nil values main options: -r, --repl Run a repl path Run a script from from a file or resource - Run a script from standard input -h, -?, --help Print this help message and exi
10:11avarust
10:12avarus:>
10:12jcromartieclj -e '(+ 1 1)'; # yields Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.Exception: EOF while reading
10:12chouserohpauleez: what windowmanager do you use?
10:12chouserjcromartie: not with my clj it doesn't. mine prints 2
10:12ohpauleezRight now I'm using OSX with Awesome overtop
10:13ohpauleezbut I usually use Fluxbox or enlightenment
10:13jcromartiemy clj is very simple
10:13ohpauleezI'm really enjoying Awesome though. Awesome + OSX is turning out to be a total productivity enhancer for me
10:13jcromartieohpauleez: does Awesome require X?
10:13ohpauleezand I use screen extensively
10:13ohpauleezyes
10:13ohpauleezjcromartie: ^
10:14chouserohpauleez: I think when you have a helpful windowmanager (ion3 in my case), it helps simpler tools (like a command-line repl) become a lot more powerful.
10:14avarusohpauleez: are you on snow leopard?
10:14DeusExPikachujcromartie, cool, that's close, I'm at the wyman park area, west of Johns Hopkins Homewood campus, should have a clojure meet one of these days :)
10:14ChousukeAwesome would be great but it doesn't help with native OS X apps :/
10:14avarusa clojure meet lol :)
10:14ohpauleezchouser: I totally agree, ion3 is tiling, like awesome. Awesome allows floating too, so that's why I use it
10:14ohpauleezavarus: I am
10:15chouserion3 allows floating now too.
10:15ohpauleezohh, rad!
10:15avarusohpauleez: just curious...is it normal that snow leopard takes around 6GB after setup?
10:15avarusnot that I care
10:15avarusjust curious :P
10:15chouserI think what I want is tabs and tile-inspired floating. but now I'm way off topic.
10:16ohpauleezchouser: take a look into awesome when you have some time. It's like ion3 (as I remember it) + fluxbox
10:16ohpauleezhahaha
10:17avarusI use emacs as window manager *joking
10:17chouserI bet cemerick still uses a mouse to move his winodws around.
10:17ohpauleezavarus: total zing. But with 500 GB, I don't care so much
10:17ohpauleezhahaha, nicely done chouser
10:17cemerickchouser: screw that man, I wouldn't use a mouse. I use a trackball! So there! :-P
10:17avaruszing? :)
10:17chouserheh
10:18ohpauleeztrue story, Sometimes RMS stays with me when he's in Philly. And he uses emacs as his window manager, but edits emails in.... VIM
10:18avaruslol :)
10:18cemerickfor me, window managers : OS X :: emacs : <anything else>
10:18ohpauleezavarus: it's like saying, "touche". The full phrase is: That's a real zinger
10:19konrxmonad is very nice
10:19devlinsfSteve Balmer is my Windows Manager
10:19chouserxmonad's configuration system strikes me as an indictment of haskell
10:19jcromartiechouser: hah
10:20avarusohpauleez: ah thx :)
10:20ordnungswidrighmm, no indexof anywhere?
10:20DeusExPikachumaybe someone will make a clojure window manager?
10:20avarusthere's a perl window manager, so why not :P
10:20chouserDeusExPikachu: it's been started, though perhaps I'm not supposed to say that out loud.
10:20jcromartieI guess so
10:20DeusExPikachucall it xmacro
10:21ohpauleezhaha
10:21ordnungswidrig,((zipmap [:a :b :c :d] (iterate inc 0)) :b)
10:21clojurebot1
10:21jcromartiePROTIP: to doom your project to obscurity, start a window manager and name it after an abstract programming language feature
10:21ohpauleezhahaha, this has to be one of the funniest tangential discussions in #clojure ever
10:22ohpauleezchouser: look at what we started
10:22ordnungswidriganybody else using xmonad with emacs in viper vi emulation?
10:22ordnungswidrig*scnr*
10:22avaruslol
10:22ordnungswidrigi actually like it.
10:23konrordnungswidrig: Oh god, me too!
10:23konrordnungswidrig: are you using vimpulse, too?
10:24ordnungswidrigkonr: no, not heared of it :-)
10:24chouserfor block selection, right?
10:25konrordnungswidrig: it emulates many features of vim... see http://www.emacswiki.org/emacs-fr/vimpulse
10:25ordnungswidrigcurrently reading
10:25konrchouser: yes!
10:25chouserdabbled with it last time I gave emacs a chance
10:26ordnungswidrigblockselection i never use
10:26ordnungswidrigvisualmode i seldomly use
10:26jcromartieBTW, my ~/bin/clj is one line
10:26jcromartierlwrap java -cp src:resources:test:"$HOME/.clojure/*" clojure.main $@
10:26jcromartieand -e fails for whatever reason
10:27jcromartie(even without rlwrap)
10:27chouserhm. try "$@" instead
10:27jcromartiehooray!
10:28jcromartieI don't understand why, but that worked.
10:28jcromartieLovely.
10:28chousersh is a minefield. I had an expert pick over my clj script.
10:28konrThere is also viper-in-more-modes, which I'm currently hacking to allow the use of the leader key in clojure (eg " c" instead of "C-cC-c": http://pastebin.com/f32361732
10:28mattc58hello everyone. Question: I'm using Leiningen, and I'm trying to use the 1.2.0 versions of clojure and contrib. I'm having a problem when I try to use the clojure.contrib.string library.
10:28mattc58Two Java exceptions. 1 deals with missing class Replacement
10:28chouser$@ without quotes was like: java clojure.main (+ 1 2) ...three args instead of one
10:28mattc58the other deals with "Unable to pop operand off an empty stack" from string$replace_first_re
10:29mattc58any ideas?
10:30avarusbye :)
10:35_fogus_,((comp first rest) [1 2 3])
10:35clojurebot2
10:35_fogus_wrong window. :(
10:36ChousukeI think that's also known as frest
10:36Chousuke:P
10:36cemerick_fogus_: don't worry, I can never remember comp's order of application either. :-P
10:36Chousukeheh
10:36drewrcemerick: +1
10:36cemerickChousuke: that pointfree stuff in the disclojure screencast was scary as hell.
10:37_fogus_cemerick: ;)
10:37Chousukecemerick: yep :P
10:38ordnungswidrigcemerick: which screencast do you mean?
10:38ChousukeI'm more partial to point-freeness than I used to be, but it still needs to be used small amounts at a time only.
10:39cemerickordnungswidrig: there was a full disclojure screencast that focused on pointfree style, and the more realistic example at the end was crazy.
10:39cemerickEvery time I think I'll use partial, it ends up being longer than using #().
10:40Chousukecemerick: yes, but partial makes it look less noisy
10:40ordnungswidrigthanks
10:40DeusExPikachucemerick, don't have to mentally parse the #(), you'd know what partial does
10:40cemerickyeah, I can see that. I often have to drop the incoming arg into the middle of the parameter list anyway, so...
10:41DeusExPikachu*you'd
10:41cemerickI disagree *shrug*
10:41cemerickChousuke: maybe we're blub programmers.
10:42DeusExPikachumaybe it is more clear if you keep forgetting which end of the args it adds too
10:43DeusExPikachuI forget
10:43ordnungswidrigI wonder if there could by a shorter alternative to "partial" like (def ° partial)
10:43Chousukeordnungswidrig: well you can always do that yourself
10:44cemerickDeusExPikachu: I'm not *confused* by partial, it's just that it is often longer than using #(), and often is unusable (due to where an argument is going to be placed.
10:44devlinsfcemerick: What was scary?
10:44jcromartie(oh, and for whoever though I was crazy for running a repl outside of Emacs, the Rails folks think I'm crazy to run my dev server within Emacs!)
10:44ordnungswidrigChousuke: of course by point free code is already hard to read. using individual shortcuts makes it harder
10:44cemerickjcromartie: no, that's crazy too :-)
10:44DeusExPikachucemerick, I'm not saying you're confused at all, I'm only talking about readability tradeoffs
10:44jcromartieDANG IT
10:44cemerickdevlinsf: we're hating on pointfree :-)
10:44DeusExPikachuyou in third person
10:45ordnungswidrigDeusExPikachu: and then add flip to it to make pointfree more pointless
10:45devlinsfcemerick: Ah. To each their own
10:45cemerickyup
10:45AWizzArdWhat is fn* doing?
10:46devlinsfcemerick: And yes, I *do* code like that sometimes
10:46ChousukeAWizzArd: you don't need to know.
10:46ChousukeAWizzArd: fn is the *documented* special form :)
10:46AWizzArdChousuke: one of my macros expands into a fn*
10:47AWizzArdSo to evaluate its correctness (and it has a little problem) I need to understand this part.
10:47cemerickdevlinsf: I hear it's all the rage with people who do a lot of work with maths. Maybe once I learn a few things about stats, I'll come around. :-)
10:47ChousukeAWizzArd: think of it as fn
10:47AWizzArdWhat is the difference then?
10:47devlinsfcemerick: I also took WAY too much linear algebra in school
10:47ChousukeAWizzArd: fn is a macro implemented on top of fn*, which is implemented in Java.
10:47cemerickdevlinsf: oh, see, so you're damaged for life anyway ;-)
10:48_fogus_devlinsf: There is never too much linear algebra
10:48ChousukeAWizzArd: it shouldn't matter to you what fn does differently from fn*, since you're never supposed to directly use fn* (it might even go away someday)
10:48devlinsf_fogus_: You sure about that?
10:48ordnungswidrigcan clojure names be UTF?
10:48cemerickyes
10:48ordnungswidrigmy emacs warns on (def ⋅ comp)
10:48ChousukeAWizzArd: I suppose the fn macro handles destructuring and such.
10:49Chousukeordnungswidrig: yes they can
10:49cemerickordnungswidrig: whether your editor, etc are capable or not is another story
10:49AWizzArdChousuke: I am not using fn* directly. It just got expanded into my code ;)
10:49Chousukeordnungswidrig: check SLIME encoding. it's latin1 by default.
10:49ordnungswidrigChousuke: I see
10:49_fogus_devlinsf: Absolutely. Never too much linear and never enough stats :(
10:50cemerickheh, that's like mysql's collation default being set to swedish.
10:52devlinsf_fogus_: Then pay attention the next couple of weeks :)
10:54ghotli_so. monads. how did you achieve understanding? by using them? have a good book to suggest?
10:54jcromartieis there any work towards something ORM-ish in Clojure?
10:56tmountainjcromartie: http://github.com/duelinmarkers/clj-record
10:56chouserAWizzArd: try using macroexpand-1 instead of macroexpand
10:56jcromartieyay
11:03jcromartieI feel like models could be namespaces with attributes and relationships as simple functions.
11:03jcromartielike (customer/orders (customer/find-by {:first-name "john"}))
11:04jcromartieat least that's where I'm going with my code
11:08devlinsfjcromartie: I'd start thinking in terms of protocols. Somebody is gonna release a set of awesome CRUD protocols soon enough...
11:10jcromartiecan I use protocols in 1.1?
11:10jcromartiethey're not on clojure.org
11:10devlinsfjcromartie: No, they're going to be one of the defining features of 1.2
11:11jcromartieso we've got multimethods and protocols
11:11jcromartieare multimethods going to be "deprecated" or do they serve a different purpose
11:11devlinsfjcromartie: Some of both
11:12devlinsfprotocols will be a special case of multimethods
11:12devlinsfAt least conceptually
11:12ordnungswidrigdevlinsf: for single dispatch will there a differene regarding performance?
11:12jcromartieI can see a lot of confusion between all of these different ideas popping up...
11:13stuartsierraProtocols are faster than multimethods for single-argument type dispatch.
11:13devlinsfordnungswidrig: My limited experiments has shown them to be much, much faster
11:13devlinsf(Thanks stuartsierra)
11:13ordnungswidrigdevlinsf: protocols are faster.
11:13ordnungswidrig?
11:13ordnungswidrigOh, I see
11:14jcromartiewhere can I read about Protocols?
11:14jcromartiehttp://www.assembla.com/wiki/show/clojure/Protocols
11:14devlinsfOn the assembla page
11:14ordnungswidrigstuartsierra: is this because JVM does single dispatch?
11:14devlinsfAlso, doc defprotocol has a lot
11:15devlinsfThere is going to be a lot of work done explaining these concepts when 1.2 comes out
11:15pdkis there a release timeline for 1.2, betas etc
11:17stuartsierraordnungswidrig: yes, the JVM is very good at optimizing single dispatch
11:17jcromartieyeah really, and examples for where you would use one over another
11:18jcromartiewould be good
11:18stuartsierraI'm working on a book for Apress that will include a chapter on deftype/defprotocol
11:18cemerickstuartsierra: is this news, or have I not been paying attention?!
11:19ordnungswidrigstuartsierra: for multiple dispatch only on the type of the arguments, can this be reduced to single dispatch in some way to take advantage of this?
11:19stuartsierracemerick: It's been in the works for a while, but i haven't talked about it much b/c the publication date was uncertain
11:19cemerickstuartsierra: congrats, then, either way! :-D
11:19stuartsierraordnungswidrig: Yes, I demonstrated a macro to do this.
11:19stuartsierracemerick: thanks!
11:19jcromartieI hope people don't get caught up on the Java differences between reify and proxy
11:20stuartsierrajcromartie: proxy will be deprecated in situations that reify can support
11:20jcromartieit seems to me that you can't always use reify where you could use proxy
11:20ordnungswidrigstuartsierra: have a ghist / pastie?
11:20stuartsierrasomewhere...
11:21ordnungswidrigstuartsierra: just if you have it at hands, I'll google it else, if it's public
11:21jcromartiestuartsierra: like if you have a Java method that takes a subclass instead of just looking for an interface
11:21stuartsierraordnungswidrig: It's on paste.lisp.org somewhere
11:22stuartsierraHere: http://paste.lisp.org/display/93387
11:22stuartsierraCorrected version here: http://paste.lisp.org/+2023/2
11:24ordnungswidrigoh, thanks
12:01DeusExPikachudoes anyone have slime-edit-defun working correctly for a remote swank server, (possibly by using a properly configured tramp filename translator)?
12:04DeusExPikachuI got slime-load-file to work, but function defs in the lib/ directory are not being found
12:10cgrandrhickey: when you say "a version of resolve that takes the environment" you mean something like (resolve sym &env) and (ns-resolve ns sym &env) or a private helper ?
12:16joshua-choiWhat do special-form-anchor and syntax-symbol-anchor do? I just randomly found them in the docs...
12:19yuukiany bitc-ers in here?
12:19cgrandjoshua-choi: they are used to generate the fragment part of the url whe,n you do (doc if) for example
12:19cgrand,(doc if)
12:19clojurebotGabh mo leithscéal?
12:19cgrandĩf
12:19cgrand~if
12:19clojurebotPardon?
12:20joshua-choi-------------------------
12:20joshua-choiif
12:20joshua-choiSpecial Form
12:20joshua-choi Please see http://clojure.org/special_forms#if
12:20joshua-choiI see; that's what it does.
12:20joshua-choiWhy two functions, though?
12:21cp2http://www.wreck.devisland.net/ga/ neato
12:21cp2safe for work, of course
12:21cp2unless you want your productivity to go down :)
12:22cgrandjoshua-choi: reading #'doc source I would say that's beacuse they are also used as predicates
12:24rhickeycgrand: yes, but sym last
12:24joshua-choiI see...it seems to be that special-form-anchor is for those special symbols whose anchors are just their names, while syntax-symbol-anchor is for those symbols whose anchors are different than their names.
12:25cgrandrhickey: and &env first or second for ns-resolve?
12:25rhickeyafter ns
12:26cgrandok
12:26rhickeythanks!
12:42replacaI never cease to be amazed by the civil quality of the discussion in the google group!
12:59AWizzArdrhickey: some days ago we mentioned PersistentMultimaps. Do you still have an implementation of them flying around?
13:00rhickeyAWizzArd: never implemented, as I said, you can build them on maps of keys to sets
13:00AWizzArdThis is what I currently do, although it is pretty "manual" so far.
13:03LeafwAWizzArd: what is a multimap ?
13:03Leafwkeys to sets sounds like a normal construct, to me
13:03AWizzArdLeafw: A map onto which you can assoc maany objects with the same key
13:04AWizzArd(assoc mm :a 1, :a 2, :a 3) ==> {:a #{1 2 3}}
13:04LeafwAWizzArd: I see, you just want some sugar on it to make it easier, some sort of cummulative assoc
13:04rhickeyurk, default print-methods for deftype not desired for 'real' types defined with deftype
13:05AWizzArdLeafw: so to say
13:05AWizzArdrhickey: what are "real types" defined with deftype?
13:05rhickeyI'm coming around to thinking all this default map-like stuff should be stuck in a new defstruct built on deftype
13:05rhickeyAWizzArd: I'm working on persistent vectors defined with deftype
13:06AWizzArdOh! Wow, that sounds interesting
13:06AWizzArdWould be amazing to see them perform about as well as our current Vectors.
13:06rhickeyshould have just automatically printed as vectors, but aren't due to generated print
13:06rhickeyAWizzArd: I'm making sure perf is identical as I go
13:07AWizzArdAah, they print as #:Vector{ ... }
13:07AWizzArdamazing.. I remember that cemerick was very sceptical about the efficiency ;)
13:08cemerickAWizzArd: I was?
13:08AWizzArdyup :)
13:09AWizzArd1-2 months ago or so
13:09cemerickI doubt that, but whatever :-)
13:14cemerickrhickey: are all deftype classes serializable by default?
13:14rhickeycemerick: possibly
13:14rhickeyIOW, not thought about yet
13:15cemerickah
13:15cgrandrhickey: are you trying to specialize vectors by depth or reimplementing them as in Java?
13:15cemerickI mean, they appear to be already.
13:16rhickeycgrand: mostly as in Java. I'm not sure differing type by depth is a win, vs just switching to a switch instead of a loop in arrayFor
13:16rhickeycgrand: the target here is - same perf, plus maybe macroizing to gen vectors of primitives
13:17rhickeycgrand: only need a six-way switch, and can unroll the nested derefs
13:20cemerickrhickey: having serializable baked in to deftype + reify seems like the right thing to do IMO/FWIW. That's really been driven home for me by having to deal with session storage, etc. again.
13:22cgrandrhickey: still not considering having the last and the penult (for even-sized vectors) items as fields? :-)
13:22rhickeycgrand: no
13:26rhickeycemerick: well, when AOTed deftype gens stable names
13:26rhickeyserializing a reify though...
13:27cemerickyeah, we've been down this road a little before
13:33ericthorsenhow many books do we have in the KLP database now?
13:33qedKLP?
13:33ericthorsenopps wrong window
13:33ericthorsensorry
13:43qeddo i just have a really old paredit? I don'
13:43qedI don't have working {}
13:45qedit looks like i have 22 beta
13:56ordnungswidrigqed: I don't have them either!
13:56ordnungswidrigI have 22 from elpa
13:57ordnungswidrigsorry, I have 20 from epla
14:07qedhmm -- wish i could figure out how to use this library
14:08qedtechnomancy|away: I'm still getting that pesky json error and this is a complete re-install of OSX 10.6 (im speaking of leiningen (lein autodoc specificall))
14:08stuartsierraqed: what's the json-related error?
14:11qedstuartsierra: [null] #<CompilerException java.lang.ExceptionInInitializerError (json.clj:15)>
14:12qedtechnomancy seemed puzzled by this and could not recreate it a couple of weeks ago, but the issue still persists so I'm not sure what's the deal there
14:13stuartsierraqed: Which json lib is this? The latest clojure.contrib.json?
14:13qed1.1.0 i believe
14:13stuartsierrao
14:13stuartsierraok
14:14qedsorry should have specified that
14:14jcromartiewhat code is throwing that exception?
14:14qedim just running lein autodoc from the command line, autodoc is a dev-dependency, but it throws that error
14:15jcromartieoh nevermind sorry
14:15stuartsierraOk, that must be something in lein or autodoc; clojure-contrib doesn't contain a file named "json.clj" in 1.1.0
14:15qedhmm weird
14:16jcromartiewhat version am I looking at here http://github.com/richhickey/clojure-contrib/tree/master/src/main/clojure/clojure/contrib/
14:16stuartsierrajcromartie: current master
14:16jcromartieI see
14:17jcromartieduh!
14:17jcromartie(playing with tags)
14:17stuartsierraI think this file is the culprit: http://github.com/richhickey/clojure-contrib/blob/1.1.0/src/clojure/contrib/pprint/examples/json.clj
14:18stuartsierraLine 15 is the start of the ns declaration; that's usually the source of ExceptionInInitializerErrors.
14:18qednod
14:18qedmy guess is it is autodoc at fault
14:19qedim using autodoc 0.7.0 from clojars
14:21stuartsierradoes autodoc use/require clojure.contrib.pprint.examples.json ?
14:44cemericksheesh, I never knew refs were IFns
14:45cemerickI presume that's only an implementation detail?
14:45rhickeycemerick: it's not a promise yet, but seems to make sense for all reference types
14:45rhickeyflow through to contained val
14:45cemerickyeah
14:47cemerickrhickey: I'd suggest adding an 'unpack' fn to core once that becomes a promise (e.g. recursively derefing until you're out of turtles)
14:47rhickeycemerick: not sure about that
14:48rhickeyrefs of refs is a bit icky
14:48AWizzArdindeed :)
14:48cemerickrhickey: right, but sometimes one gets something that acts like an Associative, until you try to assoc on it, and discover it's a ref with a map in it.
14:49rhickey?
14:49cemerickI'm talking about a 3rd party lib that, it turns out, returns a ref OR a map from a particular fn.
14:50rhickeythat's crazy
14:50rhickeymixing values and refs
14:51cemerickindeed, but insofar as refs (and other reference types) can act like values in function position, it's going to happen
14:51AWizzArdrhickey: do you mean mixing the returned values?
14:52cemerickeven relatively good unit tests wouldn't catch that if someone was using (object :slot) instead of (:slot object)
14:53rhickeycemerick: I'm not going any further down that road
14:54rhickeywow, there's a lot to making a complete data structure for Clojure, even porting pvector is a pain :(
14:56AWizzArdwas it easier to do in pure Java?
14:56rhickeyAWizzArd: no
14:57AWizzArdBtw, pvector will only be of use with this special extension lib which is still not going to be included in Java 7 yes?
14:57rhickeybut pvector support 20+ interfaces
14:57AWizzArdoh
14:57rhickeyAWizzArd: different pvector
14:57rhickeyp = persistent
14:57AWizzArdAh, oki
14:58krumholtprogramming in clojure is fun! i just read that in stuart sierras book. it's in a book so it must be true
14:58AWizzArdYup :)
14:59the-kennyOhh this reminds me of my newest purchase :) *going to read now*
15:12LauJensenEvening team
15:15AWizzArdAh, hi the Lau.
15:17LauJensenMoin André
15:37AWizzArdAnyone here who has 16+ GB RAM at home?
15:38esjnot all in one machine...
15:38DeusExPikachuis various parts of the internet down for anyone here in the east coast?
15:38AWizzArdI mean a single box :)
15:38DeusExPikachufor some reason I can still irc, but google is down
15:39chousergoogle's fine here. I'm not on the east coast.
15:39cemerickAWizzArd: used to, in a sunfire box. Long since sold it.
15:39the-kennyDeusExPikachu: Google has started to morph to skynet
15:39DeusExPikachuwell, a lot is down, i'm guessing some DNS server
15:42AWizzArdcemerick: and today you have 8 GB?
15:42cemerickjust 4 in my macbook pro
15:42DeusExPikachui'm kinda boxed in internet wise, can someone give me an ip address of google?
15:42cemerickheavy lifting gets done in a distributed fashion nowadays
15:46AWizzArdcemerick: Google hosts its DB in memory.
15:46cemerickI can see that
15:46krumholtDeusExPikachu, for me google is at 74.125.39.99
15:46cemerickhard drives take a lot of power
15:47DeusExPikachukrumholt, thanks, looks like it is a DNS problem, I can connect
15:52ordnungswidrigDeusExPikachu: isn't irc udp based?
15:54DeusExPikachuordnungswidrig, maybe, why?
15:54chouserno, irc is tcp
15:56kotarakordnungswidrig: talk was udp based, IIRC
15:56ordnungswidrigkotarak, chouser: you're both right
15:58kotarakWhen I first saw the wave video, I though: wow, they've reinvented talk.
16:00ordnungswidrigkotarak: hehe talk was fun
16:01kotarakordnungswidrig: it still is. :)
16:31lancepantzi see some clojure projects with tests in project/src/test and some in project/test what's the standard there?
16:31lancepantzit looks like lein wants them in project/test
16:34the-kennylancepantz: I would recommend project/test
16:35lancepantzty
16:40jcromartiehow do you all actually run your tests?
16:40jcromartieI see clojure has a "main" test script
16:40jcromartie(clojure-the-project)
16:53patrkriskotarak: can I ask you a stupid question about the implementation of the new ClojureQL frontend? Just looking through the code now.
16:53kotarakpatrkris: go ahead
16:54patrkriskotarak: I'm looking at the function 'where' in frontend.clj (line 193 in the latest commit I pulled.) Where does constraints come from, i.e. where is the identifier constraints bound?
16:55kotarakpatrkris: easy answer: it's a bug. :]
16:55patrkriskotarak: ah... haha, great :)
16:55patrkristhought it was some magic happening :)
16:55kotarakpatrkris: messed up when changing the argument order.
16:55patrkrisalright
16:56kotarakpatrkris: I'm not in favor of such magic.
16:56patrkriskotarak: I didn't think so
16:56rhickeypersistent vector using deftypes (work in progress) http://gist.github.com/300895
16:56patrkriskotarak: I'm trying to read about monads (which you may remember I mentioned the other day) and thought clojureql could be a case study
16:57AWizzArdoho, definterface
16:57kotarakpatrkris: it's basically a state monad
16:58AWizzArdrhickey: this is indeed very interesting and helpful for me
17:03patrkriskotarak: the state is the query representation as it goes through various functions?
17:03kotarakpatrkris: yes
17:03kotarakpatrkris: eg. for SQL we have to collect the values which are finally replaced with ? as we go along.
17:07StartsWithKwhat will happen if my pom.xml is not valid and i push it to clojars? i created it manualy
17:08StartsWithKi can't break anything? don't want to some one gets mad :)
17:14sethsI'm struggling with the difference between bound-fn and bound-fn*
17:14sethsbound-fn* does what I expect
17:14seths(expected bound-fn) to do
17:15sethsit seems like the return value of bound-fn isn't immediately callable?
17:15Chousuke(doc bound-fn)
17:15clojurebotGabh mo leithscéal?
17:15Chousukehm :(
17:15sethsI read the docs
17:16seths,(doc bound-fn)
17:16clojurebotHuh?
17:16kotarakseths: bound-fn returns a new function, bound-fn* modifies an existing one
17:17kotarakseths: bound-fn is a convenience wrapper around bound-fn* + fn.
17:17sethsah
17:18Chousukebound-fn* modifies nothing :P
17:18kotarakChousuke: okok, it wraps an existing function
17:18chouserit "modifies" the way everything in clojure is "modified". you need quotes. :-)
17:31rhickeyyum, pvector of ints
17:31chouserpvector?
17:31rhickeypersistent
17:31chouserthis isn't in Java I hope?
17:31rhickeygood ol' vector
17:31rhickeynope
17:31chouseryay!!
17:31chouserints. cool.
17:32rhickeytwidling http://gist.github.com/300895
17:32rhickeytwiddling
17:32rhickeyjust seeing what needs to change from object version to primitive
17:32chouseroh, *that's* why you were asking about inline bit-shift.
17:32rhickeythe gist is objects
17:33rhickeyand is same speed as java persistentvec
17:33chouserbeautiful
17:35chouserso once you have pvec of objects and pvec of ints side by side, you'll write a macro to generate either from a type parameter? Or are they insufficiently similar?
17:36rhickeyright, very similar
17:36rhickeyjust a few hints different
17:36chouserfantastic
17:37jcromartieso MongoDB is fun, right?
17:37rhickeyreplacing ArrayChunk now
17:38chouserless design work here than in implementing the compiler in clojure.
17:39rhickeychouser: starting small, but the memory pressure of boxed numbers is killing us
17:39rhickeyI also want to experiment with the numeric changes I've talked about
17:39chouserkilling who? where?
17:40rhickeya big hassle and ugliness are all of the casts ti int
17:40rhickeychouser: killing anyone who wants perf, or has big data
17:40chouserok
17:40rhickeyeveryone is being affected, but can deal
17:40chouseryour number changes are about overflow, not literals being unboxed by default, right?
17:41rhickeyboth
17:41chouseroh, ok. hadn't heard about unboxed literals.
17:41rhickeya problem right now is the semantics of boxed/prim ar edifferent, even without unchecked-*
17:42rhickeyso literal 42 can't be treated as primitive
17:42chouserah, yeah. and upgrading a primitive isn't an option, so the path to consistency is overflow always an error.
17:42rhickeybecause that would pull it into primitive semantics
17:42rhickeyexactly - overflow is error - you want bigints, you ask for them
17:43rhickeythen same semantics boxed/non
17:44rhickeybut the vector experiment is interesting, as there are many cases where, for interop with the Object world, the values in a vec of primitives will be boxed on the fly
17:44chouserI mourn for _fogus_'s beautiful section on numerics. ;-)
17:44rhickeythat generates ephemeral garbage
17:45chousersure. what is demanding you enter the Object world?
17:45danlarkinfaster numerics is relevant to my interests
17:45rhickeybut avoids the horror show that is a vector of a million numbers being a million 24-byte objects with different addresses
17:45chouseryeah
17:45AWizzArdoh, why 24-byte objects?
17:45chouseroh, the object world of fn args and returns?
17:45rhickeychouser: map/filter/seq etc
17:45chouserah
17:45rhickeyright
17:46pdkjvm overhead?
17:46chouserAWizzArd: that's what an Integer is.
17:47AWizzArd20 bytes as package around the 4 bytes int
17:47rhickeybut we are on the threshold of a whole new wave of awesomenes when IReduce becomes a protocol. Then primitive vectors and strings can reduce internally without any boxing, or at least boxing trivially eliminated by escape analysis
17:48AWizzArdoho
17:48chouserooh
17:48chouserdoesn't that still require primitive arg/return?
17:49rhickeychouser: hotspot could see the object being built, passed, unboxed for use, reboxed, unboxed after return and get rid of all boxes
17:50chouserwow. that's "escape analysis"?
17:50rhickeyat least theoretically
17:50rhickeyyes
17:50rhickeybut boxed numbers stored in data structures inherently escape - will never be eliminated
17:51chouserok
17:53abrenkIs it idiomatic to have (doall (for ...)) if I need to use aset-byte on a Java array?
17:53chouserso you're already seeing the reduced memory usage of pvec of ints, even if there's not much speed advantage yet?
17:53chouserabrenk: you might look at amap
17:54chouser(doc amap)
17:54clojurebot"([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret."
17:54rhickeychouser: yes
17:58abrenkchouser: I'll think about if amap fits. Its a pretty complicated sequence comprehension (http://paste.lisp.org/+213K). At least for me. Still learning.
17:59chouserabrenk: that's just for speed. you can always start with an array, go through 'for', and dump it back into an array using 'into-array'
18:05chouserabrenk: sorry, I didn't look at your code. you might try 'doseq'
18:06chouserand I'm not sure there's any benefit anymore to using aset-byte over just aset
18:07maxhodakwhere is clojure.contrib.stacktrace?
18:07maxhodaki can't seem to find it in any obvious place
18:07abrenkchouser: Thanks for taking a look. It throws "argument type mismatch" if I drop "-byte". I'll look at 'doseq'
18:07maxhodaki keep getting class not found errors, and then i realized that its not even in the obvious place in github: http://github.com/richhickey/clojure-contrib/tree/1.1.x/src/clojure/contrib/
18:08chouserabrenk: yeah, you just need (byte (bit-and ...))
18:08maxhodakunder *any* branch
18:08chousermaxhodak: it got moved into clojure. clojure.stacktrace
18:08menguhi. after i build clojure with run
18:09mengushould i add its path to PATH or CLASSPATH etc?
18:09abrenkchouser: Okay, that works.
18:09maxhodakchouser: thanks. live doc (http://clojure.org/libraries) is out of date then
18:09arohneris there a way to tell whether you're in jar hell? I get the feeling my project is running two different versions of compojure.
18:10hiredmanarohner: do you have two different version of compojure on your classpath?
18:10jcromartieIs http://github.com/somnium/congomongo broken with Clojure 1.1.0?
18:11jcromartiesomnium: (use 'somnium.congomongo) => java.lang.IllegalAccessError: seqable? is not public (NO_SOURCE_FILE:0)
18:11arohnerhiredman: I don't think so, but I don't know for sure
18:11hiredmanarohner: well check
18:11somniumjcromartie: are you using lein to get it?
18:12jcromartieyeah
18:12jcromartieoh wait on
18:12jcromartieno
18:12jcromartieI built it with lein jar
18:12abrenkchouser: 'doseq' it is. That's what I was looking for. Much better than (doall (for ...)) and not using the return value...
18:15hiredmanmy guess is the problem is the rename in contrib
18:15somniumjcromartie: better to use lein deps and get it from clojars, the github repo takes a little rearrangement to build right now
18:15hiredmanhttp://github.com/richhickey/clojure-contrib/commit/4e7a55d4e7e899d29f725222495d752730584bdd#diff-2
18:16chouserabrenk: is that really to put a cycle of bytes into the array?
18:16chouseror have you simplified it for me?
18:16abrenkchouser: To give a little context: I'm re-implementing jBCrypt in Clojure as an exercise.
18:17chouser,(seq (into-array Byte/TYPE (map byte (take (* 4 8) (cycle [24 16 8 0])))))
18:17clojurebot(24 16 8 0 24 16 8 0 24 16 8 0 24 16 8 0 24 16 8 0 24 16 8 0 24 16 8 0 24 16 8 0)
18:18chousergotta go.
18:18abrenkchouser: I've pasted the Java version http://paste.lisp.org/+213K/3
18:19abrenkchouser: Okay, thanks for your help!
18:21hiredman~clojure
18:21clojurebotclojure is the brand
18:22jcromartiesomnium: ok thanks
18:22jcromartieI am doing that
18:23jcromartiesomnium: now, in MongoDB I have db.people
18:23jcromartiebut (mongo! :db "db") (fetch :people) doesn't return anything
18:23jcromartiethere are docs in there
18:23jcromartieI see the connection being established
18:23jcromartie(fetch-count :people) returns 0
18:23jcromartiebut from mongo, db.people.find() returns all of the people in my db
18:24somniumcheck (databases) and (collections)
18:24somniumdb name is people and collection is people?
18:24jcromartiedb name is db
18:24jcromartiecollection is people
18:25somniumwhat does (collections) return?
18:25jcromartiean empty HashSet
18:25somniumand (databases)
18:25jcromartie(databases) lists my databases though
18:26jcromartie#<ArrayList [test, admin, db, local]>
18:26jcromartiehmm, using :db "test" works
18:27jcromartieah, db is test in mongo
18:27jcromartieI don't quite get it
18:27somniumthe default db in mongo-shell is test I think
18:28jcromartieyeah
18:28jcromartieI see that now
18:28jcromartieweird
18:28jcromartieI was thrown off because I saw a db named db, and I was using db.people.save(...)
18:29jcromartiethanks :)
18:29somniumnp
18:30jcromartieI am excited about mongo, is there anything missing from congomongo I should be aware of?
18:30jcromartiemaybe keep an eye out or improve?
18:31somniumjcromartie: purcell added gridfs support, you can use his fork if you need it
18:31jcromartiek
18:31jcromartienot yet :)
18:31jcromartienot for my 5 documents
18:32somniumnumerous changes scheduled for a merge in some future semi-lost weekend :)
18:38grammatianyone know what happened to build.xml from clojure.contrib?
18:38grammaticlojure mode's clojure-install command wants it
18:40devlinsfgrammati: It's gone
18:40devlinsfcontrib went to maven a few weeks ago
18:40Raynesgrammati: Permanently.
18:42grammatiso I guess I should edit clojure-mode.el then, right?
18:43grammatiit's my first day with emacs, so that should be educational :)
18:43hiredmangrammati: clojure-install shouldn't be pulling and building contrib anyway
18:44hiredman(not that I know what it does, it just shouldn't do that)
18:45hiredmangrammati: what instructions are you following to setup emacs?
18:45Raynesgrammati: You should be getting clojure-mode from ELPA, and not using clojure-install at all.
18:45hiredmanhttp://technomancy.us/126 is the latest and greatest, I believe, and the clojure-install part is crossed out
18:46RaynesLeiningen, swank, clojure-mode, and swank-clojure-project (a swank-clojure command) is pretty canonical right now.
18:49jcromartiesomnium: do regexes work from congomongo?
18:49jcromartieit doesn't look like they do
18:53somniumjcromartie: they seem to here. (fetch :stuff :where {:content #"^foo.*"})
18:54somniumjcromartie: the mongo-java driver occasionally patches the java->js conversion, so may be some dark corners
18:55jcromartieah, nevermind, I was botching the case-insensitive flag
18:55jcromartielovely!
19:04grammatiok, so I did M-x package-install swank-clojure... now what? M-x slime starts a CL-USER> prompt, no clojure. what do I do next?
19:10sethsgrammati: try M-x swank-clojure-project
19:10seths(after killing *inferior-lisp*)
19:12sethsit will ask for a starting directory... I have only ever given it the root dir of a Leiningen project
19:13RaynesHe'll need to have his deps in the lib directory of the project folder, including swank-clojure.jar and Clojure itself.
19:14maxhodakuh
19:14maxhodakwhy are there a bunch of references to fruit in the clojure.contrib.sql doc?
19:14maxhodakdb-grade-range Usage: (db-grade-range min max) Print rows describing fruit that are within a grade range
19:14maxhodakand so on
19:14RaynesBecause fruit is good for you.
19:14maxhodak(db-read) Read the entire fruit table
19:15maxhodakdb-read sounds a little general for that
19:15maxhodaklol
19:15hiredmanthe docstrings most likely copied and pasted from some example that used fruit
19:16grammatiso I cant' just use the slime repl without creating some dummy project?
19:16hiredmanoh
19:16hiredmanintersting
19:17hiredmandb-read is from the test suite for sql
19:17maxhodakso, more srs question: how do you yield a query result out of with-query-results?
19:17maxhodaklike, (sql/with-connection conn (sql/with-query-results rs [query] (prn rs))
19:17maxhodaker, without the prn
19:17maxhodakjust throws a null pointer exception
19:17maxhodak(no parens around the rs at the end)
19:17hiredmanbecause the result is lazy
19:17maxhodakoh?
19:18hiredmanand the query is closed outside of the with-query-results scope
19:18hiredmanso you need to force it if you want to use it
19:18hiredman,(doc doall)
19:18clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
19:18maxhodakso
19:19technomancygrammati: you can, but you need to remove your old manual slime configuration first
19:19maxhodak(with-query-results rs [query] (doall rs)) ?
19:19hiredmanyes
19:20maxhodakhiredman: got java.lang.ClassCastException: clojure.lang.LazySeq
19:21maxhodakfor (sql/with-query-results rs [query] (doall rs))
19:21hiredman,(doc with-query-results)
19:21clojurebot"clojure.contrib.sql/with-query-results;[[results sql-params & body]]; Executes a query, then evaluates body with results bound to a seq of the results. sql-params is a vector containing a string providing the (optionally parameterized) SQL query followed by values for any parameters."
19:21maxhodakoh, wait
19:21hiredman
19:21maxhodaki think the error is somewhere else, 1 sec
19:22maxhodak(where i'm returning the rs to)
19:22maxhodakyeah, ok
19:22maxhodakhiredman: thanks
19:28grammatitechnomancy: I don't think I have any manual slime configuration. Did I mention it's my first day with emacs? I just did "sudo apt-get install slime". Is that wrong?
19:30technomancygrammati: oh, I see. yeah, you want to use either apt-get's version of slime or ELPA's; having both installed will confuse things.
19:30technomancyapt-get's version requires a fair amount of manual config; so I recommend using ELPA's only.
19:31grammatiok thanks, I'll try that
19:35grammatiok, now I've done "apt-get remove slime", rm'ed my .emacs and .emacs.d, reinstalled elpa, then used M-x package-install to get slime, clojure-mode, and swank-clojure
19:35grammatiand still no clojure repl. what am I missing?
19:37grammatiM-x slime gives me: "Searching for program: no such file or directory, lisp"
19:41technomancymust be some leftover CL-related slime configuration
19:46JonSmithi woah
19:46JonSmithso you have your classpath misconfigured
19:46JonSmithtry m-x clojure-mode
19:46JonSmithnot classpath
19:52herdrickquestion: is there a way already built to display an Image directly in a swank-clojure REPL?
19:52herdricki know that graphviz.emacs does this
19:53herdricksorry, that should be "graphviz-dot-mode"
19:55technomancyherdrick: I think it would require some elisp hacking; probably not doable in pure-clojure
19:55herdricktechnomancy: yeah
19:55herdrickok, thanks
20:25jcromartieclojure's immutable data types have spoiled me
21:52herdrickso, if in the swank-clojure REPL I type: javax.imageio.ImageIO/
21:52herdrickthen press <tab>
21:52herdricki get all the static methods for that class
21:52herdrick(maybe other static members, too)
21:53herdrickbut how do you get the signatures of those static methods?
21:53herdrickunlike with clojure methods, you don't automatically see the signatures in the minibuffer
21:54herdrickanother question about that: is there a way to explore for methods (functions attached to instantiated objects) of Java classes?
21:56dnolenherdrick: you can use SLIME to inspect javax.imageio.ImageIO to see all the signatures, not nice as being shown in the minibuffer but works well enough
21:56herdrickdnolen: oh? how?
21:58dnolenC-c I
21:58dnolenherdrick: ^
21:59herdrickoh! nice!
22:01herdrickthanks dnolen, that's perfect
22:02dnolenherdrick: np
22:05herdrickhmmm... I don't see constructors listed there
22:05herdrickis there a way to see constructors?
22:09dnolenherdrick: huh, dunno. If you really want access to all that info conveniently you might be interested in Bill Clementson's post about adding javadoc support to his Emacs. http://bc.tech.coop/blog/081120.html
22:10herdrickdnolen: ok, thanks
22:25cemerickMan, spending an hour with Java every week makes one really appreciate clojure.
22:26slyphonhah
22:29herdrickthis seems like it should be obvious, but I haven't found it: where is map-tree?
22:29herdrick i.e. (map-tree / [2 3 4 [5 [6]]]) would yield: (1/2 1/3 1/4 (1/5 (1/6)))
22:29herdrickor must i roll my own with a reduce?
22:33maxhodakso, i'm trying to debug a client library i didn't write that won't run at all. basically it's using (declare) to intern a symbol
22:33maxhodakand then referencing it before binding it to anything
22:33maxhodak(declare *with-open-stack*)
22:34maxhodak(when (and obj (not (some #{obj} *with-open-stack*))) (set! *with-open-stack* (conj *with-open-stack* obj)))
22:34maxhodakit dies on the first *with-open-stack*
22:34cemerickherdrick: it exists.....
22:36herdrickcemerick: great! i've got my own now... ;)
22:36herdrickwhat is it?
22:36herdrickwhat is it called, i mean?
22:40cemerickherdrick: I can't find it now, sorry :-/
22:41cemerickmy brain's gone to mush tonight
22:47herdrickcemerick: quite all right
22:47herdrickthanks anyway! :)
22:47herdricksurely it does exist, eh?
22:48cemerickyes, definitely. The fn I'm thinking of maps deeply into most any seqable data structure.
23:11Mecis there a (somefunc (range 10)) -> ((0 2 4 6 8) (1 3 5 7 9))?
23:12somnium,(separate even? (range 10))
23:12clojurebot[(0 2 4 6 8) (1 3 5 7 9)]
23:13Mecanything more general? may not be a seq of numbers
23:14hiredmanuh
23:14hiredmanhow could you be more generally than seperate?
23:14hiredmanyou give it the predicate to use
23:16Mecim not sure what predicate would take every other one
23:17hiredmanso you don't want something "more generally" you want something totally different
23:19somnium,(reduce (fn [acc [x y]] (-> acc (update-in [0] conj x) (update-in [1] conj y))) [[] []] (partition 2 (range 10)))
23:19clojurebot[[0 2 4 6 8] [1 3 5 7 9]]
23:20hiredman
23:20somnium=)
23:20Mecwell like (partial separate even?) is similar to what i want but that only works on a range of numbers, therefore i need more general?
23:21somnium,(separate (fn [[x]] (even? x)) (indexed (range 10)))
23:21clojurebot[([0 0] [2 2] [4 4] [6 6] [8 8]) ([1 1] [3 3] [5 5] [7 7] [9 9])]
23:22somniumoh, theres a simple way
23:22hiredmanMec: you want to split based on position (every other) seperate splits based on the predicate
23:23hiredmancompletely different
23:23somnium,(vector (take-nth 2 (range 10)) (take-nth 2 (rest (range 10))))
23:23clojurebot[(0 2 4 6 8) (1 3 5 7 9)]
23:25Mecthat'll work, thanks
23:26DeusExPikachuanyone here has arc-mode working with tramp in emacs?
23:42ivanhas anyone ported Twisted's Deferreds or something similar to Clojure?
23:43ivanthe general goal is composing asynchronous tasks
23:48ivanI guess I should probably use agents and add-watch before trying crazy stuff
23:49dnolenivan: or promise/deliver.
23:49ivanthanks
23:50DeusExPikachuok I give up with making tramp working with a slime!!!! sshfs worked first time with little hassle