#clojure logs

2009-12-11

00:00KirinDave1technomancy: Last time I tried to make a client for my katamari software… man that sucked. All the web libraries wanted to dump reqs into buffers, and it became very tedious.
00:00technomancyannoying from a coding perspective or from a UI perspective?
00:01technomancyonce you understand the APIs doing webby stuff is not bad: http://github.com/technomancy/relax.el
00:01technomancyheader/body separation could certainly be better
00:03KirinHometechnomancy: So does paredit mode work with erc? :)
00:03technomancyKirinHome: heh; I'm not *that* hardcore. =)
00:04technomancyjush show-paren-mode for blink-matching
00:04clojurebotfor is not a loop
00:04KirinHomeMan, paredit is the epic mode though.
00:04defni havent gotten very good with it yet
00:04KirinHomeM-r is like, the king of all commands.
00:04defnits kind of annoying to me tbh
00:04defnbut im probably just ignorant to its epic-ness
00:04KirinHomeit's really essential
00:05KirinHomeC-) and C-( are the most important commands, imho
00:05technomancysluuuuuuuuurp
00:06KirinHomeWow, it's windowed.
00:06defnthose give me "unbalanced parentheses" errors
00:06defnbut im clearly balanced
00:07KirinHomedefn: Try going in front of a sexp, then type (. Then type C-).
00:07defnokay that's awesome.
00:07KirinHomeYeah dude
00:07KirinHomeNow, you should have something like ( (sexp))
00:08defnive been tabbing through my whole form to get my indentation fixed after doing something
00:08defnyeah
00:08chouser%
00:08KirinHomePut the cursor at ( |(sexp))
00:08KirinHomeAnd hit M-r (another of my faves)
00:08technomancyKirinHome: I find myself using M-s a lot more than M-r
00:09defnthe just deletes everything in the scope of the paren you're in front of?
00:09KirinHomedefn: it raises the sexp you're on to a level up, and kills all surrounding sexps at that level.
00:09KirinHomeParedit mode is basically hotkeys for tree editing.
00:09devlinsfChouser
00:10defnah gotcha, cool
00:10defn<--young jedi
00:10chouserdevlinsf
00:10devlinsfhttp://fulldisclojure.blogspot.com/2009/12/uses-for-takedrop-while.html
00:10devlinsfAs promised
00:10KirinHomeSo, we can't let erlang get too far ahead
00:10KirinHomecompojure needs websocket support. ;)
00:10defnhaha
00:10defncompojure is a lot bigger than i imagined it would be
00:11defni wish the documentation was better
00:11KirinHomeThe master version is quite small.
00:11KirinHomeThere is talk of more, it seems.
00:12defni dunno, it's not "huge", but i thought it would be missing some of the stuff it has
00:12chouserdevlinsf: nice.
00:12devlinsfThanks :)
00:12chouserreminds me a bit of finger-tree applications.
00:12chouser,(into (sorted-map) {3 :a 1 :c 2 :b})
00:12clojurebot{1 :c, 2 :b, 3 :a}
00:13technomancysome dude who does screencasts contacted me about recording my the paredit screencast I wrote a script for
00:13devlinsfHmmm
00:13devlinsfInteresting. Never heard the term before
00:13devlinsfThe wiki article looks cool
00:14chouseroh, finger-tree? yeah, they're a hobby of mine. apparently. :-|
00:14chouser(doc subseq)
00:14clojurebot"([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"
00:14defndamn -- that's a bummer -- I thought I had this figured out with (append-spit (apply str (map #(print-doc %) (sort (keys (ns-publics 'compojure))))))
00:14devlinsfHuh
00:14devlinsfCool
00:15defntoo bad it only prints to the repl
00:15devlinsfSubsec returns a seq though, right?
00:15devlinsfsub-seq
00:15chouseryes
00:15devlinsfOkay
00:15devlinsfStill cool
00:15technomancyhiredman: I'll switch off bash right after 1.0.1
00:16defnis there any way to redirect (print-doc name) to append-spit?
00:16defnthe printed output i mean...
00:16chouserI think the double high-levelness of your functions is what's slowing down my comprehension. I just need to take the time to "get" it.
00:16devlinsfYeah, I'm still not 100% sure if I get it
00:16chouserdefn: (binding [*out* my-output-stream] ...)
00:16chouserdevlinsf: :-)
00:18devlinsfChouser: I'll try to have an intro doc ready by the end of the day tomorrow
00:18chousergreat, thanks!
00:19devlinsfI'l post it on my github to start.
00:20defnchouser: im not sure how to use that. this was my first thought: (binding [*out* (map #(print-doc %) (sort-ns 'compojure))])
00:20defn(append-spit (file-str "~/" "test.txt") *out*)
00:20KirinHomeHum, paredit mode seems to work fine..
00:20KirinHomeAhh, it doesn't if there are unmatched parens in thebuffer. that's too bad.
00:21defnsorry for all the questions -- i know they're a bit remedial compared to some of the other stuff going on in here
00:21chouserdefn: sorry, I can see how my post could be misleading. my-output-stream needs to be a Java text-outputing stream.
00:21chouserthe ... si where your code that does print-doc stuff would go.
00:24chouser,(use '[clojure.contrib.map-utils :only [deep-merge-with]])
00:24clojurebotnil
00:24chouser,(let [m {:a {:b [1, 2, 3, 4]}, :b {:c [5, 6, 7]}}] (deep-merge-with #(apply + %2) m m))
00:24clojurebot{:a {:b 10}, :b {:c 18}}
00:24chouserclearly an abuse of deep-merge-with.
00:26defnchouser: what's an example of a text outputting stream? I tried doing (let [stream (FileOutputStream)])
00:27defnerrr FileOutputStream.
00:28chouser(with-open [tmp-txt (java.io.OutputStreamWriter. (java.io.FileOutputStream. "tmp.txt"))] (binding [*out* tmp-txt] (print "hi")))
00:29chouseror use duck-streams from contrib
00:30defnchouser: ah-ha! with-out-writer im guessing
00:30chouseryeah, that looks good. just give it a filename.
00:31defn(with-out-writer "myfile.txt" (apply str (map #(print-doc %) (sort-ns 'compojure))))
00:31defnsomething like that maybe
00:32chouserhm, I think you're still misunderstanding what's going on.
00:32defngah
00:32defni dont need the apply str
00:32chouserprint-doc will print out to whatever
00:32chouserright.
00:33chouserbut you shouldn't use 'map' because you're using print-doc for its side-effect of printing to *out*
00:34chousereither wrap 'map' with 'dorun' or just use 'doseq' instead of 'map in the first place.
00:38defnchouser: thanks for all the patience again, finally got this working: (with-out-write (file-str "~/" "test1000.txt") (doseq [s (sort-ns 'compojure)] (print-doc s)))
00:38chouserdefn: looks great!
01:03defnhttp://gist.github.com/254019 <---I'm interested in turning this into an executable jar: java -jar doc-ns.jar "compojure" "~/path/" "filename.txt"
01:04defnI've placed that code in a new lein project with the proper deps setup in project.clj
01:04defni `lein compile`, and finally `lein uberjar`, running the jar doesn't do anything though, what am i doing wrong there?
01:08technomancydefn: did you set a :main key in your project.clj to match your main ns?
01:09defni didnt
01:11defnException in thread "main" java.lang.NoClassDefFoundError: doc-ns
01:11defnsays it can't find my class doc-ns, but that's what the ns is named
01:13technomancywhich step causes the exception?
01:15defnrunning the jar
01:17technomancyoh, you can't AOT namespaces that don't have a dot in them
01:17technomancynothing to do with leiningen
01:17defni did that actually -- (ns doc-ns.core
01:18technomancybut the exception says it's still looking for doc-ns without core
01:19defnthe earlier one yes, but while we were talking i edited the :main to be doc-ns.core
01:19defnand changed my doc-ns.clj to (ns doc-ns.core...
01:19defnthen lein clean, lein compile, lein uberjar
01:20defnException in thread "main" java.lang.NoClassDefFoundError: doc-ns/core
01:21technomancydid you move it to src/doc-ns/core.clj?
01:23defni did not, but now that i have it still gives me the same exception, i have a feeling im doing something stupid here
01:23defnsrc/doc-ns/core.clj => (ns doc-ns.core...., project.clj => :main doc-ns.core
01:26technomancyis core getting :gen-classed?
01:26defnyes
01:27defnhttp://gist.github.com/254026, http://gist.github.com/254027
01:27technomancydefn: trying a sample project uberjar righ tnow
01:28technomancyare you running the standalone jar?
01:28defnnot every time
01:28defni had exceptions on both, but let me try now
01:29defntechnomancy: could it be the '-'?
01:29technomancythe non-standalone jar doesn't contain clojure, so you can't run it with java -jar
01:29technomancydefn: oh, the files on disk need - replaced with _
01:29technomancyJVM limitation
01:29defnlike folder names?
01:29defnproject names? everything?
01:30technomancyI'm not sure if it's directories or just .clj files
01:30technomancyit might be everything that is inside a directory/jar that's on the classpath
01:30defn'cause currently i have core.clj, no '-'s, ill try to switch the dir name
01:31defndoc-ns/src/doc-ns/core.clj
01:31defnso that should be doc-ns/src/doc_ns/core.clj?
01:31technomancyI think so
01:31defni think that fixed it
01:31defnuberjarring...
01:32defnbah
01:32defnneed to change my main to doc_ns.core maybe?
01:32technomancyno, it only affects filenames IIUC
01:33defni think that i actually needed to do that
01:33defnException in thread "main" java.lang.NoClassDefFoundError: doc-ns/core
01:33technomancyjust try docns =)
01:34defn^^that's a good error, looks like it at least found the class, probably just my inept clojure mucking things up now :)
01:35defntechnomancy: thanks for the tech support, i would have never figured that out on my own
01:36defntechnomancy: do you know how id pass a cmdline arg like "compojure", and have it interpreted as 'compojure ? I was thinking (quote (symbol "abc"))
01:38technomancydefn: I think you just want symbol
01:40defnawesome, finally got this *beast* of an application running -- kind of sad to think of how long i spent writing an application to do this... lol
01:43defntechnomancy: thanks again for everything, cheers
01:43technomancynp
01:50pelotomdoes clojure have static type-checking?
02:35rlbpelotom: depending on what you're asking, probably not.
02:37pelotomrlb: is my question ambiguous?
02:38rlbclojure is dynamically typed, though you can provide type annotations that can help with performance.
02:39pelotomrlb: performance isn't my concern so much as deferring till runtime problems that could've been discovered at compile time
02:40rlbpelotom: then the answer to your question is a definitive no.
02:40pelotomrlb: ok, thanks
02:41rlbclojure is a lisp dialect.
02:45pelotomrlb: right, I wasn't sure if that precluded a static type system
02:48ajray2is there a decompiler for clojure?
02:52replacaajray2: not that I've heard of
02:56ajray2replaca: thanks
03:09LauJensenGoooood morning :)
03:51FossiLauJensen: vietnam?
03:51LauJensenYea I almost wrote that Fossi, but then remembered that is was 'spoken' in one of the most disgusting wars yet to be started by the US, so I just stuck with 'good morning' :)
03:52carkyou sure look like in a good mood =) good morning !
03:53LauJensenThanks
03:53LauJensenAnybody here know of a good free mailing list service, ale Googles but without the suck ?
03:54FossiLauJensen: well, a collegue of mine saw a few shops in vietnam selling it on t-shirts as merchandise
03:54Fossiso it can't be that bad ;)
03:54LauJensenFossi: If you labeled anything that men are willing to make money on as being 'not that bad' then......
04:07somniumanyone have any recommendations on nio/netty/nio for tcp/ip with clojure?
04:09somniumer mina, that was the third one
04:09vynetty is cool, imho.
04:11somniumvy does it offer a better api than nio?
04:11vysomnium: Easy to use I'd say.
04:11somniumvy: good enough for me then :)
04:12somniumcoffee and javadocs for breakfast
04:22piccolinoI thought it was hard to use Netty from Clojure, since it requires the use of annotations.
04:30somniumhmm, I just need a ByteBuffer and a socket really
04:30carkso why don't you use regular sockets ?
04:31carkmy understanding was that nio is only usefull with lots of connections
04:32somniumcark: what java package?
04:33carkjava.net
04:39eevar2cark: nio is supposed to let you offload a lot of the work directly to the os itself, meaning lower overhead. which probably won't matter a lot unless you have a ton of transfers going, as you say
04:42carkwhat's a java decompiler that will work on clojure AOT jars ?
04:43hiredmanclojure compiles to class files
04:43carkright
04:43hiredmanas does java, I doubt any decompiler will "work on" jars
04:44carkyou're nitpicking
04:44hiredman~google cljdb decompile
04:44clojurebotFirst, out of 2 results is:
04:44clojurebotCLJDB 0.3
04:44clojurebothttp://georgejahad.com/clojure/cljdb.html
04:44hiredmanI think that is the one, no web browser open
04:44carkit says that's a debuger
04:45carkbut thanks !
04:46hiredmanhmmm
04:47hiredmanah
04:47hiredman~google clojure decompiled
04:47clojurebotFirst, out of 1110 results is:
04:47clojurebotClojure Decompiled
04:47clojurebothttp://georgejahad.com/clojure/clojureDecompiled.html
04:48hiredmanso close
04:48carkah i tried this one already
04:48carki wouldn't go inside some of my nested namespaces
04:49hiredmannested?
04:49carki mean : it shows there is a cara.webtl but doesn't show what's under it
04:49carklike cara.webtl.bleh
04:50hiredmannamespace, like java packages are not a hierarchy
04:50hiredmancara.webtl is a name, and cara.webtl.bleh is a name
04:50carkwell it's presented like that in the gui of the program =)
04:50hiredmanthey have no connection except for the string representation
04:50carkworks for other namespaces
04:51hiredmanperhaps I misunderstand what you want
04:51carki want to see my class cara.webtl.bleh but that wont work, while i can see cara.data.trie
04:52carkthat's a bug in the decompiler as i know for sure the program works
04:53hiredmancara.webtl.bleh is a class or a namespace?
04:53carkwell it's a clojure namespace
04:53hiredman
04:53hiredmanand the decompiler works on classes...
04:54carkwell believe me it's not working ... each decompiler i'm trying is showing different stuff, sometimes exactly what i want, except for the one clojure namespace i'm trying to check
04:59tomojdoesn't clojure generate bytecode that java can't?
04:59carkah could be
05:00carkwell the whole point was to make sure the deocmpiled code wasn't too obvious, i can't even get to it so i guess it's ok
05:01hiredmanjvm bytecode is fairly high level
05:01carkright
05:02carkthe customer wants wome kind of licence key system
05:02tomojman I'm glad I don't have to deal with that shi
05:03carki warned him that it wouldn't be very secure
05:03carkhiredman : you mean to sidestep the classpath issues ?
05:03Licenser_licenser key systems are nonsense -.- the best I've seen use public/private key combos so to say 'signing' a license
05:03hiredmanI am not sure
05:04hiredmancark: I am looking in that direction, but I don't know enough about the issues to be sure if thise solution effectively sidesteps them
05:04carkLicenser: i think the customer just wants to make it non-obvious to copy the program
05:04carkit doesn't need to be rock solid
05:05hiredmanthere are obfuscators
05:05carkstill the cryptography stuff is a real pain
05:05hiredmanI don't think java even has support for say, signed jars
05:05hiredman(like on the clr)
05:05carkright, i couldn't get proguard to obfuscate my jar
05:05hiredman:|
05:06carklooks like i should be using a more recent version of clojure
05:12qedIs it possible to nest variables in a string for shell-out?
05:13qedlike (sh (concat "ps aux | grep " var))
05:13hiredmanwhy would it be concat?
05:14hiredmanis var a seq?
05:14tomojmaybe you want format?
05:14tomoj,(format "ps aux | grep '%s'" "foo")
05:14clojurebot"ps aux | grep 'foo'"
05:16qedyeah, (format), for some reason I thought that was Java only
05:16tomojstr works for your above though
05:16tomojbetter than (apply str (concat ...)
05:17qedyeah
05:18octehttp://paste.lisp.org/display/91938 <- shouldn't that create a set containing each line fromt he file?
05:19hiredmannope
05:20hiredmanthat creates a hash-set that contains a lazy-seq
05:20octeoh
05:20octewell, what would be a good way to do what i want?
05:20hiredmanhmmm
05:21hiredman,(apply conj #{} [:a :b :c])
05:21clojurebot#{:a :c :b}
05:21hiredman,(into #{} [:a :b :c])
05:21clojurebot#{:a :c :b}
05:22hiredman,(reduce conj #{} [:a :b :c])
05:22clojurebot#{:a :c :b}
05:22hiredmaninto is clearly to be prefered to reduce here
05:22hiredmanbut into vs. apply conj
05:22hiredmanhmmm
05:24hiredmaninto over conj
05:24hiredman,(into #{} [:a :b :c])
05:24clojurebot#{:a :c :b}
05:26octehmm
05:26octe,(first (into #{} [:a :b :c]))
05:26clojurebot:a
05:27hiredman,(type #{})
05:27clojurebotclojure.lang.PersistentHashSet
05:27hiredmannot sorted
05:27octeyeah
05:27octedoh, needs to trim every line in the file too
05:27hiredman(but you specified hash-set, which #{} is)
05:28octeyeah
05:28octedo not need sorted
05:34octedoes this look correct? http://paste.lisp.org/display/91939
05:34octei want to count number of unique entries lines in "in.txt" that do not exist in "before.txt"
05:36hiredmanlooks fine
05:41octeyup, seems to work, wrote a java version to verify
05:41octedon't trust my clojure skills yet :)
05:46Chousukeocte: you can use sets as predicates
05:47Chousukeocte: the (filter #(not (contains? old %)) ...) can be simplified to (remove? old current)
05:47Chousukeoops
05:47Chousuke-?
06:00octeChousuke: cool
06:13octeChousuke: Unable to resolve symbol: remove? in this context
06:13octeis that a new function?
06:13octerunning clojure 1.0
06:13LauJensenremove the ? :)
06:13LauJensen,(remove even? (range 10))
06:13clojurebot(1 3 5 7 9)
06:14Chousukeocte: yeah, I made a typo
06:15sidshow do I create a nil of a certain type? I'm trying to use this constructor from clojure: http://weka.sourceforge.net/doc/weka/core/Attribute.html#Attribute(java.lang.String, weka.core.FastVector)
06:18Chousukeyou don't need to :/
06:18Chousukeoh but hm
06:18Chousukeuse a type hint
06:18qedWhat's a good way to get directory listings in clojure? Specifically I'd like to recursively filter filenames that math #"foo"
06:18octeChousuke: thanks, worked
06:18Chousukesids: #^FastVector nil
06:19ChousukeI wonder if that works...
06:19sidsChousuke: tried that, but it isn't working
06:20ChousukeHm. might not be possible.
06:21Chousukethis could be considered a defect.
06:21ChousukeCan you work around it? pass some non-nil value?
06:22Chousukeor maybe make a function that is type-hinted as returning a FastVector and then return nil?
06:22sidsChousuke: unfortunately, no. the constructor's behavior changes depending on whether null is passed or not
06:22Chousuke#^FastVector ((constantly nil))?
06:23Chousukeor (let [x nil] (... #^FastVector x))
06:23qedis there a function in closure to get a directory listing, or is that (sh) material?
06:23Chousukeqed: you should be able to use java for that.
06:23Chousukeqed: might be something in contrib for it too
06:23sidsChousuke: thanks, but none of those work :(
06:23qedshell-out works
06:24Chousukefile-seq or something :/
06:24Chousukeqed: see the File class anyway
06:24ordnungswidrighi all
06:26sidsChousuke: figured it out! type-hinting the first as well as the second arguments works
06:30qedChousuke: like (def mydir (java.io.File. "~/"))?
06:30qedHow do I get the listing on that mydir object?
06:31Chousukeqed: read the docs :)
06:31qedahh, nvm, (apply vec (.list directory))
06:32qedsorry, something of a java newb
06:32Chousukethe javadocs are pretty good.
06:32Chousukedon't need to know much java to understand them, either.
06:34qedone question i have is: once I do something like (map #(str %) (.list directory)), ive basically lost my ability to use .isDirectory on those elements, yes?
06:34esjprobably out of place, but file-seq might be helpful ?
06:34Chousukeyes.
06:35Chousukealso #(str %) == str
06:39qedesj: thanks a lot for that, i didnt know that was in core
06:40esjqed: np.
06:43tomojwhen you use file-seq, do you just get the file and all its descendents with no way to, say, just get 1 level of the tree?
06:44esjdunno, never actually used it.
06:44tomojseems a tree-seq is just a lazy seq
06:44tomojso I think what I said is true :/
06:46tomoj(seq (.listFiles ...)) seems to work for just 1 level
07:06qedtomoj: yeah file-seq does the recursive thing for you
07:07qedand (.. directory list) did exactly as you say, the top level
07:07qedit wouldnt be too hard to do the whole thing, but id rather use clojure where I can
07:07qedwhole thing in java*
07:07qedim determined to be good at clojure
07:08qedbecause im secretly avoiding java
07:10octejava, or at least the library, is an asset to clojure
07:11qedocte: i know i know, im just being petty and biased
07:11qed:)
08:41qedweird, for some reason I get a nullpointer exception on (doseq [s (sort (keys (ns-publics 'clojure.contrib.duck-streams)))] (print-doc s))
08:41qedbut not for the same statement with 'compojure
08:41qedboth are have been (use'd)
08:44qed,(sort (keys (ns-publics 'clojure.contrib.duck-streams)))
08:44clojurebot(*append-to-writer* *buffer-size* *byte-array-type* *default-encoding* append-spit append-writer copy file-str make-parents pwd read-lines reader slurp* spit to-byte-array with-in-reader with-out-append-writer with-out-writer write-lines writer)
08:45qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.duck-streams)))] (print-doc s))
08:45clojurebotjava.lang.NullPointerException
08:45qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.duck-streams)))] print-doc s)
08:45clojurebotnil
08:45qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.duck-streams)))] s)
08:45clojurebotnil
08:46qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.duck-streams)))] (str s))
08:46clojurebotnil
08:47qedweird stuff -- i wonder why
08:48qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.str-utils)))] (str s))
08:48clojurebotjava.lang.Exception: No namespace: clojure.contrib.str-utils found
08:48qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.seq-utils)))] (str s))
08:48clojurebotnil
08:49qed,(doseq [s (sort (keys (ns-publics 'clojure.contrib.seq-utils)))] (print-doc s))
08:49clojurebotjava.lang.NullPointerException
08:49qedgrr
08:51hoeck1qed: try (vals (ns-publics ..))
08:52hoeck1qed: print-doc wants a var, not a symbol
08:52qedwhy would it work on compojure, but not duck-streams?
08:53chouser,(meta (first (keys (ns-publics 'clojure.contrib.duck-streams))))
08:53clojurebotnil
08:54hoeck1qed: maybe compojure adds some extra metadata somewhere?
08:54carkcompojure has some magic
08:54chouserI think it's the lack of metadata that's the problem.
08:54carkit uses a macro to bring symbols from other name spaces
08:56qedthat works great hoeck1 && chouser
08:56qedthanks
08:56qedclojure.contrib.duck-streams/*byte-array-type*
08:56qednil
08:56qedthat's probably why it blew up
09:14tomojwhat is syntax-symbol-anchor for?
09:14tomojI can't get it to return anything but nil
09:15tomojoh, I see
09:15ordnungswidrigre
09:25hellooh dear. ejabberd's mod_irc is strange....
09:32danishkirelHi. I have a recursive function. I want it to use a memoized version of itself for recursion. I know how to du it with vars (declare ...) but can I do this with a function created inside a letfn?
09:34danishkirelHere is the code. It's something like the Levenshtein distance: http://gist.github.com/254237
09:34esj(def x (momoize x)) ?
09:34LauJensenhehe
09:35esjs/momoize/memoize
09:35LauJensenthats a fun read :)
09:35LauJensen(filter even? (map inc (range 10
09:35LauJensen)
09:35LauJensen)
09:35LauJensen)
09:35danishkirelThe memoization of measure works great but match won't use it's memoized version internally.
09:36esjyeah, i see you tried that *blush*.
09:36chouserdanishkirel: that's a good question
09:36danishkirelAnd I just don't know how to accomplish that while still using letfn
09:37tomojwould using a binding instead of a let work?
09:37chouserbindings work on vars, not locals like let and letfn.
09:38danishkireltomoj: That was my first thought but then clo...
09:38danishkirelYeah. What chouser says.
09:38danishkirelDynamic binding was my first thought.
09:38clojurebot:|
09:38chouserhuh. really a good question.
09:39chouserI think a full-on letrec might do it, but we don't have that.
09:39tomojwell if you think it's a good question, that's my signal to give up and go back to doing what I was doing :)
09:40danishkirelMaybe it just isn't possible?
09:41danishkirelWell I already know how to get it done but that will break the beauty of my code :(
09:43chouseractually, even letrec wouldn't do it, I think.
09:44scgilardiI think mutation is necessary which locals can't do.
09:44chouserin order to use the existing memoize function, you need ... right, mutation.
09:44chouseryou could have a memoizing macro that might do in this case.
09:45scgilardiyou can use an atom. let it to (atom nil), define the function in terms of calling the value of the atom, then swap the memoized version into the macro.
09:45scgilardis/macro/atom
09:46chouser,(macroexpand-1 '(letfn [(foo [x y] foobody)]))
09:46clojurebot(letfn* [foo (clojure.core/fn foo [x y] foobody)])
09:46scgilardihow do I find out where we paste?
09:46danishkirelThen I'll simple (declare memoized) (defn unmemoused [] ... (memoized ...)) (def memoized (memoize unmemoized)
09:46chouserlisppaste8: url?
09:46lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:46scgilardithanks
09:49LauJensenI haven't followed the discussion, but it looks like a case for transients ?
09:50lisppaste8scgilardi pasted "use memoize func with locals (atom)" at http://paste.lisp.org/display/91944
09:53danishkirelscgilardi: That looks interesting. Especially it looks like it will work.
09:53scgilardichouser: thanks for updating my ticket with the commit id. I'll do that next time.
09:54chouserscgilardi: I don't think it's a big deal either way, but I happened to have the ticket open when I dug up the commit id, so I thought I might as well add it.
09:54chouserscgilardi: if you put "ref #<ticket>" in the commit comment, assembla will do it for you.
09:55chouserscgilardi: or you put "fixes #<ticket>" and it'll put a github link *and* close the ticket for you.
09:55scgilardiok cool, thanks
09:55scgilardieven better
09:57danishkirelAwesome! sigilardi - You are my hero for the day!
09:57danishkirelWorks great.
09:58scgilardiExcellent! Enjoy.
09:59danishkirelFrom 35 sec to 1 msec for my testcase :D
10:02scgilardiwow, cool. and (depending on the application) it can be really important that the cache used by the memoized function starts fresh with each call to the function that contains the let rather than being kept around forever.
10:18cemerickdysinger: what's the issue with using AOT'ed libs?
10:18dysingermakes it a PITA to try different branches of clojure
10:18dysinger(new)
10:18dysingereverything breaks
10:18dysingerworks fine if you don't AOT though
10:19dysingerI had to rebuild our whole chain
10:19dysingerwith AOT off
10:19cemerickoh, OK, figured there was a real problem :-) That's just a side-effect of the churn when living on the edge
10:19dysingerso I could flip back and forth
10:19dysingerheh
10:19dysingerWell it is kind of a problem IMO
10:19dysingercode that could work perfectly fine with a newer clojure doesn't
10:19chouserpprint is the main one that currently really requires AOT
10:20dysingery
10:20chouserI never used to build contrib at all
10:20cemerickI don't think it's reasonable to say that AOT'ed libs should be portable across significant clojure revs. Maybe once core has really settled in, but not now.
10:21dysingertrue
10:21chouseroh, goodness, no.
10:21dysingerThe issue I am having is that if you are using a repository (and you should) like clojars or build.clojure.org or etc, that all those AOTed and uploaded jars break
10:22chouserbinary compatibility of class files isn't a problem I'd want anyone spending much time on.
10:22dysingerYeah - it's boring work
10:23cemerickstuff like this is why we continue to use an internal build, despite the strong pull from build.clojure.org. Maven can probably be coerced into locking into a particular snapshot, but I haven't touched that particular knob yet.
10:24dysingercemerick: you can use the slim jar
10:24dysingerthat's what I am doing now for clojure (new) & contrib
10:24chousercemerick: what would be the benefit of using build.clojure.org?
10:24dysingersnapshots
10:24dysingeranytime github changes
10:24cemerickyeah, staying closer to the edge, not having to maintain our own repo, etc.
10:24chouserI just use a sha1
10:25chouserfor my cmake build files. :-|
10:25cemerickdysinger: many, many moons ago, I discovered that using the slim jar is a no-go in certain environments, because of dynamic classloading buggaboos. I should revisit that, as I'll bet the situation has improved.
10:26lisppaste8cgrand-i'm-not-there annotated #91944 "old-school explicit self" at http://paste.lisp.org/display/91944#1
10:26dysingerhrm
10:26ordnungswidrigre
10:26dysingercemerick: I'll watch out for that. All tests are passing with slim and (new) branch
10:27chouserheh. cgrand reading via bot and posting via paste.lisp.org.
10:27cemerickdysinger: AOT'ing everything is a habit I gained in the very early days that I might just need to get over.
10:28cemerickI'd still insist on AOT for anything being shipped out though --- someone with a super-locked-down java security policy wouldn't be able to load any .clj files.
10:28dysingerI am not saying I have the answer - I just found that trying new branches of clojure breaks the entire build chain if that chain is AOTed
10:31cemerickactually, that whole issue should probably simply go away once c-in-c is a reality
10:31cemerickhrm. Too many qualifiers in there. :-P
10:32ordnungswidrigis java.lang.string#split the idiomatic way to split
10:35devlinsfordungswindrig: Check out str-utils2 in contrib
10:35chouserordnungswidrig: I prefer Pattern split, or str-utils2
10:35chouser,(.split #"/" "one/two/three")
10:35clojurebot#<String[] [Ljava.lang.String;@15e64c7>
10:35chouser,(seq (.split #"/" "one/two/three"))
10:35clojurebot("one" "two" "three")
10:36ordnungswidrigchouser: oh, I flipped the arguments to split, no wonder I get strange results
10:37chouserwell, string has a split too, but it takes a string instead of a regex.
10:37ordnungswidrigchouser: now, String#split takes a regex
10:37_fogus_,(re-seq #"\d" "1/2/3")
10:37clojurebot("1" "2" "3")
10:37_fogus_Another approach from a different angle
10:38ordnungswidrigre-seq is on contrib?
10:39chouserclojure.core
10:41ordnungswidrig,(re-seq #"\s" " 1 2 3")
10:41clojurebot(" " " " " " " " " ")
10:41ordnungswidrighuh?
10:41chouserre-seq is returning what matches, so a sort of inverse of split.
10:42ordnungswidrigchouser: i see
10:42chouser,(re-seq #"\d+" " 1 2 345 6")
10:42clojurebot("1" "2" "345" "6")
10:42ordnungswidrig,(re-seq #"[^\s]+" " 1 2 3")
10:42clojurebot("1" "2" "3")
10:47drewr,(re-seq #"\S+" " 1 2 3")
10:47clojurebot("1" "2" "3")
10:50ohpauleezwhat is reverse filter called again?
10:50ohpauleezI want to filter a vector, but get all the items that fit a condition
10:51chouserremove
10:51_fogus_ohpauleez: some
10:51ohpauleezthanks guys
10:51chouserohpauleez: actually, that sounds like you want 'filter'
10:51_fogus_ignore me
10:51ohpauleezlet me hit the repl and double check
10:51ohpauleezit might be that I did somethign wrong elsewhere
10:52chouser,(filter odd? (range 7))
10:52clojurebot(1 3 5)
10:53ohpauleezyes, I just spotted the other bug I introduced
10:53ohpauleezthanks chouser
10:55rullie,(range 7)
10:55clojurebot(0 1 2 3 4 5 6)
11:17ordnungswidrighmm, how do I join a lazyseq of strings to a string?
11:20stuartsierra,(apply str '("a" "b" "c"))
11:20clojurebot"abc"
11:21rhickeyeveryone ok on latest new branch?
11:22stuartsierraHaven't had time to really look at it, sorry.
11:22stuartsierraStuck in C-land right now.
11:22ordnungswidrigstuartsierra: "clojure.lang.LazySeq@467bcfd"...
11:23stuartsierraordnungswidrig: The lazy sequence has to be the last argument to apply.
11:23ordnungswidrigstuartsierra: yes, and I better actually type "apply" :-)
11:23ordnungswidrigstuartsierra: and do not omit it
11:25hoeck1rhickey: yes, everything ok, one question, should it be allowed to overwrite the default implementation of ILookup in deftype?
11:26rhickeyhoeck1: yes it should, because how else could you use deftype to implement PersistentHashMap?
11:26ohpauleezrhickey: I haven't had time to play with it, but I'm going to dig in over the weekend
11:27ohpauleezis there any desire for setting up continuous integration
11:27rhickeyohpauleez: like: http://build.clojure.org/
11:27rhickey?
11:28ohpauleezI have two machines I'd be more than happy to put up (MBP Dual Core, Linux single core)
11:28ohpauleezyeah like that, but across multiple machines and architectures
11:29ohpauleezI'd be happy to set one up over the weekend and host it myself just for your own feedback
11:29rhickeyohpauleez: differences on platforms/architectures are very rare for Clojure itself
11:29ohpauleezbecause of the JVm
11:29ohpauleezright, nvm :)
11:32hoeck1rhickey: now it works as expected, thanks
11:33drewrrhickey: do you feel like the syntax of defproto/deftype/extend-* has stabilized?
11:33rhickeyhoeck1: of course, once you've done that you lose keyword-based field lookup. You can still get at the fields externally using the interface clojure.lang.IDynamicType for now
11:33rhickeydrewr: ues
11:33rhickeyyes
11:34rhickeydrewr: why, wanna write some tests? :)
11:34rhickeytests for letfn and case also desired
11:35drewrrhickey: love to! first I want to build on it in something non-trivial :-)
11:36leafwwould be nice also to see non-trivial examples of defprotocol, deftype and reify. IS there any project repository with some, somewherE?
11:38hoeck1rhickey: what about direct access to the deftypes fields using (.field mytype)?
11:38drewrhoeck1: how is that better than (:field mytype)?
11:39rhickeyhoeck1: yes, that too, in code that knows the type by name
11:39rhickeyotherwise beware of reflection
11:40rhickeydrewr: we are talking about the case where a deftype takes control over ILookup itself, thus turning off (:field x)
11:44cemerick<rant>So J2EE 6 removes the web.xml requirement (yay!) and offers as a replacement....annotations! *facepalm*</rant>
11:46ordnungswidrigcemerick: yeah! annotations is the new xml.
11:46cp2cemerick: next stop... annotation in xml format ^_^
11:51devlinsfcp2: No no no no... It'll just be a bunch of POJOs & EJB4!
11:51cp2hah
11:54ordnungswidrigpfft, (let [x (fn [bah] (form)] ...) or (let-fn ...) ?
11:55doublindirectionis it possible to run some initialization code when a namespace is first loaded?
11:56ordnungswidrig,{1 2 3}
11:56clojurebotjava.lang.ArrayIndexOutOfBoundsException: 3
11:56ordnungswidrigAny chance that the error cause will be more precisely reported in future clojure?
11:57drewrdoublindirection: you could do something like (defonce foo (do (init) (init-more)))
11:57rullie.{1 2 3 4}
11:57rullie,{1 2 3 4}
11:57clojurebot{1 2, 3 4}
11:57rullieordnungswidrig: a map needs even number of elements
11:58rulliethe error is precise, it is getting the [3] of the array, which is the 4th element, or the value of the key 3
11:58doublindirectiondrewr, thats what i'm doing, i was thinking that maybe there is something "idiomatic"
11:58ordnungswidrigrullie: I now, but the error is misleading
11:58arohnerif I use clojure.contrb.ns-utils/immigrate, that creates a second var, right?
11:58arohnera second var in the destination namespace
11:58doublindirectiondrewr, it works anyway
11:58rullieordnungswidrig: i think the error makes sense :)
11:58ordnungswidrigrullie: I'd expected a OddNumberOfMapElementsException :-)
11:59ordnungswidrigrullie: if the error is burried deep in your code than it's more complicate to see the cause
12:00rulliei suppose
12:02arohnerns-utils/immigrate looks like it's not a clean solution. I think it's causing screwyness with slime
12:04arohneris there a way to intern a var in two different namespaces?
12:04replacahiredman: are you here?
12:05hiredmanbarely
12:06stuartsierraarhoner: no
12:06replacahiredman: are you still using the JSON doc for clojure-contrib in clojurebot?
12:07hiredmanyes
12:07replacacool, ok, I was just curious :-)
12:07hiredmanahem
12:07stuartsierraarohner: immigrate is a bad idea
12:07arohnerstuartsierra: yeah, I'm finding that out the hard way
12:07hiredmanyes, and thankyousomuch
12:08arohnerstuartsierra: is there a better approach?
12:08stuartsierraarohner: Yes. Don't try it. :)
12:10arohnerwell, my final goal is to have a namespace that contains the contents of two sub-namespaces. I don't really want to use load, because I don't like that the loaded file doesn't have a namespace declaration, so you don't know what is required, etc
12:10stuartsierraThere's no such thing as a sub-namespace.
12:11stuartsierraIf you're used to languages with first-class modules like Python/Ruby, this may be difficult.
12:11arohnerI want to end up with arohner.foo, that has the contents of arohner.foo.bar and arohner.foo.baz
12:11stuartsierraarohner: Can't be done in any reasonable way.
12:14hoeckstuartsierra: what about defalias, does it face the same problems as immigrate?
12:15stuartsierraWhat's defalias? Is that in contrib?
12:17hoeckstuartsierra: clojure.contrib.def/defalias
12:17stuartsierraYes, it has the same problems, because it creates a new Var.
12:17hoeckbasically expands to (def myname otherns/myname)
12:18stuartsierraThat's not an alias, it's a NEW global Var initialized to the other Var's value.
12:18stuartsierraRebinding one will not affect the other. This is the problem with immigrate.
12:20hoeckstuartsierra: I see
12:20stuartsierraIf you REALLY want to refer multiple namespaces with a single line, write a function that calls 'use' or 'refer' for each namespace.
12:20arohnerthat, and reloading the source namespace will not affect the target namespace, because you have two vars
12:20stuartsierraarohner: Exactly.
12:20arohnerbut use and refer aren't exported to other users of the namespace
12:21stuartsierraCorrect. What you want -- to 'use' my-ns and automatically get my-ns.foo and my-ns.bar -- is simply not possible.
12:22stuartsierraThe closest you can get is to define my-ns/refer-others and call it after you 'use' my-ns.
12:22arohnerI think there's room for improvement there. as a library implementor, I want to split the implementation into multiple files, and load is sub-optimal
12:23stuartsierraThe problem is that namespaces mirror the structure of Java packages, which are not first-class objects.
12:24arohnerhow does that cause a problem?
12:24stuartsierraAll Java packages exist in one flat, global namespace. There is no hierarchy.
12:25arohnerfor this to work, I don't need the namespaces to form a hierarchy, I just need to be able to stick one var in multiple namespaces
12:26drewrthat sounds like a nightmare
12:26arohnerthough, that might cause problems
12:26arohnerI don't understand the big picture yet
12:26drewras a user, I would prefer the consolidation be explicit
12:27stuartsierraarohner: Look at it this way: The namespace is a property of the Var. A Var cannot, by definition, exist in more than one namespace.
12:28arohnerso it is
12:35fliebelhow can i do slices(like python) with clojure?
12:36arohnerfliebel: you can use subvec, if you have a vector
12:37arohnerwhat are you trying to do?
12:37arohnerslices cover a lot of functionality in python
12:37fliebelwell, just the start, stop
12:37fliebellength
12:37fliebelI'd like to retreive parts of a lazy seq
12:38fliebelespecially the third step is important for me...
12:39drewryou could use partition if you want to pull chunks at a time
12:39arohneror take
12:40fliebel(slice [:a :b :c :d] 0 −1 2) => [:a :c]
12:40drewr,(get [:a :b :c :d] 2)
12:40clojurebot:c
12:41fliebeldrewr: partition might work fine...
12:41arohnerit's been a while since I've done python, but that's go from the end of the list to the beginning, taking every other item, right?
12:41fliebelarohner: how do you mean?
12:42arohnerI was trying to remember how to interpret the python slicing
12:42fliebelarohner: this was probalby a wrong one...
12:42hiredman,(take-nth 2 [:a :b :c :d])
12:42clojurebot(:a :c)
12:42arohnersorry, I have to run
12:42fliebelthe syntax is start:length:interval
12:43hiredman,(take-nth 2 (range 10))
12:43clojurebot(0 2 4 6 8)
12:43hiredman,(take 2 (take-nth 2 (range 10)))
12:43clojurebot(0 2)
12:43fliebelhiredman: that is exactly what I need!
12:44drewrah, take-nth
12:45aluinki'm looking for a good tutorial to working with Clojure...where can I find one? searching google for clojure is ... painful
12:45chouser_thicket: I know it's early to be asking but do you have any sense of a timeline for 1.2?
12:45fliebelaluink: I agree on the searching thing....
12:45aluinki've worked with Haskell so I'm not new to functional programming, and have worked a lot with Java so i'm not new there either
12:46hiredman~blip.tv
12:46clojurebotblip.tv is http://clojure.blip.tv/
12:46fliebelaluink: I envy you…
12:46chouser_rhickey: that was for you. iPhone speli
12:46aluinkfliebel: how so?
12:46chouser_spelling corrector fail
12:47aluinksearching "clojure lisp java" on google was kinda productive
12:47fliebelaluink: I'm trying to learn clojure without any knowledge of functional programming and a little Java.
12:47hiredmanircPhone
12:48aluinkunfortunately corporate policies here have blocked blip.tv, FAIL!
12:48aluinkwe won't discuss how i'm in an IRC channel ;)
12:48chouser_hiredman was that a tip or a pun? :)
12:49hiredmanpun :(
12:49esjwhat is the inverse of (keyword x) ? I'm using (apply str (rest (str (keyword "index")))) which is just silly.
12:49drewr,(name :foo)
12:49clojurebot"foo"
12:49esjdrawr: thanks
12:49esjdrewr, even.
12:49rullie`(a b c)
12:50rullie,`(a b c)
12:50clojurebot(sandbox/a sandbox/b sandbox/c)
12:50replacaQ: when I execute this line: `(defn ~name [] (snippet ~name (template-for ~template-file) [:body :> any-node] ~args ~@body))
12:50somniumesj: name
12:50somnium,(name :x)
12:50clojurebot"x"
12:50rullie,`(,gensym)
12:50clojurebot(clojure.core/gensym)
12:50replacaI get "can't use qualified name as parameter: net.cgrand.enlive-html/any-node"
12:50rullie,`(+ 1 2)
12:51clojurebot(clojure.core/+ 1 2)
12:51esjsomnium: thanks too :) Clojure is great for distilling long questions into short answers.
12:51replacawhy can't I?
12:51rulliegood stuff
12:51chouser_hygiene
12:51replaca(I understand the part about how ` namespace qualifies symbols, but I don't see why that would be a problem
12:51fliebelWhat the heck is the function name for scrambling/shuffling a sequence?
12:52cemerickseq-util/shuffle
12:52hiredmanCollections/shuffle ?
12:52replacachouser_: ? I don't understand the hygenic implication here? Isn't namespace qualification *good* for hygiene
12:52fliebelcemeric & hiredman: Is that in contrib?
12:52aluinkfliebel: http://mitpress.mit.edu/sicp/ This is an EXCELLENT book on functional programming...it uses scheme ;)
12:52chouser_replaca: you need to gensym local names to avoid unintended capture
12:53hiredmanCollections/shuffle is part of the java Collections api
12:53aluinkfliebel: it's up there with K&R :)
12:53fliebelaluink: thanks, but I'm not learning scheme ;)
12:53replacachouser_: but it's not a local name! it's a func in enlive
12:54replacaso that's what I want, isn't it?
12:54chouser_hm would seem so
12:54cp2is there a way to pass arguments to javac in a leiningen project file? ex -Djava.library.path=foo
12:54chouser_you're sure that fn is refered in like with use?
12:54replacachouser_: that's why I'm confused :-)
12:56replacathe macro's used in the same ns as where it's defined. It seems like if it can do the ns qualification in ` it must be able to find the var
12:56chouser_actually it seems more likely you're misusing enlive somehow
12:57chouser_i don't know how snippet works
12:57chouser_if that macro is not defined in enlive it must be finding the anynode fn ok
12:58drewrcp2: I believe JAVA_OPTS support has just been added
12:58chouser_but then trying to use it as a formal arg or something?
12:58drewrcp2: might want to ask in #leiningen
12:58cp2drewr: aye, thanks
13:00replacaAha! snippet is a macro itself! I thought it was a function and that that was simply a vector arg, not an arg list. Now it makes complete sense. Thanks, chouser_!
13:02aluinkfliebel: this book uses scheme as it's vehicle, but the book is not a tutorial/guide whatever you wanna call it on scheme
13:02aluinkfliebel: this book is about functional programming concepts
13:03aluinkfliebel: it could have just as easily been written using clojure as it's language of choice...they chose scheme..prolly cause clojure wasn't around when it was written ;)
13:03esjfliebel: a support aluink whole heartedly, you should read this first. I'm working through it at the moment, great stuff.
13:05aluinkfliebel: this book no doubt has the obvious side-effect of teaching scheme
13:18lghtnggood morning
13:30_fogus_,(sorted-set :a 1 :b :c :d)
13:30clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number
13:30_fogus_Is this intended?
13:31_fogus_I assume that if you're building a sorted-set then Clojure assumes that all items are mutually comparable
13:33_fogus_Ahh, now I see sorted-set-by
13:34mabeswhat is the recommended/idomatic way of serializing clojure data to a file and reading it back in? I've seen pr-str and read-string but having an ASCII representation seems wasteful
13:35drewrbut it's homoiconic
13:35mabesdrewr: what that comment for me?
13:36drewrmabes: yes
13:36drewryou benefit by writing in the same format the reader can read
13:36drewrI usually compress though to save bandwidth/disk space
13:37mabesdrewr: ah, I see. Ok, I guess I can see that.
13:44Licenseraloah
13:55Drakesonhow can I find the maximum number of arguments for a function?
13:55jasappDrakeson: what do you mean?
13:55Drakesondo I have to parse (:arglists (meta f)) looking for `&' or there is an easier way?
13:56Drakeson(reduce max (map count (:arglists (meta f)))) is a naive way that does not account for `&'s
13:56dakroneDrakeson: might be some stuff here: http://stackoverflow.com/questions/1696693/clojure-how-to-find-out-the-arity-of-function-at-runtime
13:59alexykanybody using IDEA's La Clojure plugin?
13:59Drakesondakrone: thanks
14:26alexyktechnomancy: would it make sense to optionally add rlwrap to lein repl launch line?
14:28the-kennyalexyk: Isn't jreadline integrated in the last commit
14:28alexykthe-kenny: I hate readline, you can't search with C-r backwards in it
14:28alexykI always end up trying to disable jline from JVM repls to call under rlwrap
14:29alexykI mean I hate jline and love readline
14:29alexyk{:jline hate, :readline love}
14:29the-kennyunknown symbol "hate"
14:29the-kenny;)
14:29hiredmanjline also has unicode issues
14:30lghtngone man's meta...
14:30technomancyjline is definitely not as good as readline, but it's impossible to make rlwrap a dependency of leiningen, while jline can be defined as a dependency and included in the standalone jar.
14:30alexykthis is the most bizarre thing of all: with all the REPLs now in JVM, stupid, broken jline for all.
14:30alexykNot a single GNU-readline compatible thing, with search through history.
14:31opqdonutrlwrap
14:31hiredmanalexyk: I think headius had a fork of jline at one time that fixed some issues
14:32headiusand somehow I ended up admin for jline proper
14:32alexyktechnomancy: right. I now call repl as: rlwrap lein repl, and am sticking rlwrap into the lein as: rlwrap java ... -- but that's just me.
14:32headiusthough I really haven't had time to admin it
14:32hiredmanhttp://blog.headius.com/2009/05/jruby-nailgun-support-in-130.html?showComment=1242249900000#c4023221249455202623
14:32alexyktechnomancy: if you add jline, please also add a standard way to disable it!
14:33technomancyalexyk: patches welcome. I don't use either of them myself.
14:34hiredmanmaybe I should take another look at jline
14:35alexyktechnomancy: sure, I'll send you some charred sh-shards :)
14:35hiredman(if headius is calling the shots)
14:35alexykhiredman: that post is about nailgun, not jline?
14:36alexykah, comments
14:36hiredmanalexyk: the url is for a comment
14:37alexykis there a same thing for clojure to run with a nailgun, btw?
14:37alexykI know one in maven plugin mentions clojure:nailgun
14:38hiredmanyou just install nailgun and ng clojure.main
14:38alexykhiredman: say I have a clojure script, will the above run it in a pre-existing JVM?
14:38hiredmanyep
14:39alexykso, ng clojure.main myscript.clj?
14:39alexykor #!...ng clojure.main ; on top of script?
14:41hiredmannever tried to use ng in a shebang line
14:50arohnerI'm using a macro to generate a defn. Is there a way to write the macro so I get "pretty" function names as opposed to gensyms? I tried using ~' on the fn arguments, but clojure wasn't happy with that
14:50arohnersorry, not function names, function arguments
14:51the-kennyarohner: I don't really get the problem.. cann you show me an example?
14:52arohner`(defn foo [x#] (println "hello world"))
14:52hiredman:|
14:52arohnerthe docstring for foo will show that it takes [x_1123q4]
14:52arohneras opposed to just x
14:52hiredmanyou can always reach in and tweak the docstring
14:53hiredman,(doc alter-meta!)
14:53clojurebot"([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"
14:53arohneryeah, I guess that will work
14:53the-kennyarohner: hm... If variable-capture isn't a problem, why use gensyms at all?
14:54arohnerbecause the compiler doesn't appear to be happy with a non-gensym as an argument to the fn. I get: Can't use qualified name as parameter: my-ns/x
14:54arohneroh, nm
14:54arohnerI should be using ', not ~'
14:54the-kennyarohner: Heh, I had this problem after using common lisp a long time too
14:55stuartsierraarohner: 'intern' is often a better way to create functions
15:01tolstoyIs it possible to implement an "abstract method" using (proxy ... )?
15:02stuartsierratolstoy: yes, shouldn't be a problem
15:02tolstoystuartsierra: Okay, thanks. I must have some other issue, then. Phew! :)
15:03the-kennyI felt bad
15:04tolstoyHm. I still get AbstractMethodError.
15:05tolstoyI wonder if you have to type hint?
15:05tolstoyMaybe it's the "protected" thing.
15:06tolstoyOr void.
15:06hiredmanthe-kenny: even with a name like that?
15:07the-kennyhiredman: "wall-hack-method"?
15:07hiredmanyes
15:07the-kennyIt sounds so.. nasty
15:07hiredmanhttp://github.com/richhickey/clojure-contrib/commit/cc4e2ec2bf558f059330ebc97a031d7806a1e364
15:08the-kennyhiredman: No offense against you ;) I just don't like the idea of "breaking walls" just to call a protected method in a proxy.
15:08the-kenny...but if that's the only way
15:09tolstoythe-kenny: Can the superclass of the class your proxying call a protect method you've implemented in the proxy?
15:10hiredmanthe-kenny: I am not offended, just tickled pink to have (5 or 6 lines of) code in contrib
15:10the-kennytolstoy: I don't know.
15:11tolstoythe-kenny: Ah, I was thinking that's what you were talking about.
15:11the-kennytolstoy: No, I talked about calling a protected method from a proxy, not implement it.
15:11tolstoyYeah, that's what I thought, but I was hoping.... ;)
15:35leafwhum, any body knows how to get the type for a double[]?
15:35chouser"get the type"?
15:35leafwfor example, a double is Double/TYPE, but what is a double[] ?
15:36chouser(class (double-array []))
15:36chouser,(class (double-array []))
15:36clojurebot[D
15:36chouserthere ya go. ain't it beautiful?
15:36defnhehe
15:36leafwchouser: yes, sure ... but I'm stuck in java land. I guess I can call RT.invoke, but there must be an internal way
15:36chouserfor type hints you should be able to use #^doubles
15:37chouser,(Class/forName "[D")
15:37clojurebot[D
15:37leafw(. Class (forName "[D"))
15:37leafwyeah. works
15:37leafwweird
15:38chouser,(Class/forName "[X")
15:38clojurebotjava.lang.ClassNotFoundException: [X
15:38rhickeydouble[].class
15:38stuartsierra"[D" is Java bytecode syntax.
15:38chouserI could be the measure of how little one can know about Java and still use Clojure.
15:38leafwdouble[].class ... trying that
15:39stuartsierraThe ASM library is kind of fun. I toyed with the idea of writing a Forth-like interpreter with it.
15:39rhickeyhiredman: speaking of which, one short term objective (1.2?) I have is to pull ASM out of clojure's jar
15:39hiredman:(
15:39stuartsierraWhy?
15:40hiredmantaking away my shiny new toy
15:40rhickeyWill still come with Clojure, but as an external dep
15:40cp2hiredman: asm in clojure is not the full library anyway =P
15:40rhickeyso we can move to later version, avoid duplication when combined with code also using ASM
15:40stuartsierraah, that's fine
15:40hiredmancp2: I got my classloader working
15:40cp2good
15:40stuartsierragood, in fact
15:40rhickeyhave access to parts of ASM I left out for size reasons
15:40chouseronly needed for compiling, not for running AOT-compiled things, right?
15:41rhickeyincluding those that would let you get ASM output during Clojure compilation
15:41hiredmannow I just want to have the code generate a jar file when run
15:41rhickeychouser: right, although pulling out all references not in compiling code is another project
15:42hiredmanso you can put classloader.jar on your classpath, and add -Djava.system.class.loader=foo.classloader to your java options
15:42chouserok,I can see that.
15:49rhickeySo, I'd like some input on how best to handle that (separate ASM) from the perspective of git, Ant, Maven et al
15:49hiredman:|
15:52piccolinoI notice that Servlet 3.0 seems to require the use of annotations to enable the asynchronous processing stuff... how would one use that from Clojure? Is it possible?
15:59defngood god the splits today
16:00dakronehey defn, what's up with your git commits?
16:01defn?
16:01dakronethey're all hostnames and timestamps
16:01dakroneno actual commit messages?
16:01defnyeah i just wrote a little script to push it because i mess with it at work and at home
16:01dakroneahh
16:01defnand want it to be consistent at both places, but i realize that's probably annoying
16:02defnill change the script to force me to add a message :)
16:02dakroneit's really hard to tell what's changed, have to look at the diff each time
16:02defnyeah sorry about that
16:02dakronep.s. please add an RSS feed to your blog
16:02defnhaha, feature requests aplenty! :)
16:02ohpauleezdefn: where's your blog?
16:02defnhttp://devinwalters.com
16:02ohpauleezthanks
16:04defndakrone: as far as what's changed, not a whole lot yet, it took me awhile (not knowing much java) to get the hang of building the jar and such
16:04ohpauleezdefn: Awesome, I actually did an optimization of your Problem 14 a little while back
16:04defnoo! I'd love to see it
16:05defnthat code takes about 30seconds :\
16:05ohpauleezlet me dig it up for you
16:07ohpauleezdefn: if you make the second line of count-and-track: (let [cnt (int n)
16:07ohpauleezyou'll notice an improvement
16:07ohpauleezI also prime the JVM before I do the large set
16:07jasappprime the JVM?
16:08ohpauleezgive the same calls you want to make a few times, so the JIT will kick in when you're running a larger set
16:08jasappAhh, ok
16:11defnohpauleez: yeah that makes big difference in some cases
16:11defni've seen (time ...) after priming the JVM go from 3.5s to 1.8s
16:12defnim not sure if that is a huge deal once the JVM is up and running, in other words, we're not getting 3.5s for every 1.8s in an un-primed JVM
16:12defnbut it's still nearly 2s
16:13ohpauleezfor sure
16:13defnohpauleez: @ your (int n) stuff, that's a great idea -- i haven't looked at this code since i finished reading the optimization section in Programming Clojure
16:14polypusanyone had any luck installing compojure via lein?
16:14defnsure
16:14defnerr, you mean with clojars?
16:14chouserdefn: my solution to problem 12 is startlingly similar to yours.
16:15polypusyeah
16:15defni believe i got that divs fn from hiredman
16:15ohpauleezafter the comment about Rosetta Code, when I get stuck on current projects, I'm going to start to try to fill some of that in
16:16chouserour divs are identical except for the name (mine is "divisors") and spacing. otherwise the forms are =
16:17hiredmanthink I got mine from reading a wikipedia article on something or other
16:17defnchouser: heh, im not sure how else you'd approach that problem
16:17defnthe brunt of it is, triangles as a lazy-seq, a good divs fn, a filter
16:17liebkepolypus: are you seeing a Maven missing artifact error for org.clojure:clojure-lang:jar:1.1.0-alpha-SNAPSHOT?
16:18polypusyeah
16:18chouserdefn: you could use :let for c in problem 9
16:18liebkeclojure-alpha was renamed clojure-master, and this broke most of the projects on Clojars
16:19polypusahh, when did that happen?
16:19defnchouser: nice, thanks!
16:19liebkeyesterday or so
16:19chouserpolypus: a couple days ago. I did it because I was asked to.
16:20polypuschouser: do you always follow orders w/o regard for the consequences :)
16:20chouseryes
16:20defni havent had trouble with building compojure with lein via clojars
16:20chouserwait, no!
16:20chouserpolypus: I dunno, what would you like me to say??
16:21liebkechouser: I think the new naming scheme is good, but can the old name hang around for a while
16:21polypuschouser: i dunno let me consult my superiors
16:21chouserpolypus: :-)
16:21defnpolypus: :D
16:21hiredmanpolypus: yes
16:22defnpolypus: you're getting the problem with lein deps?
16:22chouserliebke: this is all beyond me. All I think I have the authority to do is back out the change, and I haven't gotten the impression that's what people want.
16:23liebkechouser: I agree, it shouldn't be backed out. I just wish there was a way to have clojure-alpha point to clojure-master.
16:23arohnersymlink on the server?
16:24defnpolypus: just for fun i created a new lein project and added [org.clojars.ato/compojure "0.3.1"] to my project.clj, lein deps, lein compile, lein uberjar, no errors
16:25defnpolypus: I think technomancy may have pushed out a new vers. of lein last night which may have fixed the issue you're having
16:25hiredmandoes lein do any caching?
16:25liebkedefn: do you have clojure-alph in your .m2/repository?
16:26defni dont
16:26liebkehmm
16:26polypusdefn: you just did that and i worked?
16:26polypuss/i/it
16:27defnyeah, but maybe its because i have it downloaded already
16:27defnin my .m2
16:27polypusyeah probs
16:27defni can send you it! :)
16:27polypusmaybe i can just change the name in my .m2
16:46chouser(doall (map ...))
16:46chouseror (vec (map ...))
16:47ordnungswidrig cu all!
16:47the-kennychouser: I know, I know. But I think it would be good in core. I had too much bad problems with lazyness
16:47chouserthe-kenny: :-( really? like what?
16:47alexykliebke: did you take down incanter off clojars?
16:48alexyksearch for incanter only finds dependencies
16:48the-kennychouser: Some io- and storing-related things
16:48alexykchouser: let me guess: being fired?
16:48alexyk:)
16:48the-kenny(Weird exceptions when something lazy was stored for 5mins in a agent-wrapped list)
16:48chouserheh
16:49chouserthe-kenny: hm... it's hard to know how to mitigate that without making everything non-lazy by default, which seems like an awefully big hammer.
17:01alexykthese freenode explosions are getting old
17:01the-kenny..very annoying
17:01arohnerwhy does IRC still do this? Haven't they had decades to sort this out?
17:01the-kennyarohner: It's a problem of the architecture..
17:01alexykliebke: depending on 1.0-SNAPSHOT works, downloads incanter-1.0-20091121.091400-1.jar
17:01the-kenny...but it shouldn't be hard to modify a server to serve the missed messages to the respective people
17:01alexykarohner: RMS gets bored and flips the switch
17:02hiredmancould move to a xmpp muc
17:02the-kennyhiredman: Yeah.. but I think Adium isn't suited for so much users
17:02hiredmanas it happens, clojurebot hangs out it a muc (when the xmpp stuff is working)
17:02hiredmanhttp://cybione.org/~irssi-xmpp/
17:02mmullinsIs it possible to use "&" variable arity with defprotocol?
17:02mmullinsI've been trying but keep getting errors.
17:02the-kennyhiredman: I switched to weechat some weeks ago. I like it way more than irssi
17:02liebkealexyk: good
17:02the-kennyclojurebot: xmpp
17:02clojurebotI don't understand.
17:02alexyk,relax-and-enjoy
17:02clojurebotjava.lang.Exception: Unable to resolve symbol: relax-and-enjoy in this context
17:02the-kennyhiredman: Where does clojurebot hand out?
17:02polypushttp://metajack.im/2009/01/07/emacs-and-jabber-happy-together/
17:02alexykteXnomancy: here's a simple idea to enable rlwrap in lein: $RLWRAP java ...
17:02alexykyou define RLWRAP in your shell if you want it
17:02polypusoops i forget not everybody's on emacs
17:02hiredmanclojure@conference.thelastcitadel.com
17:03hiredmanme neither
17:03chousermmullins: I think varargs for protocols is not yet supported.
17:03hiredmanI'm getting a sneaky suspiscion my xmpp server might not be working
17:03mmullinschouser: ok, thanks
17:04the-kennyOh, looks like weechat has a xmpp-plugin, I just haven't compiled it
17:05hiredmanhuh, this says clojurebot is online
17:05tomojso I'm trying to set lein up finally. seems to be working ok, I think, but lein-swank won't. I added [leiningen/lein-swank "1.0.0"] to my :dev-dependencies, but then running 'lein deps' causes an error: https://gist.github.com/55a7a1d61e98c909a7e0
17:05the-kennyhiredman: I just joined the muc and you and clojurebot are there
17:07hiredmanyep
17:07polypustomoj: lein is pretty screwed up right now cuz most clojars are broken
17:07tomojoh, I see
17:09polypusmaybe wait a few days till things clear up and save yourself some headaches
17:09tomojthanks
17:09polypusnp
17:10alexykis there a maven naming scheme for jars compiled under clojure "new" branch vs regular?
17:16alexykshould I depend on clojure-1.1.0-alpha or 1.1.0-master form maven?
17:17alexykare they the same?
17:17tomojearlier today leiningen switched to -master
17:17tomojdunno why though
17:18alexykyeah, and alpha has no jar
17:18alexykin my repo
17:19alexykso we really need a naming convention for branches. Scala does this: -language-branch is tacked after artifactId, this leaves version the same across language branches.
17:19alexykso x/y-v would be x/y-new/v for a non-master branch
17:21hiredmanhave you checked the google group?
17:22alexykhiredman: not for this yet
17:22hiredmanI am pretty sure this has all been discussed and more or less acted upon
17:22alexykhiredman: what's the summary? :)
17:22hiredmanalexyk: nothing I cared enough about to rememeber
17:23alexyka good summary :)
17:31alexykhow do you do iteration count to doseq?
17:31alexykI want to print progress every N iterations
17:32tomojseq-utils has indexed
17:33alexykthx
17:34tomoj,(doseq [[i e] (map vector (iterate inc 0) '[foo bar baz])] (println i e))
17:34clojurebot0 foo 1 bar 2 baz
17:34tolstoyDo messages take a while to show up on google groups?
17:35chousertolstoy: they can.
17:35tolstoyAh, I'm a "new" member. I see.
17:35alexyktomoj: nice
17:37tomojlooks like indexed really is just (map vector (iterate inc 0) s)
17:37alexyksave me some pusszling over (require '...) :)
17:38defnanyone here a groovy fan?
17:38defni dont know much about it, was wondering what the consensus was
17:40hiredmanclojureql has gone gradle
17:40lisppaste8Tolstoy pasted "Abstract Method Error" at http://paste.lisp.org/display/91963
17:41tolstoydefn: I use Groovy quite a lot. It's nice enough.
17:41defntolstoy: what's the draw for you over Ruby?
17:42tolstoyI work in a Java shop and MUST use something that can make use of the giant wads of cruft lying around.
17:42hiredmantolstoy: I think he meant jruby
17:42defnty
17:42tolstoyOh.
17:42defnGroovy looks more java-ish
17:42tolstoySorry, never tried Jruby.
17:42defnprobably makes more sense to use something more familiar
17:42tolstoyYes, it gets you better buy-in from nervous managers.
17:43defnhaha, oh god, please don't get me started on that
17:43hiredmantolstoy: might be an issue with protected
17:43defnthat's the only reason i got them to let me try out clojure on a project at work
17:43defn"JVM" -- Just like Java... *cough cough*
17:43tolstoyhiredman: I tried making the method public, no go. Same error.
17:44tolstoydefn: Yeah. I've tried so hard to make a "installable running process" be the medium of exchange. Linux as appserver. But no go.
17:45tolstoydefn: For them, it's imagining they can replace devs. Of course, our code is so spaghetti due to Java itself that each project might as well be a brand new language.
17:45defnhaha, exactly
17:45hiredmanthe addStuff method isn't being called for some reason
17:46defnit's like ... i understand why you think this is a good decision, but umm, you know that John doesn't use a testing harness, right? You know that Ted doesn't indent his code properly right? You know that Bob doesn't write comments as a rule, right?
17:46tolstoyyou know we re-invented half of J2EE less the documentation, right?
17:46hiredmantolstoy: what if initStuff is public?
17:47tolstoyhiredman: I'll try that.
17:47defnhaha tolstoy
17:47defn"It's Java, but...not Java at all. Think: Java, without Java. It's brilliant, and maintainable!"
17:47tolstoyhiredman: Same problem.
17:47hiredmanhmmm
17:48hiredmanOh!
17:48hiredmanOh!
17:48hiredman$5
17:48hiredmanit's because you don't have the class in a package
17:48tolstoydefn: Yeah. Any Java app is a bug-ridden, half-implementation of J2ee.
17:48tolstoyhiredman: Which class. Foo? This is just an example. The real one DOES have a package and I get the same error.
17:49defnYou know, after watching Rich's "Are We There Yet?" presentation, I was thinking a bit about things that are annoying about programming in this day in age
17:49hiredmanbah!
17:49wtetzner|laptophow do i get the version of clojure that has new features, like deftype and reify?
17:49tolstoyhiredman: Yeah, this is a puzzler!
17:49defnand one of the biggest pain points for me is always the GUI stuff for multiple platforms -- someone needs to solve that problem for God's sake
17:49tolstoydefn: They did. It's called The Web.
17:49defnbah!
17:50defnheresy
17:50tolstoyheh heh
17:50tolstoyemacs?
17:50defnemacs is close I guess, but well -- let's be honest
17:50defnit ain't for everyone
17:50tolstoyhiredman: I wonder if it's the fact that Clojure is running as a script?
17:51hiredmantolstoy: nope
17:51teXnomancycoding UIs in Emacs is so much less painful than any other system I've tried; HTML/CSS included
17:51tolstoyhiredman: Using java -server -cp $CLOJURE clojure.lang.Script $scriptname -- $*
17:51hiredmanclojure is always compiled regardless
17:51tolstoyhiredman: Well, that's what I woulda thought.
17:51tolstoyhiredman: Okay, I'll try adding a package to Foo and see how it goes.
17:52hiredmanand use clojure.main
17:53hiredmanclojure.lang.Script is deprecated
17:55alexyktomoj: so in (map vector (iterate inc 0) '(1 2 3)) how does map finds out what's fn and what's seq?
17:56alexyki.e. what does vector do here?
17:56tolstoyException in thread "main" java.lang.AbstractMethodError: app.Foo.addStuff(Ljava/util/Map;)V (foo-bar.clj:0)
17:56tomoj,(vector 1 2)
17:56clojurebot[1 2]
17:56tolstoyhiredman: I'll try clojure.main
17:57defnteXnomancy: Does the teX mean you're doing maths? :)
17:57tomojyou've got two seqs, (iterate inc 0) and '(1 2 3), map goes over them in parallel and passes an element of each to vector
17:57alexykright but why don't we have parens around (vector ...)? or does map only create vector from iterate seq, and then doseq consumes two sequences into one [i e] each time?
17:57alexykah, so map goes over both
17:57tolstoyhiredman: Same deal.
17:57tomoj,(map vector (iterate inc 0) '(foo bar baz))
17:57clojurebot([0 foo] [1 bar] [2 baz])
17:58alexyknice
17:58hiredman:(
17:58tomojdoseq destructures
18:01tolstoyhiredman: I have the contructor call a regular method, which I've overridden in the clojure proxy, and it works just as I'd hoped.
18:01alexyktomoj: so if map has more than one seq, the fn must have arity to accomodate all?
18:02tolstoyhiredman: So, yeah, something weird about implementing an abstract classes' abstract method.
18:04tomojalexyk: yup
18:18qedhm, i cant get this shell-out stuff to work
18:18qed(sh (format "/usr/local/bin/markdown %s -f %s -x codehilite" md-file write-to))
18:19qedCannot run program ...
18:19qederror=2, No such file or directory
18:20hiredman,(doc sh)
18:20clojurebot"clojure.contrib.shell-out/sh;[[& args]]; Passes the given strings to Runtime.exec() to launch a sub-process. Options are :in may be given followed by a String specifying text to be fed to the sub-process's stdin. :out option may be given followed by :bytes or a String. If a String is given, it will be used as a character encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to convert the sub-process's stdout to a Stri
18:22qedhiredman: im not sure what im missing there
18:24hiredmanqed: have you looked at the arguments exec() takes?
18:24alexykteXnomancy: so are you planning to let folks specify JAVA_OPTS in project.clj?
18:24qedhiredman: no, what's exec?
18:25qedexec()
18:25hiredmandid you read the docstring for sh?
18:25hiredmanI mention exec() in the context of the docstring
18:26hiredmanif you read the docstring (which you should do) the exec() I mean in that context should be very apparent
18:26qedyeah i see it, im just terrible at understanding the java docs, its slowly coming
18:26teXnomancyalexyk: I think that would mean you'd have to fork to run tests/compile/do anything. depends on how bad of a speed hit that requires I guess.
18:27hiredmanqed: basically by handing a single string to sh you are getting http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec%28java.lang.String%29
18:27alexykteXnomancy: my current approach is to actually store ./lein next to project.clj to add things anyways
18:28alexykI'm just thinking there will be situations where you want to use say compressed references or some other JVM flags per project, and storing them in project.clj seems right
18:29alexykthen shell will have to easily grep them out and feed to java command line
18:29teXnomancyalexyk: alternate approach would be to source a my-project/.leinrc from the bin script. haven't given it much thought as I don't need it myself. why don't you bring it up on the mailing list and see what other users think?
18:29hiredmanqed: what you want is http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec%28java.lang.String[]%29
18:29alexykteXnomancy: is there a list for lein, or you mean clojure google group?
18:30teXnomancyalexyk: there's http://groups.google.com/group/leiningen
18:30teXnomancyyou seem to have a lot of ideas; you should join. =)
18:31alexykcool, will post there then
18:31hiredmanI don't mean to offer criticism without offering a solution, but sheel-out/sh seems like brittle junk, I would just use .exec directly
18:31qedhiredman: im still not sure how to say "-f xyz"
18:32qed(sh "cmd" arg1 arg2) works, just not sure how to say arg1 is "-f arg1"
18:32hiredmanqed: things that would be sperated by spaces on the commandline need to be in seperate array elements
18:32hiredmanso for sh it would be something like (sh "cmd" "-flag" "arg1" "arg2")
18:32qedhiredman: awesome thank you
18:33qedbut good point on calling exec directly
18:34hiredmanqed: have you tried looking for java markdown processors?
18:34qedi havent
18:34qedi found this particular markdown processor to be nice because it had a pygments extension already
18:34qedwhich was something that was important
18:38qedi own that nick :)
18:40teXnomancyqed: you're te? aha.
18:40qedhaha, no UTF-8 for you!
18:40qedi got all wrapped up in eastern philosophy for awhile, plus im a sucker for short nicks
18:52skyboundi am trying to understand type hints, or more precisely when the type is inferred from the return value of a fn; see http://pastebin.com/d6ffaca44 ; the way i understand the docs the reflection warning shouldn't happen in the second test? am i doing this wrong?
19:01hiredman~performance
19:01clojurebothttp://clojure.org/java_interop#toc46
19:01hiredmanfns always have Objects in and out
19:02the-kennyIs there a slime command to eval all open clojure-buffers?
19:02the-kenny(Like doing C-c C-k on every of them)
19:03_atohiredman: right but he's returning a Set which is an Object
19:03hiredman_ato: and calling .contains on it
19:03hiredmanwhich can only be done via reflection
19:03_atoskybound: I guess it's not clever enough to propagate the type hint from the returned variable to the function
19:04_atothat should be doable I'd imagine, so I guess maybe it's just something that got overlooked
19:04_atos/variable/local/
19:04hiredman_ato: that is not that easy
19:05_atoyeah, the function could have multiple exit points
19:05hiredmanfor this specific case, s is a mutable object
19:05_atodoable, but perhaps the complexity would be too high for the benefit
19:05hiredmanso the same object is passed through
19:06_ato(defn test-add-set2 [#^Set s] (dotimes [i 1e5] (. s add i)) s)
19:06hiredmanif you used a PersistentSet
19:06hiredmanand something like conj
19:06hiredmanor what have you
19:07_atoit could propagate the #^Set type hint from s to the function's return value
19:07hiredmanit could return anything
19:07_atoyeah
19:07_atoprobably in general Clojure code it helps less so Rich didn't bother with it
19:08skyboundi can accept that it doesn't work for the general case, but the java_interop docs claim "...the compiler will track the use of any return values and infer types for their use..."; in what cases would type inference work for return vals?
19:09_atoskybound: I think it might be talking about return types of java functions
19:09hiredmanjava methods
19:09hiredmanjava doesn't have functions (yet)
19:10_atonitpicker :p
19:10_atoeg. (let [x (.length "foo")] ...)
19:12hiredman_ato: keeping a clear dinstiction between java and clojure semantics is a good thing
19:12hiredmanif you do, you don't do stuff like (map .toUpperCase ["f" "b" "c"])
19:14hiredmanfunctions
19:14the-kennyof course, sorry
19:14_atohaha
19:14_atoI'm not the only one :p
19:14the-kenny_ato: Yes ;)
19:15the-kennyI get it right in my native language, but I use the wrong name in English every time.
19:15skybound_ato: that makes sense, given that it is mentioned in the interop docs. thanks
19:16tolstoyCan you use :gen-class even if you're just running a script?
19:16_atoI have the distinction clear in my head of course, I just always seem to use the words function, method and procedure interchangeably.
19:16hiredmanhttp://en.wikipedia.org/wiki/Confucianism#Rectification_of_names
19:16hiredmantolstoy: nope
19:17hiredmanif you are running the new branch you can do things like reify or deftype, which have some overlap with gen-class, but not all of it
19:17tolstoyhiredman: I think that means I'm totally screwed using this class which calls an abstract method I'm supposed to implement in my proxy. Sadness!
19:18_atotolstoy: I sometimes do: (compile 'something) (import 'something) in a script, where 'something' is a gen-classed file
19:18_atoyou'll need to set -Dclojure.compile.path=/somewhere/writable and put that directory on the classpath
19:19skyboundthere is gen-and-load-class at the bottom of genclass.clj, though it is commented out. maybe something like that would still work
19:19hiredman:|
19:21tolstoyDo you guys think this little problem is a Clojure bug of some sort? Or just the limitations of this proxy stuff?
19:21tolstoyDoes seem to work in Groovy, FWIW.
19:21hiredmantolstoy: I would ask chouser or rhickey if you can snag them
19:22hiredmanhmmm
19:22hiredmanclojurebot: clojure is not groovy
19:22clojurebotIn Ordnung
19:23tolstoyYeah, yeah, yeah. And I'm happy about that. But praps they're doing something similar. Probably not.
19:23_atopart of the difference with proxy compared to what scala or groovy do is that proxy's "methods" aren't really methods, they're clojure functions so their code is not in the proxy class. That's the reason why it's not possible to call protected methods or super in the proxy, for example
19:24tolstoy_ato: It seems that it's not possible for the abstract class to call implemented abstract methods in the proxy, either.
19:24_atothat gives proxy higher performance (it doesn't need to generate a class for each instance, only one of each class proxied) and it makes it more flexible (you close over stuff and also redefine the methods of an existing proxy instance)
19:25hiredmanerm
19:25hiredmanI doubt your performance claim has any merit
19:25_atohiredman: ah yeah you're right
19:25_atoyou should be able to close over stuff just like a anonymous class
19:25hiredmanproxy is just a simple way to do it, and it gives you ability (that no one uses) to change the map of functions
19:25tolstoyYeah, I really like the whole proxy thing in Clojure. Kinda bummed about this one thing. And not so happy with my colleagues who foisted this upon me.
19:26hiredman~proxy
19:26clojurebotproxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.
19:26qed_ato: do you know if in compojure 0.3.1, if you can use (html [:html [:body body-content]]), where body-content is a string of html?
19:26qedthat makes sense right?
19:27_atoqed: yeah, you should be right
19:27hiredmantolstoy: you can gen-class a class that takes a runnable and then runs that runnable when the method is called, jar up the class, plop it on the classpath and never worry about it again
19:27tolstoyhiredman: Yeah, I think that's what I'll do.
19:28hiredmanrunnable, callable, or even a IFn
19:28tolstoyActually, I was just going to write a Java class that implements the abstract method, jar that up, then "proxy" that class.
19:29hiredmancould I interest you in using the ASM library provided with clojure to generate the class?
19:30hiredmanI have some truly horrible macros
19:31tolstoyhiredman: I might be interested. Is it in some version of Clojure?
19:32hiredmanit would be like, (make-class "a/b/c/foo" "super/class/Here" nil (method [Opcodes/ACC_PROTECTED "methodName" "(Ljava/utill/Map;)V" nil nil] return))
19:32hiredmantolstoy: I was mostly kidding
19:32hiredmanhttp://gist.github.com/254579
19:33tolstoyHeh. I think my dorky solution might be easier.
19:33hiredmanyes
19:35tolstoyKinda compelling, though.
19:37lambdatronicI come bearing optimization ickiness.
19:37lambdatronichowdy folks
19:37lambdatronictwo questions...
19:38lambdatronicFirst, I noticed that a number of operations with building up sorted-maps, hash-maps, and vectors got slower and more memory inefficient between versions 1.0.1 and 1.1.0
19:38lambdatronicand more frighteningly, something very weird is happening with the transients in 1.1.0
19:44lisppaste8lambdatronic pasted "transients of doom" at http://paste.lisp.org/display/91970
19:44lambdatroniccan somebody help me understand what's happening in this code?
19:44lambdatronicit seems pretty simple to me, just building up a transient vector and returning the persistent copy of it.
19:45lambdatronicbut when I do this in a loop, it explodes due to some kind of memory reuse under the hood.
19:45lambdatronicdoesn't seem to happen for small numbers of iterations.
19:45lambdatronicbut then, boom! gone
19:48lambdatronic*tap tap* is this thing on? anyone there?
19:50gbthi lambdatronic. I'm a noob so I can't help, but I'm sure someone will be along shortly :)
19:50lambdatronichere's to hoping.
19:50lambdatronic;)
19:51gbtare you using the new branch from git?
19:51lambdatronicI am. master 1.1.0
19:51lambdatronicand when I updated, all my code got slower.
19:51lambdatronicso umm...yeah. it's a bit upsetting.
19:53lambdatronic*swirly misty stuff* I call on you, O great clojure gods! Here my poor mortal plea! Save me from 1.1.0!
19:54gbtif you get that to work make sure you post the incantation ;)
19:55lambdatronic(send-off rhickey help '(with transients of doom))
19:55lambdatronicsomething like that, I suspect.
19:55tolstoylambdatronic: Maybe a post to the maiing list, too?
19:57lambdatronictolstoy: It had occurred to me. darned impatience.
20:01lisppaste8lambdatronic annotated #91970 "transients of doom - more info" at http://paste.lisp.org/display/91970#1
20:09lisppaste8cmbntr annotated #91970 "about 1.1.0 being slower..." at http://paste.lisp.org/display/91970#2
20:10tolstoyWriting a little Java class in Emacs is fun. You just never know if you're going to get a syntax error!
20:21interferon
20:21interferonanyone know of youtube videos that demonstrate structured editors for lisp, like paredit?
20:25chouserlambdatronic: I think I have some answers for you
20:25lambdatronicbrilliant
20:25lambdatronicthe man himself!
20:25chouserlambdatronic: no no, I'm not the man. But I'll see if I can help.
20:26chouserI think your first problem is one of head-holding.
20:26lambdatronichmm
20:27lambdatronicif you're referring to my doall, that was intentional. I'm trying to time a large number of these calculations and determine how much memory they'll take. hence I want to hold the list's head.
20:27lambdatronicbut my annotation contains a doseq as well to demonstrate that the problem is still happening.
20:27chouserIf you feel up to it, you could try the latest from the 'new' branch -- it might help.
20:27lambdatronicalways nail-biting moments of excitement and adventure in this community.
20:28lambdatronicI'm up for it, but perhaps you could give me some details.
20:28lambdatronicI can just rerun the same silly computation multiple times with the doseq (no head holding) and every few runs it throws the IllegalAccessError.
20:28lambdatronicSo it's pretty non-deterministic.
20:29lambdatronichence the "of doom" part.
20:29chouserwell, the latest 'new' has logic to make clearing of locals more pervasive, which is likely to help if it's really a head-holding problem.
20:29lambdatronicMy code isn't holding on to those transients anywhere. just reducing and then calling persistent!
20:29hiredmandidn't he just say he wants to hold the head?
20:29lambdatroniccan you point to the head-holding?
20:29lambdatronicI'm afraid I don't see it.
20:30skyboundi tried the code lambdatronic has posted on new, same exception as with current master
20:30lambdatronic(sorry about the persistent!. That's not emphasis. Just trying to get the symbol right).
20:30chouserlambdatronic: not specifically, which is why I'm not sure.
20:31lambdatronicah, then it's a real bug. excellent.
20:31lambdatronicI hate wasting people's time with silly stuff.
20:31chouserwait wait wait.
20:31lambdatronic(await chouser)
20:32chousercan you paste the full stack trace?
20:32chouserIllegalAccessError is weird
20:32lambdatronicYeah, but that's it.
20:32chouser(.printStackTrace *e)
20:32lambdatronicalrighty.
20:32lambdatronicjust a sec.
20:34lisppaste8lambdatronic annotated #91970 "transients of doom - and a stacktrace" at http://paste.lisp.org/display/91970#3
20:35lambdatronicvoila!
20:37lambdatronicI might also mention that I have a number of similar functions to rv-plus5-fast (hideous name, I know - just for testing purposes)
20:37hiredmanuh
20:37lambdatronicand when I upgraded from clojure 1.0.1 to the newest master in git.
20:37hiredmanMutable used after immutable call
20:37lambdatronicthey all become much slower.
20:37lambdatronichiredman: yes, I see the error. but where is it coming from?
20:38lambdatronicbecause if you try running the code snippet without the loop, it works most of the time.
20:38lambdatronicmind you, most of the time.
20:38lambdatronicthen you get the exception.
20:38lambdatronicand so on
20:38lambdatronicso it happens every few runs of the function.
20:39lambdatronicthat indicates that some of the previously allocated transient memory is being recaptured by clojure for future function calls.
20:39lambdatronici.e. aaaaahhhh!
20:40chouserDoes that error mean "Transient used after 'persistent!' called"?
20:40chouserif so we should get it updated.
20:40chouserthat appears to be what it means.
20:41lambdatronicseems like it, boss.
20:41lambdatronicbut how is the question.
20:42chouseris randvars.clj:338 the 'then' or the 'else' clause?
20:43lambdatronicthen
20:45lambdatronicIt's this line in rv-plus5-fast
20:45lambdatronic(conj! (pop! acc) [v2 (+ p1 p2)])
20:46hiredman,(doc pop!)
20:46clojurebot"([coll]); Removes the last item from a transient vector. If the collection is empty, throws an exception. Returns coll"
20:47hiredmanhmmm
20:48lambdatronic(persistent! (pop! (transient (vector [1 2] [3 4]))))
20:48lambdatronicYields => [[1 2]]
20:48lambdatronicLooks right to me.
20:48hiredmanyes
20:48lambdatronicjust replacing the last element of the vector.
20:49lambdatronicas in...
20:49lambdatronic(persistent! (conj! (pop! (transient (vector [1 2] [3 4]))) [5 6]))
20:49lambdatronicYields => [[1 2] [5 6]]
20:50hiredmancan you try it without the destructuring?
20:51lambdatronichmm...
20:52alexykhow do I write a serializable Java object to disk from Clojure?
20:52hiredmanhow do you do it from java?
20:52lambdatronic;)
20:52alexykum... with streams...
20:53hiredmansameway
20:55polypusis compojure's request handling multithreaded?
20:56lambdatronicwell, I removed the destructuring and got the same error.
20:56lambdatronichmm...
20:57alexykok how do you write this with ..: new ObjectOutputStream(new FileOutputStream(fileName)) ?
20:57lisppaste8lambdatronic annotated #91970 "transients of doom - sans destructuring" at http://paste.lisp.org/display/91970#4
20:57lambdatronic(ObjectOutputStream. (FileOutputStream. filename))
20:58alexyk..and I was looking forward to .. ! :(
20:58lambdatronicno method calls, just new
20:59alexykright
20:59lambdatronicwhich is native clojure
20:59lambdatronic*shrugs*
20:59lambdatronictake a look at clojure.contrib.duck-streams
20:59lambdatronicit contains magic.
21:00hiredmanlambdatronic: for binary files duck-streams is not so good yet
21:00lambdatronichmm...ah well.
21:00lambdatronicworth a shot.
21:00hiredman(into (sorted-map) (map identity (persistent! all-unique)))
21:00lambdatronicanyway...you still alive, o mighty chouser?
21:01hiredmanhmmm
21:01alexykI mean it's right as in good! :)
21:01karmazillawhy (map identity ...)?
21:02lambdatronicerm?
21:02hiredmanI was just trying to stick in a layer of indirection
21:03lambdatronicdid it help?
21:03hiredmanhaven't tried it yet
21:04hiredmanI need to download a copy and muck with it
21:04lambdatronicalright, I'll give it a shot.
21:04lambdatronicit would appear chouser has returned to olympus
21:08lambdatronicooh...check it out.
21:08lambdatronicI might have fixed it!
21:10lisppaste8lambdatronic annotated #91970 "transients of doom - shazam!" at http://paste.lisp.org/display/91970#5
21:10hiredmaninteresting
21:11lambdatronicisn't it though.
21:11lambdatronicspooky
21:11lambdatronicI guess conj! pop! is vetoed
21:17lambdatronicand here's the amazing part.
21:17lambdatronicthat actually uses more memory and is slower (by a tiny bit) than just building the whole thing up in a sorted map to begin with.
21:17lambdatronicthe transients buy me nothing.
21:17lambdatronicdamn
21:25lisppaste8lambdatronic annotated #91970 "transients of doom - profiled" at http://paste.lisp.org/display/91970#6
21:25lambdatronicand for the ultimate in irony, ladies and gentlemen, please examine this paste!
21:25lambdatronicnot that the transient version uses more than twice the memory of the non-transient code.
21:25lambdatronic??!
21:26lambdatronicnote that...
21:27pedroteixeiralambdatronic, is that using the new branch from github?
21:27lambdatronicit's the current master
21:30pedroteixeirawould the recent optimizations http://groups.google.com/group/clojure/browse_thread/thread/14baed8f26097515 do any good?
21:32tolstoyHm. I've created a little Java class. Put some methods on it, then made a proxy of it in Clojure, and none of my overridden methods get called. Clearly, I've completely misconstrued what "proxy" is. Oops!
21:34lambdatronicpedroteixeira: it's a good idea, but someone mentioned earlier that a test of my pasted code still bombed hard on new.
21:34lambdatronicI'll give the fixed version a trial run though for profiling. thanks for the reminder.
21:38pedroteixeiranice, lambdatronic :)
22:00tolstoyI really love Clojure, but I can't even manage to compile an actual file. Holy Jaysus!
22:09tolstoyAhah! If you have every directory on your filesystem in the class path, it works! ;)
22:10danm_haha
22:11tolstoyReminds me of day 1 with java oh those many tortured years ago.
22:11tolstoyLisp and Macros I can handle. Classpath? Oy.
22:24alexyktolstoy: leiningen will save you from the monster of classpath
22:25tolstoyalexyk: Thanks.
22:26alexyknp
22:27tolstoyWe have this service framework that you're sposed to subclass (I hate it), but I just don't see how it can be done in Clojure.
22:27tolstoyCertainly not in a script context.
22:28tolstoyProxy won't work because I need to implement callbacks. Java calling back into Clojure code.
22:29danm_I thought that was one of the use cases for proxy? but I'm just a noob.
22:29tolstoyThat's what I thought, too.
22:30drewryou can do that
22:30tolstoyYou can use proxy to extend a class. In Clojure, you can call methods on that class. If the methods aren't in the proxy, it'll call the super class.
22:30tolstoyBUT, if the superclass calls a method you think you've overridden in your proxy, no go.
22:31tolstoyHell, maybe I've got it all wrong somewhere in here.
22:32tolstoyIn another test, I was able to create proxies that implemented Jetty Handler interfaces, and hand them off to the Java code an things worked.
22:40tolstoyAHA! It's because those esteemed colleagues do massive amounts of side-effects in the CONSTRUCTOR of the superclass!
22:40tolstoyEr, wait.
22:44tolstoyOkay. So it seems that when you use the proxy, the object is constructed first, and if the constructor calls methods in its class, they're not delegated to the proxy until AFTER the constructor is done.
22:48itistodayi'm not sure i understand the double-colon
22:48itistodaywhat is a name-space qualified keyword?
22:48itistodaywhy would you need one?
22:48itistodayi've been trying to find documentation on this and haven't been able to
22:50tolstoyI think it's just a short cut.
22:50itistodaymy impression was that keywords exist in a single, global namespace
22:50tolstoyI know I just read something where they used it. Hm.
22:50itistodaythe existence of namespace qualified symbols thus confuses me
22:51tolstoyaren't all symbols namespace qualified?
22:51devlinsfhttp://groups.google.com/group/clojure/browse_thread/thread/8d77ad0da8d190c8
22:51itistodayerr.. i meant namespace-qualified keywords
22:51devlinsfThe qualified keywords came up there
22:52itistodaydoes clojure not have documentation that explains what they are?
22:52tolstoyKeywords exist simply because, as you'll see, it's useful to have names in code which are symbol-like but not actually symbols. Keywords are by default not namespace-qualified. However, in some cases it may be useful to generate a keyword that is namespace-qualified so as to avoid name clashes with other code. For that purpose, one can either qualify the namespace explicitly or type a symbol preceded by two colons
22:53tolstoyhttp://en.wikibooks.org/wiki/Learning_Clojure
22:54itistodayok thanks, but that doesn't explain what how a keyword can be associated with a namespace
22:54itistodayor rather, why that should be at all
22:54tolstoy,::foo
22:54clojurebot:sandbox/foo
22:54devlinsf,*ns*
22:54clojurebot#<Namespace sandbox>
22:55itistodayi.e. what sort "name clashes" are being referred to?
22:55danm_,:foo
22:55clojurebot:foo
22:55hiredmanitistoday: for the same reason symbols can be namespaced qualified
22:55hiredmankeywords can be used for just about anything
22:55danm_itistoday: in case someone else has defined a keyword with the same name which is in scope I guess?
22:56itistodayhiredman: i understand that symbols can be name space qualified, but i thought one of the points of keywords was that they all exist in the same namespace
22:56danm_by default they don't resolve to any namespace, right?
22:56itistodaythus if you have a map: {:blah 5}, you can look it up with the same keyword no matter what the namespace
22:56hiredmanitistoday: sure
22:56hiredman:blah is not namespace qualified
22:56itistodayok, so what is this business about namespace qualified keywords?
22:57itistodayif one of the points of keywords is that they're *not* associated with any namespace?
22:57hiredmanwhen you are using namespaces as identifiers
22:57hiredman,::blah
22:57clojurebot:sandbox/blah
22:57hiredmanthat is namespace qualified
22:57itistodayhiredman: not sure what you mean by "namespaces as identifiers"..?
22:57hiredmansorry
22:57hiredmankeywords as identifiers
22:58hiredmanif you are using a pluggin system
22:58hiredmanand plugins have access to store
22:58hiredmanif you store something with the key :a, another plugin might overwrite it
22:59itistodayhiredman: store something where?
22:59hiredmanbut if you use a anemaspace qualified keyword
22:59hiredmanitistoday: whereever
22:59hiredmancould just be a hashmap somewere
22:59hiredmancould be persisted to to disk
23:00hiredmankeywords can be namespace qualified for the same reason symbols are
23:00hiredmanto avoid clashes
23:01itistodayi think it would greatly help me (and others trying to learn clojure) to understand the reason for namespace qualified keywords if there were some practical example in the docs as to the sort of problems they solve
23:03tolstoyhiredman: I figured out what was wrong with the proxy object thing with abstract methods. Not sure you remember that from earlier today.
23:03hiredmanI just gave you an example
23:03hiredmantolstoy: all ears
23:03hiredman(eyes?)
23:04itistodayhiredman: sorry, i didn't quite understand your example, it wasn't very detailed
23:04tolstoyhiredman: I think the proxy object instantiates the superclass BEFORE it registers the overridden methods.
23:04tolstoyhiredman: In my particular use case (condemned to use bad code five years old), the constructor calls a bunch of its own methods when it instantites.
23:05hiredmanah
23:05hiredmanyeah it would have to
23:05itistodayhiredman: let me know if this is accurate
23:05hiredmanyou have to call super irst
23:05hiredmanfirst
23:05tolstoyThe constructor context doesn't know about, say, the implementation of the abstract method until AFTER the constructor is done. (Seemingly.)
23:06hiredmanexactly
23:06tolstoyAnd the folks who wrote all this stuff START UP SOCKET SERVERS in constructors.
23:06hiredmanbecause the call to the super class constructor has to be the first thing in a constructor
23:06tolstoyNot that I'm bitter, or anything.
23:06tolstoyYeah.
23:07itistodayhiredman: nope, never mind, i thought i had a reason for why namespace-qualified-keywords (NQKs) might be needed but turned out to be a bad reason...
23:07tolstoyPersonally, I took the word constructor litterally, bit naievely. It's just there to assign instance vars, or better, do nothing. ;)
23:08tolstoyitistoday: I think there's an example in the printed book that uses them for multi methods.
23:08itistodaytolstoy: unfortunately i don't have the book, but i do have this: http://blog.thinkrelevance.com/2009/8/12/rifle-oriented-programming-with-clojure-2
23:08hiredmanitistoday: like if I want to add something to the metadata mapa on an object, if I just add it with the key :a, it is possible some other function out there also twiddles the key :a
23:09itistodayhiredman: then why wouldn't you use a namespace qualified symbol to store it instead?
23:09hiredmanitistoday: because I can use a namespace qualified symbol
23:10itistodayhiredman: you mean keyword?
23:10hiredmanyes
23:10itistodayhiredman: ok, so this is just out of love for using the colon syntax everywhere..
23:10hiredmanit's just more convient
23:11hiredmankeywords print and can be read back with out changing their resolution behaviour
23:11hiredman,(prn 'foo)
23:11clojurebotfoo
23:11hiredmanif you read that back in and eval it you can something completely ddifferent from 'foo
23:12hiredmanit will try to resolve foo
23:12itistodaywhy couldn't it print it out as 'foo then?
23:12hiredmanbut keywords don't have that problem
23:12hiredmanitistoday: you could never print an unquated symbol then
23:13hiredmanquoted
23:13tolstoySo, the question is really why keywords instead of symbols, with namespaced keywords just an extra sophistication.
23:13hiredmantolstoy: the real question is why itistoday cares so much about it
23:14hiredmanmy guess is he misses common lisp
23:14itistodayhiredman: i care because i'm deeply interested in software and languages
23:14itistodayhiredman: i hate CL
23:14itistodayperhaps hate is too strong of a word ... sorry, i "don't like" it :-p
23:14itistodayhate i usually reserve for C++ ;-)
23:15hiredmanwell CL, from what I gather, has the keyword behaviour you seem to want
23:15hiredmankeywords in cl just being symbols in the keyword namespace
23:15itistodayit's just that upon discovering these "NQKs" it now seems to me that keywords are no longer as special or different from symbols as they would be without it
23:16hiredmanno
23:16tolstoyso, symbols refer to other things, and keywords refer to themselves
23:16hiredmantolstoy: exactlly
23:16hiredmanthat is the #1 property of keywords
23:16tolstoya keyword can never refer to anything else
23:16itistodaytolstoy: yes, i understand that
23:16hiredmanthey are like numbers
23:16tolstoyJust working it out for myself, itistoday.
23:17itistodayhiredman: ok, that's a perfect analogy, they *should* be like numbers
23:17itistodayimagine if you came across a namespace qualified number
23:17itistodaythat is how i feel
23:17hiredmanitistoday: -1
23:17interferoni am completely hitting a wall with these exception messagez
23:17hiredman1i
23:17tolstoyHm. So, using :<name> signifies to all concerned that you're not working with a symbol that might refer to a function or string if it were evaluated.
23:18interferoni have a runtime exception trying to evaluate a sequence and i don't see anything but clojure.core functions in the stacktrace
23:18itistodayhiredman: not sure what you mean?
23:18interferonwhat do people use to debug?
23:18itistodayhiredman: -1 and 1 are different...
23:18interferonjswat?
23:18hiredmanitistoday: what is the difference between 1 and -1
23:19itistodayhiredman: that's a philosophical question
23:19hiredmanlets say +1 and -1
23:19tolstoyinterferon: You didn't happen to use ( ) for fun params, rather than [ ], did you?
23:19itistodayhiredman: +1 and -1, both of them are numbers, they evaluate to the same mathematical quantity
23:19hiredman+1 is 1 qualified in the positive namespace
23:19interferontolstoy: doesn't look like it
23:19hiredmanitistoday: the certianly don't
23:19itistodayhiredman: no, you are confusing terms
23:19tolstoyinterferon: Heh. Well, that one got me a few times.
23:20interferonme too :)
23:20itistodayhiredman: when i said "same quantity" i meant they both evaluate to the same number (each of them)
23:20interferontolstoy: i come from CL and schema
23:20interferon*scheme
23:20itistodayhiredman: you are confusing terms, mixing namespaces with your newly invented term "namespace" to signify something completely different
23:20tolstoyinterferon: I've used those as well. But the error message is totally opaque.
23:20hiredmanitistoday: what does a namespace signify?
23:21itistodayhiredman: here is what I am referring to: user/1 being different from foo/1
23:21itistodaythat is what a namespace is, not the +/-
23:21itistodayso you would suddenly have a 1 that meant different things in different namespaces!
23:21hiredman,:+/1
23:21clojurebotInvalid token: :+/1
23:21itistodaythat would be bizarre
23:21hiredmanno you wouldn't
23:21itistoday,user/1
23:21clojurebotInvalid token: user/1
23:22interferonso is jswat the preferred debugging tool?
23:22itistodaysee, clojurebot rightfully thinks that's stupid
23:22interferonare there other options?
23:22hiredmanbecause a keyword always evaluates to ittself
23:22tolstoyinterferon: I've no idea what people use. I use println. Yep. Sad to say.
23:23clojurebothiredman is correct
23:23itistodayhiredman: either you believe in your analogy that keywords are like numbers or you don't, you can't adopt self-conflicting points of view
23:23hiredmanitistoday: in what way are keywords not like numbers?
23:23itistodayhiredman: in that in Clojure, keywords can be namespace qualified
23:23itistodayhiredman: in CL they can't, and that's good
23:23hiredmanand numbers have a sign
23:23tolstoyitistoday: Analogies are just helpful, not metaphysical. Keywords eval to themselves like numbers do, but they're not numbers, eh?
23:24itistodayhiredman: the sign is not a clojure namespace
23:25itistodaytolstoy: yes, i understand, in Clojure keywords aren't like numbers, this is what i learned today from you and hiredman, my original question was answered. i just wish they were like numbers. :-p
23:25hiredmanitistoday: I could write some basic arithmetic functions that manipulate keywords of the form :negative/num_1 and :positive/num1
23:25tolstoyitistoday: Ah, well! There's nothing from stopping you using them that way in your code, though, right?
23:25hiredman:imaginary/num_1
23:26itistodaytolstoy: true. :-)
23:26tolstoyitistoday: But if we use your code, and want to use that name for our own thing, we can ::<your-global> and use it locally.
23:26tolstoyRather than, say, :<my-bigass-classname>/keyword.
23:26itistodaytolstoy: you could also do it like C and append a short prefix
23:27tolstoyYeah.
23:27itistodaytolstoy: i dunno, perhaps i'm old fashioned ;-)
23:27itistodayhiredman: i understand your analogy, but i'm just trying to take it literally, not figuratively as you are
23:28itistodayhiredman: a -1 will be the same thing in all namespaces
23:28hiredmanclojurebot: :negative/num-1 + :positive/num-1 |=| :zero/zero
23:28clojurebotOk.
23:28tolstoyI get the impression that hardly anyone uses it. I mean, let's say it's just wrong to namespace keywords. Is it a deal breaker? ;)
23:28hiredmanitistoday: only if you are attached to that particular notation
23:28hiredmantolstoy: that is wrong
23:28hiredmanit is used everywhere
23:28tolstoyhiredman: Ah. Okay. :) I had no idea.
23:29tolstoyhiredman: Haven't read enough source code yet. Spending all day on this proxy thing hasn't helped.....
23:29hiredmanclojure.zip for example, hangs pieces of the zipper infrasrtucture in metadata
23:30hiredmanclojurebot's plugin stuff
23:30hiredmanany serious use of mutlimethods
23:31itistodaysee, i suppose the reason i'm a bit upset about this is because to me keywords are now almost self-contradictory in nature in clojure. their purpose was to exist as symbols that evaluated to the same thing *everywhere*, and now there is this new syntax that says "but.. not really", and i'm thinking, "oh, you mean just like symbols?" ... eh... i give in. i can only be incredulous for so long. now that i understand what the :: syntax i
23:31itistodays, i will be pacified. thank you hiredman and tolstoy for your explanations. :-)
23:32hiredmanitistoday: the only time a keyword is not evaluated the same every where is if you use the :: shortcut
23:32itistodayhiredman: yes. i understand that nwo
23:32itistoday*now
23:32tolstoyHm. But :keyword and ::keyword are not the same keyword, so that's still true?
23:32itistodaytolstoy: right
23:32hiredman:: just means "qualify this keyword with the namespace I am in now"
23:32itistodayah, so they "could be"
23:32itistodayheh
23:33itistodayconfusing
23:33hiredman,:a
23:33clojurebot:a
23:33hiredman,::a
23:33clojurebot:sandbox/a
23:33itistodayi personally would prefer :myPrefix-foo
23:33hiredman,(= :a ::a)
23:33clojurebotfalse
23:33itistodayit reduces confusion
23:33hiredmannope
23:34itistodayand the last reason that i'm upset about this is that this doesn't seem to be documented on clojure's website
23:34itistodaythis is an obvious point of confusion
23:34itistodayand it should be clearly explained what they are and why they are
23:34itistodayi.e. a justification (as hiredman provided) for their existence
23:34hiredmanitistoday: http://clojure.org/data_structures#toc8
23:35tolstoyhttp://clojure.org/data_structures
23:35itistodayit's not explained there
23:35itistodayif you think that is an explanation you ... shouldn't ever be allowed to write documentation
23:35tolstoyitistoday: I sympathize. For me, a lot of examples of why you'd care one way or another would help.
23:36tolstoyitistoday: I don't mean YOU, I mean, how keywords are useful.
23:36hiredmanthe fact that it needed to be explained to you has been anomalous
23:36itistodaytolstoy: gotcha :-)
23:36tolstoyEr, I mean, I wouldn't mind seeing good example of how one can leverage the feature. There. That's what I meant.
23:36hiredmanmost people either don't care, or understand
23:36itistodayhiredman: i would be willing to bet money this is a point of confusion to clojure newcomers
23:37itistodayhiredman: most people either don't care, or don't understand
23:37itistodayyou know how I know that? because *it's not explained anywhere*
23:37hiredmanitistoday: as I have been here for for at least a year helping people learn clojure, I can tell you it isn't
23:38tolstoyI visited clojure a year or so ago, and it's stunning the progress on documentation thus far.
23:38hiredmanitistoday: then explain why people use namespace qualified keywords in libraris all the time?
23:38itistodayhiredman: because they know what they are
23:38itistodayas to how they know i couldn't begin to tell you as i'm not them
23:39itistodayhiredman: surely you don't think that most people who use or try to use clojure write clojure libraries?
23:39hiredmanitistoday: these days, yes
23:40hiredmanmost people seem to post something to github on their sedcond or thiird day
23:40hiredmanusually an uneed wrapper around ajva library
23:40itistodayhiredman: you only hear about the ones that do, lol
23:40itistodayyou don't hear about the people who go to clojure's website, try to make sense out of it, and leave in disgust
23:41itistodayor perhaps they leave feeling inadequate ;-)
23:42hiredmanitistoday: I hear plenty of people complain about such and such not ebing documented, and then when I point them at the docs they say "oh, but thats not where I expected" or "there are no examples", or some other execuse for why they want someone to hold their hand
23:43itistoday"there are no examples" is not an excuse, but a perfectly valid criticism of documentation
23:43itistodaygood documentation always has examples
23:43itistodayclojure's documentation, is not good
23:43itistodayit is barely acceptable (in my opinion)
23:43hiredmanit is a valid criticism on it's own, but in that context it is just another of a infinite list of complaints basically
23:44itistodayin your eyes, whatever, "sounds like 'complaining' to me", lol
23:44itistodayin they're eyes it's shitty or totally non-existent documentation
23:44itistoday*their
23:44hiredmanthe documentation is there
23:44hiredmanthe code is there
23:45itistodayi'm not disputing that
23:45qeditistoday: help make it better
23:45tolstoyI remember learning Java in 2000 or so, and spent many an hour writing all kinds of code, only to discover it was alreayd in the JDK. Took me quite a while to figure out how to read the docs.
23:45hiredmanpeople just what to whine
23:45itistodayqed: i would, i would love to, unfortunately my work doesn't involve much of clojure (yet)
23:45qedtolstoy: yeah i suck at reading java docs so far
23:45qedim a noob
23:45hiredmancome in and throw their weight around
23:46qeditistoday: do it because you're interested in learning something new and helping a community grow in the process
23:46qeddont just be an asshole
23:46itistodayqed: i would, if i were using clojure more
23:46qedjust sayin'
23:46itistodayqed: currently it's just a passing interest
23:47tolstoyqed: After a while you get a feel for it. Weird how that is.
23:47itistodayqed: i'm sorry if you view valid criticism as being an "asshole"
23:47itistodayqed: i'm not trying to be an asshole, sorry if i came across that way
23:48itistodaycriticizing something is the only way to bring attention to something that needs to be improved
23:48itistodayerr... well, that and actually improving it yourself :-p
23:49itistodayif anyone who is involved with clojure's documentation cares, i highly recommend taking a look at how newlisp does its documentation: http://www.newlisp.org/downloads/manual_frame.html
23:49qedcool ill check it out
23:49itistoday:-)
23:50hiredmanleave the dead (people who complain about docs) to bury the dead (endless fiddle with docs)
23:50qedhiredman: i really just need examples
23:50hiredmanthe docs are there, and good enough to start coding with
23:50itistodayhiredman: you know, if the docs were better you'd have fewer people in here complaining and asking questions
23:50itistodayhiredman: it'd make your job easier ;-)
23:51_mstI thought #clojure was a collaborative documentation effort... this all gets logged, right?
23:51qedindeed it does
23:51qedbut no one is actively transcribing
23:51hiredmanitistoday: I have no problem with questions
23:52tolstoyI find the docs mostly good enough. When I don't, I futz around with the code, then read the docs again, and see that it told me what I needed to know all along.
23:52qedmaybe that's my new job... ill start compiling the logs in tagged posts or something
23:53tolstoyThis was awesome for me (having spent time with CL): http://java.ociweb.com/mark/clojure/article.html
23:53qeda well documented project needs to provide many different forms of documentation
23:53hiredmanclojurebot: can the hyperspec help us here?
23:53clojurebothyperspec is not applicable
23:54technomancyitistoday: that's why he wrote clojurebot
23:54technomancyto answer questions for him
23:55technomancyhiredman: in #emacs the bot will treat a single word followed by a question mark as a lookup. kind of funny how often that actually helps.
23:55hiredmanit's not going well
23:55hiredmantechnomancy: hmmm
23:56technomancyalso "what is $TERM?"
23:56itistodaytechnomancy: didn't know hiredman wrote clojurebot. hiredman: cool beans!
23:57technomancyitistoday: he did, after I told him to. =)
23:57itistodayhehe, wow
23:58technomancyand then I told him I'd help him with it, but I never did
23:58itistodayclojurebot seems pretty solid as it is though
23:59technomancywell I did write some retarded SVN watcher that just shelled out to the svn command-line XML output, but that got quickly replaced