#clojure logs

2009-08-04

00:00mebaran151so that I can get the first n intersections per se
00:00hiredmanI imagine you migt be able to build some kind of custom lazy-seq creater that calls filter using the previous set to filter the current set
00:01hiredmanare these sorted-sets?
00:02mebaran151I could use a sorted-set easily
00:03mebaran151but I shouldn't think sorted-set would matter
00:03hiredman,(first (set 4 5 6))
00:03clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$set
00:03hiredman,(first (set [4 5 6]))
00:03clojurebot4
00:04hiredman,(first (set [5 4 6]))
00:04clojurebot4
00:04hiredmanhrm
00:05hiredmanok
00:05hiredmanhrm
00:06hiredmanI don't know
00:07hiredmanok
00:08hiredmanugh
00:08hiredmanit is going to be kind of like reduce
00:08hiredmanor really reductions
00:08hiredman,(doc reductions)
00:08clojurebot"([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."
00:14hiredmanlisppaste8: url?
00:14lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
00:15lisppaste8hiredman pasted "f" at http://paste.lisp.org/display/84715
00:15hiredmanmaybe something like that
00:15hiredmanI haven't tested it
00:16mebaran151cool
00:16hiredmanof course I haven't, or else that recur wouldn't be there
00:16mebaran151I think reductions should do it
00:16hiredmanthe recur should be replaced with a call to f
00:19mebaran151reductions isn't in the standard library ?
00:20JAS415so, i'm using apache httpclient 4.0
00:21JAS415but it seems like it sucks compared to commons httpclient (3.0)
00:21JAS415is this true?
00:21mebaran151JAS415, check out xlightweb's htttp client
00:21mebaran151it's much better, and has a really easy to use async mode
00:21JAS415well the thing is that i've got most of the code working
00:22JAS415i can use oauth authentication and grab googlecharts
00:22JAS415problem is httpclient 4.0 wants to encode all my urls without asking
00:22JAS415which is a violation of my trust... :-P
00:22JAS415(and screws up my charts...)
00:23JAS415but i will check out xlightweb certainly
00:27mebaran151I started with apacheclient and got sick of it
00:28mebaran151besides xlightweb cooperates with the thread model much better
00:28JAS415i'm not suprised
00:29JAS415apacheclient is kind of like an unruly 2 year old :-P
00:29mebaran151essentially I want to put a filter in front of lazy seq
00:29mebaran151xlightweb is brought to you by people who are considered jetty's competition
00:29mebaran151that's Serious Business
00:29hiredmanmebaran151: it's in contrib
00:29hiredman,(doc reductions)
00:29clojurebot"([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."
00:29hiredmanhuh
00:29hiredmanoh
00:30mebaran151reductions doesn't quite do what I want
00:30hiredmanyeah
00:30mebaran151because it's still giving me a list of lists
00:30JAS415what do you want to do exactly?
00:30hiredmanthat's why I said like reductions
00:30JAS415you want to filter a lazy seq (wasn't in channel)
00:30mebaran151#{0} #{0 6} #{0 6} #{0 6 12} #{0 6 12 18}
00:30mebaran151that's a list of sets
00:31mebaran151I want to lazy union them
00:31mebaran151so that if say I wrote (take 5 (magical laziness))
00:32JAS415you'd get union of the first 5
00:32mebaran151yeah
00:32mebaran151I want that union to look like an infinte stream
00:32mebaran151the internal algo should visit each iterative set until it gets enough to satisfy the take
00:33JAS415like reduce only with a delay
00:33hiredmanI don't think that is possible
00:34JAS415i feel like you could do it with a hidden atom
00:34mebaran151yeah
00:34mebaran151a magical hidden atom
00:34JAS415use the atom like a closure and make it persistent across
00:34mebaran151but that seems a little bit nasty
00:34JAS415only problem is that you can access it in any order and get the same thing
00:34mebaran151also there might be a bunch of these in fligt
00:34mebaran151it would be a pity i I had to write my own take
00:35JAS415yeah magic atom is a bit ugly
00:35mebaran151and then tell my comrades they couldn't use all the coolness of the lazines fo ojure
00:36mebaran151like it seems like a pretty simple lazy function on some level
00:36JAS415the description is simple and the actual problem is hard
00:36hiredmanif you think so, then write it
00:36mebaran151keeping hitting successive sets until you get enough to satisfy the take
00:36mebaran151heh, I can't figure out a way!
00:37mebaran151(then again, I've only been wrapping my bdb library in laziness for about a day, so I don't know all the uber magic)
00:37mebaran151is there a concat-with-filter
00:37JAS415eh
00:37JAS415i'm not sure there is a win from making it lazy though
00:38JAS415well there must be i guess
00:38mebaran151I have to make it lazy
00:38mebaran151there are potentially an infinite number of things
00:38JAS415ooh
00:38hiredmanok
00:38hiredmanthat is not going to work
00:38mebaran151those sets iterate forever
00:38JAS415but if you are doing like
00:39hiredmanmebaran151: how do you know if 0 is in every set, if there is in infinite number of them to check?
00:39JAS415(reduce union (take n (listofsets)))
00:39arohnermebaran151: which is infinite? the number of items in a set, or the number of sets?
00:39hiredmanarohner: no infinite sets
00:40JAS415infinite sets are cool
00:40mebaran151the number of sets
00:40mebaran151an infinite set would be pretty weird
00:40hiredmanmebaran151: yeah, that is just not going to work
00:40mebaran151you don't need to
00:40JAS415no there must be a way to
00:40hiredmanclojurebot: ruleset?
00:40clojurebotTitim gan éirí ort.
00:40mebaran151thesesets are a little specally
00:40mebaran151in that they'rebuilt from unions of the prior sets
00:41mebaran151so yeah, each is a superset of the prior set
00:41mebaran151they represent pulling more and more data from the databasetab
00:41mebaran151so you can be silly and check only the first n sets
00:41arohnerleaving clojure aside, I don't see how you determine 5 items out of the unions of all these sets lazily
00:41mebaran151until you get enough matches
00:42hiredmanhttp://paste.lisp.org/display/80355
00:42JAS415yeah
00:42mebaran151arohner, I would like it if I could just slipstreem it
00:42JAS415i used that to make my clojure inline + and * to whatever arity
00:42mebaran151so that underneath it's a bunch of iterative sets
00:43hiredmanthe problem with rulesets is you can't generate seqs from them, and all the function in clojure.set turn sets into seqs
00:43mebaran151I don't think I'd even need that
00:43JAS415yeah i guess they don't have an order do they
00:43mebaran151maybe I'm approaching the problem wrong
00:44JAS415probably :-P
00:44mebaran151I have a series of n cursors
00:44mebaran151that each point to a bunch of k v pairs right
00:45mebaran151I want to grab the first v values that have a key pointing to them
00:45mebaran151so k1 v1 k2 v1 k3 v1 would return k1 and k2
00:46mebaran151it's essentially a natural join
00:46JAS415(let [seq infinite-lazy-seq-of-sets]
00:46JAS415 (repeatedly (memoize #(take %1 seq))))
00:46JAS415?
00:46JAS415oh
00:46mebaran151I have something like that
00:46JAS415throw in a reduce union in there
00:46mebaran151I do!
00:46mebaran151that's how you get the nested sets
00:47mebaran151you can't reduce union the whole thing, because I just want the cursors to scan up the number of results that are requested
00:47hiredmanthis is from a database?
00:47mebaran151berkeleydb
00:47mebaran151it doesn't provide me with no fancy sql's
00:47hiredmanlazy access to db seems like a bad idea
00:47JAS415so..
00:47mebaran151oh
00:47mebaran151I make sure to close my cursors and everything
00:48mebaran151I have a set of functions that return views, which are essentially lazy list representations of a b tree
00:48lisppaste8Chouser pasted "lazy-union" at http://paste.lisp.org/display/84716
00:49JAS415hahaha sweet
00:49mebaran151coolio
00:49ChouserI imagine that can be refined a bit
00:49hiredmanChouser: and it works on an infinite sequence of sets?
00:49Chouserbut I should be sleeping.
00:49Chouserhiredman: don't see why not
00:50mebaran151gentleman we have a winner
00:50Chouserit hangs onto a real set of the elements seen so far, so that'll grow indefinitely
00:50hiredmanChouser: because how could it check to see if a value is a member of an infinite number of sets
00:50mebaran151you don't have to, because these are just spiraling unions anyway
00:50JAS415oh man, that's philosophical
00:50Chouserif the first seq is infinite, it'll never look at the others
00:50mebaran151if it's in the first set, I'm happy
00:50mebaran151if it's the second set I'm happy
00:51JAS415oh man
00:51mebaran151if it's in the third set I'm happy
00:51JAS415just don't write a loop depending on it being in the set
00:51mebaran151these sets aren't arbitrary
00:51mebaran151they're based off each other
00:51mebaran151this was perfect!
00:51hiredmanwell then it's hardly a general lazy-union
00:51mebaran151that function was definitely cool beans
00:52JAS415gonna be hard to do generally without holding on to a ref
00:52mebaran151in the end the iterations end, because you fall off the end of the tree
00:52mebaran151so philosophically I'm safe too
00:53mebaran151each of those sets contain a result set which is predetermined to be a potential solution to the criteria
00:53mebaran151thanks Chouser!
00:53Chouseryw
00:53ChouserI thought I'd need a loop, that's why I used lazy-seq
00:54Chouserbut since I did the skipping with drop-while, I bet this could be written using iterate instead.
00:54mebaran151heh
00:54Chouserhowever, I must refrain. Perhaps as an exercise for the reader.
00:54mebaran151iterate is a very cool function
00:54ChouserI should not be awake, I just couldn't resist when someone uses words like "impossible". :-)
00:55mebaran151(its how I build my result sets in the first place)
00:55Chouserg'night!
00:55mebaran151ha
00:55hiredmancall it lazy union if you want
00:56mebaran151I understand it's not fully general
00:56JAS415doing impossible things is funny
00:57mebaran151but I essentially just wanted a stream-union
00:57mebaran151sort of thing
00:58mebaran151I don't quite see why it isn't rigorous: if I have an infinite list of sets, an item in the union of the first two will by definition be in the union of the rest
00:59mebaran151so if my constraint is to want at least 5 items, and the operation is actually union, I think I'm safe, even if the sets were completely arbitrary
00:59mebaran151now a lazy intersection would make much less sene
00:59mebaran151*sense
01:00hiredmanyou're right, union is associative
01:00tomojI had a somewhat similar problem that involved a strange solution
01:00tomojit seems like you'll be generating elements of the sequence faster than they are asked for
01:01mebaran151most likely
01:01mebaran151the prefetch is not a problem though
01:01mebaran151in my code you specify a chunk size of records to fetch at a time, depending on how you plan to use them
01:02JAS415perhaps i should be blaming java for my troubles
01:02mebaran151hah my logic course has finally paid off
01:02tomojprefetch was problematic for me
01:02tomojbut I am a clojure noob
01:02mebaran151as am I
01:03mebaran151the other nice thing about clojure lists is there are no mutable operations
01:03tomojI ended up having to do this: https://gist.github.com/4317ccd3662750ec3876
01:03JAS415i kind of like being a noob
01:03mebaran151so none of my coworkers will be fooled into thinking they can WRITE to the database this way
01:03tomojwhich is very opaque
01:03mebaran151not terribly
01:04mebaran151I think I follow it
01:04mebaran151heh, we could have an obfuscated clojure contest
01:04mebaran151who can write macros that do the most evil
01:04JAS415http://paste.lisp.org/display/84717
01:04JAS415i've already written an evil macro
01:04JAS415so this means that it won't parse my string into a uri
01:04JAS415although it will parse it as a url
01:04JAS415string is
01:05tomojthe problem was to do this iteration "10" "101" "10110" "101101011" (i.e. you take the previous string, concatenate it with itself, and chop off the last character), but return those bits in a lazy sequence one at a time
01:05hiredman,(pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x)))
01:05clojurebot(1 2 3 4 5 6 7 8 9 10)
01:05JAS415string is in the error
01:05tomojso I had to prefetch a bunch of bits and return them one at a time. but the naive implementation did an infinite loop
01:05mebaran151intersection is commutative right?
01:05tomojyeah
01:05JAS415hum
01:05mebaran151yeah it has to be
01:06tomoj"and" is commutative
01:06mebaran151that's not always the best test
01:07hiredman,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle))
01:07clojurebot((20 100 60 10 80 50 70 90 30 40) (30 100 40 20 90 60 80 10 50 70) (70 40 20 50 30 90 80 10 60 100))
01:07tomojmebaran151: not sure what you mean
01:07tomojintersection is a thin wrapper around "and"
01:07mebaran151sometimes grammar rules can trick you
01:07mebaran151oh
01:07mebaran151yeah, logical and certainly
01:08tomojah, yeah
01:08tomojenglish is weird :)
01:09JAS415i can't believe i cant use httprequest without going through URI
01:09JAS415that's lame
01:09mebaran151welcome to Java Land
01:10mebaran151as I said yesterday, for BerkeleyDB, I've built so many factories I feel like the Soviet Union
01:10mebaran151for something as simple as reading a key and writing a key in an ordered Btree, you shouldn't need configuration factory objects
01:11JAS415well it just makes it impossible to use that method with certain things
01:11tomojJAS415: what http client are you using?
01:11JAS415as much as i really like clojure i hate java
01:11tomojclojure-http-client can take strings
01:11JAS415i'm using apache httpclient
01:11JAS415it takes strings but it mangles and converts them
01:11mebaran151clojure-http-client is not assynchronous which is a bummer
01:11JAS415other things are a no-go as i'm also using oauth signpost
01:12mebaran151I'd submit a patch, but I only got async http to work with xlightweb, which for a Java library was actually relatively sane
01:12mebaran151java should really come with async http built in
01:12JAS415i thought i'd be able to write a library to write interfaces to restful apis, but googlecharts is giving me trouble at the moment
01:12mebaran151wasting threads is so 2002
01:12JAS415because they use commas
01:13mebaran151have you tried it with plain ol' Java.net
01:13JAS415so i'm wasting time trying to figure out away around the arbitrary path that httprequest takes through URI encoding
01:13mebaran151you can do almost anything in Java.net
01:13JAS415I already did it with java.net
01:13mebaran151oh, was there failure?
01:13JAS415no it worked perfectly
01:13mebaran151so, why are you binding Apache Commons?
01:13JAS415then i reimplemented it without .net so that i could use oauth properly
01:13JAS415not commons
01:14JAS4154.0 httpclient
01:14mebaran151.net won't work with oauth?
01:14JAS415i think they are different
01:14tomojmebaran151: what does "async http" mean? the function that does the request returns before the http request finishes?
01:14JAS415i was having trouble
01:14JAS415because of twitter actually
01:14JAS415haha
01:14mebaran151tomoj, instead of the thread stalling, you just give it a success callback
01:14tomojah, I see
01:14mebaran151so the thread can continue to do other work
01:14JAS415oauth only works for twitter auth if you use a certain authorization not supported by .net
01:14tomojluckily I don't need that :)
01:14mebaran151later on, some other manager object will pass your callback the data
01:15mebaran151like ajax
01:15JAS415pretty much this project started off very successfully then managed to cascade into multitudes of incompatibilities
01:16JAS415although i did use the same library to interface with eve-online and twitter, which was fairly neat
01:31mebaran151neato
01:31mebaran151I do something actually pretty similar, but I script the whole thing in Rhino
01:31mebaran151and run the rhino using clojure
01:31mebaran151getting Rhino and clojure to talk to one another was a total pain
01:31mebaran151Rhino liked to return perverse objects that were essentially binary blobs
01:40mebaran151man lazy sequences are cool
02:00JomyootThe .clj file can be compiled?
02:00Jomyootand will compiling help prevent ninjas from stealing my source code?
02:00Carkhclojurebot: compilation?
02:00clojurebotcompilation is see compile
02:01Carkhclojurebot: compile?
02:01clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
02:01Carkhthat's bytecode compilation, that's always decompilable
02:02Jomyootto what? clojure code?
02:02Jomyootor java code
02:02Carkhjava code
02:02Carkhquite unreadable though
02:03mebaran151it makes a class for every fn and other such construction
02:03mebaran151(in java you've got classes and classes)
02:03mebaran151Jomyoot,
02:03mebaran151Java itself can be fairly easily precompiled
02:03mebaran151*decompiled
02:05Jomyootyes but wouldn't we get unreadable java code
02:05Carkhgive it a try
02:05hiredmanit would be odd looking, but I think readable
02:06hiredmanhttp://georgejahad.com/clojure/clojureDecompiled.html
02:06mebaran151eh, I mean if the guy is going to go to all the work to decompile your code, I bet he can work through the clojure source alright
02:06JAS415unreadable java code, redundant! :-P
02:06Carkhlots of indirections, and i guess an object for every closure
02:06JAS415i fixed my problem
02:07Jomyoothader to read than decompiled java
02:08Jomyootwhat is your favorite programming fonts?
02:08hiredmandejavu sans mono has the best unicode coverage by far
02:09mebaran151Jomyoot, any hacker who's gonna go to the lengths to decompile your java and work through is probably willing to spend a little extra time mapping it back
02:09hiredmanconsolas is very nice, but I like having all the glyphs
02:09mebaran151I like Monaco or Monospaced at 13
02:09mebaran151Inconsolata is nice too
02:09mebaran151and free as in freedom!
02:10hiredmanthe Droid fonts from android have a nice monospaced font
02:10hiredmanbut again, dejavu sans mono just has more glyphs
02:11mebaran151I tried Droid, not quite as elegant as Inconsolata
02:13hiredmanλ · → ↑ א₀ ♥ ¡ ¿ ‽ ؟ əə
02:15JAS415why are people decompiling clojure?
02:15hiredmanto get a better understanding
02:16JAS415i just read the source...
02:16hiredman*shrug*
02:17JAS415seems silly to go to all the trouble if you can just download a copy of the java :-P
02:17hiredmanit's interesting to see what the class a function compiles to looks like
02:17mebaran151it's cool to see how the functions translate out
02:18mebaran151hiredman, are extra chars really worth more
02:18mebaran151a friend of mine has been campaigning for them
02:18hiredmanYes
02:18mebaran151but it seems so nasty to get them to work properly everywhere
02:18hiredmanmaybe
02:18JAS415how are you going to type them?
02:18hiredmanI don't remember
02:18hiredmanJAS415: depends
02:18mebaran151he's a smart guy: I think the extra char disease in an artifact of the Comp Sci PhD process...
02:19JAS415i would be more worried about that
02:19mebaran151*is an
02:19JAS415i remember using alt and keypad or something
02:19mebaran151you can map your keyboard
02:19hiredmanyou can do that
02:19mebaran151and then confuse your friends!
02:19JAS415impress women?
02:19mebaran151on his keyboard, he remapped the parens to ; and '
02:19hiredmanfor irssi I have it setup to auto replace somethings with other things lambda => λ
02:19mebaran151and did a bunch of other things
02:20hiredman¿ => ¿
02:20hiredmaner
02:20hiredman.? => ¿
02:20mebaran151 /\ wasn't good enough :P
02:21JAS415i haven't yet met a female impressed by macro writing ability
02:21JAS415even my current girlfriend just laughs at me
02:21hiredman,(pl (inc · inc · inc 1))
02:21clojurebot4
02:21mebaran151make a macro that makes bunny pictures
02:22mebaran151everybody loves bunny pictures
02:23JAS415that's true
02:23JAS415i do like bunnies
02:23JAS415sound logic
02:42mebaran151I had a hard enough time trying to explain to an actionscript guy on my team why infinite lists were just so cool
02:43mebaran151when I was doing Ruby, I always thought the Lisp people's were exaggerating the coolness of macros: I was naive and wrong
02:45mebaran151the coolness of macros can only be appreciated by those who have witnessed their power firsthanded
02:54tomojmebaran151: YES
02:54tomojI am the only one of the group of CS kids I know who appreciates lisp
02:54tomojwell, only rubyist too, but..
02:59mebaran151we needz moar sp33d!!!111
02:59RaynesMOAR!
03:02mebaran151I always thought speed arguments were specious, because the same speed maniacs never rewrote their really tight loops in inline assembly or used all of SSE10 or what not
03:44Fossiis there a quick way to get the negative of a number or is it (- 0 num)?
03:45_mstjust (- num) will do the job
03:46Fossiah, right
04:20LauJensenTop of the morning gents
04:27mebaran151does or short circuit?
04:30tomojmebaran151: yup
04:30tomojI discovered that from (doc or)
04:31mebaran151ha, but it's easier to ask on IRC!
04:31Fossi(or (do (print "foo") true) (print "bar"))
04:31tomojI always have my repl open
04:31mebaran151yep I just did the test
04:31mebaran151I had my repl open
04:32mebaran151but it was giving me weird results
04:32tomoj,(or (do (print "foo") true) (print "bar"))
04:32clojurebottrue
04:32mebaran151turned out I'd forgotten my own argument order
04:32clojurebotfoo
04:32mebaran151so what I thought was nil, truly wasn't!
04:32tomojwas that a pun
04:46gkoHow do you deal concurrency with sockets?
04:48AWizzArdgko: depending on what you do.. there are things that are parallelizable while others are not.
04:49gkoAWizzArd: typical use: pool of (client) sockets used on demand by pool of threads.
04:51gkoAWizzArd: each thread could request at anytime the use of a socket to send a request. Does (dosync ...) protect usage?
04:59mebaran151tomoj, I wish I was so clever
04:59mebaran151gko, I think so
05:00mebaran151though I don't know how well it works with sideeffects...
05:02gkomebaran151: right... if some thread is sending/receiving data, the socket referenced by the ref doesn't change value...
05:02mudphoneanyone know how to save *out* to a string?
05:05gko,(.write *out* "test")
05:05clojurebottest
05:06mudphonegko: I guess what I'm trying to do is run a method (like println) and have the output go to a var, instead of stdout
05:06Fossimudphone: with-out-str
05:07mudphoneFossi: great, that looks awesome
05:07gkoHow to make *out* to print out in the REPL when in a thread?
05:07gko(.write *out* "test") => OK
05:07Fossimudphone: but if you only want it for one strint, there's print-str
05:08gkobut: (.start (Thread. (fn [] (.write *out* "Hello")))) => nothing
05:08mudphone,(do (def my-var (with-out-string (println "hello"))) my-var)
05:08clojurebotDENIED
05:08opqdonutwith-out-string, yes
05:08mudphone,(def my-var (with-out-string (println "hello")))
05:08clojurebotDENIED
05:09mudphonedoh
05:09Fossi,(print-str "something")
05:09clojurebot"something"
05:09tomojwhy are those denied?
05:09mudphone,(with-out-string (println "hello"))
05:09clojurebotjava.lang.Exception: Unable to resolve symbol: with-out-string in this context
05:09Fossigko: maybe start slime with slime-redirect-inferior-output
05:09tomojit's with-out-str
05:09mudphone,(with-out-str (println "hello"))
05:09clojurebot"hello\n"
05:09opqdonut,(with-out-str (println "hello"))
05:09clojurebot"hello\n"
05:09opqdonutgah
05:10mudphoneexcellent
05:10mudphonegracias
05:10Fossimudphone: as i said, if you only want to format one string, there's print-str as well
05:10Fossiand format of yourse
05:10Fossi*course
05:11mudphone,(print-str (println "hello"))
05:11clojurebot"nil"
05:11clojurebothello
05:12mudphoneFossi: I think I need with-out-str
05:12gkoFossi: (slime-redirect-inferior-output) => no effect
05:12mudphoneFossi: Thanks
05:12mudphoneI'm setting up an ajaxy front end to serve up (doc) calls
05:13Fossimore like (print-str "%s" "string")
05:13Fossiups
05:14gkoFossi: oh... if I do a println, then the stuff with (.write *out* ...) comes out...
05:14Fossimudphone: yeah, then you want with-out-str
05:14Fossigko: hmmm. buffer flushing? or lazyness?
05:14gkoFossi: have to flush it...
05:15mudphoneFossi: I always think I have to do more work than I really do :)
05:15Fossisame here, rally :)
05:15Fossi*really
05:15Fossiman, i can't type today... :\
05:16mudphonedoes sed work here?
05:16mudphones/sed/something/
05:16mudphoneguess not
05:44Fossiwhat's the compiled clojure in clojure.jar good for?
05:46Fossii'd like the smallest clojure build possible, because dexing for the dalvik vm takes ages like this
05:46Chousukeclojure-slim is supposed to be that I think?
05:46Chousukethe jar
05:47Fossiyeah, but i don't quite get what i need the clojure sources and the java things for
05:48Fossi*are
05:48Fossii guess only including the clj would make the deployment faster, because it's only text to the dexer
05:48Fossibut then everthing needs to be compiled in time, right?
06:26LauJensen(doc conj!)
06:26clojurebot"/;nil; "
06:26LauJensen(doc future)
06:26clojurebot"([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block."
06:26LauJensenMan thats awesome
06:27LauJensenWhere does he get the ideas for this stuff? :)
06:31Fossifuture?
06:34LauJensenYea among other things
06:36eevar2LauJensen: books/papers on languages and language design?
06:37JomyootI don't want #file.txt# all over
06:37Fossiwell, future is part of java :)
06:37Jomyoothow do I remove that?
06:39arbschtJomyoot: are those emacs backups?
06:39Jomyootyep
06:40arbschtJomyoot: for details try M-x apropos backup, or ask in #emacs, or check emacswiki.org
06:41arbschtbasically you can set backup-directory-alist to put backups in a designated directory. or you can disable the feature altogether somehow
06:42LauJensen(setq backup-directory-alist (list (cons ".*" (expand-file-name "~/.emacsbackup/"))))
06:42LauJensenI think the #file# files are locks though, and they go away soon as you close the buffer, but the clj~ are the backups
06:47vvl#files# should be auto-save files
06:47vvlwhich can be disabled as well
06:48RaynesI just have all my auto-saves and backups sent to a .saves directory.
07:31djpowellcool - on the newnew branch, jad core$future_call$obj__6472.class actually manages to decompile it to java
08:15adityoi have a query?how do i write obj.methodname("value") into Clojure (.methodname value obj)
08:16Chousukeadityo: (.methodname obj value)
08:16Chousukeor actually, "value" since it's a string :P
08:16Chousuke,(.substring "Foobar" 2)
08:16clojurebot"obar"
08:16adityoChousuke: thanks, "value" it :)
08:58lnostdalhi, i'm testing various languages and environments .. how does one deploy clojure stuff? .. is there a "sb-ext:save-lisp-and-die" or a "ext:saveinitmem" or similar way?
09:01Fossieh, what?
09:02lnostdalFossi, perhaps it is an unreasonable question given the jrm? .. what i'm looking to do is to save an executable (in jvm sense) snapshot of the current state of the lisp system to disk
09:02Fossiyou can compile to java or run from the repl or whatever you want
09:03Fossii'm not sure i get what you are up to
09:03lnostdalok
09:03mccraiglnostdal: there is no save image function in clojure
09:45dysingerwhasup danlarkin
09:45danlarkinmornin!
09:46rhickeyso, any experience reports w/transients?
09:47cgrandrhickey: is anyone working on TransientHashMap?
09:47rhickeycgrand: I'm not yet, I'm sure that's even more in demand than the vector
09:47danlarkinno speedup in clojure-json array decoding, so I guess the vector operations are not the bottleneck
09:48rhickeydanlarkin: it will only improve write speed, reads for transients are the same (v. good) as for normal persistents
09:49rhickeycgrand: I think the same strategy will work for all of the tree=based data structures
09:50danlarkinrhickey: Yeah I mean conjing up a clojure vector from a json array
09:50rhickeyah
09:50cgrandrhickey: yeah, I guess that there's no need to introduce a Node type, edit can be added to existing INode impls
09:51rhickeycgrand: right, I was using raw arrays in pv, there are already nodes in pmap
09:51cgrandbut one can not change IName to AName because LeafNode extends AMapEntry :-(
09:51rhickeyone complication is the sparse nature of the maps. Maintaining that would make key-inserting/deleting ops no faster
09:53rhickeyI have ideas about partial-sparseness, e.g. non-sparse for all but the last level or two
09:53rhickeythis would remove some of the bit twiddling from the intermediate steps, at a minor cost in space
09:54rhickeyoverall better lookup times, and more amenable to transients
09:55rhickeyvalue-modifying ops would get huge speedup from transients even with the current structure
09:58rhickeyI also have ideas about getting rid of the key/value hlding LeafNode objects, using an array pair in the inner nodes
09:59rhickeyholding
10:00cgrandhmm... does this mean that I shouldn't try to write TransientHashMap and that you prefer to rework PersistentHashMap before?
10:02rhickeycgrand: no, by all means go for it. If you want to try any of these ideas you can do so after a first cut, or while you are in there. I'd be happen to explain in more detail
10:02cgrandgreat!
10:03rhickeyI could use the help
10:06rhickeyunfortunately the hashmap code is a little, ... tricky :)
10:09cgrandI noticed
10:10rhickeyI'm not sure the polymorphic nodes bought me as much as they did with the RB tree in PTreeMap
10:10rhickeycgrand: you understand the edit mechanism in PersistentVector ok?
10:10cgrandyes
10:10rhickeycool
10:34Chousukehmm
10:35ChousukeMy clojure reader written in Clojure has now successfully read "(())" as (())!
10:36ChousukeI wonder at which point will I encounter something that forces me to start over, though.
10:40cemerickrhickey: I guess I was somewhat too extemporaneous with my proggit title, eh? :-/
10:43rhickeycemerick: I liked it, but it is subject to wildly varying interpretations
10:44cemerickyeah. DRMacIver and I both misunderstood each other. Typical internet discourse, etc.
10:45rhickeyyeah
10:45cemerickI should have just said "Hey, this ain't LTU, whadda want?!" :-D
10:45dysingercemerick: heh DRMacIver - don't get me started
10:46cemerickdysinger: run-ins?
10:46dysingeryes
10:46cemerickI remember him being helpful in #scala when I used to hang there
10:46cemerickof course, I wasn't there long
10:47leafwanybody knows that tool is being used to render the UML diagrams of clojure classeS?
10:47rhickeycemerick: It will be interesting to see if someone acknowledges the difference between transients and e.g. Haskell's freeze/thaw/unsafeFreeze/unsafeThaw/IArray/MArray dichotomy
10:47dysingerI am sure most of the time he's fine cemerick
10:47dysingeras am I ;)
10:47rhickeyDRMacIver always seems reasonable to me
10:48cemerickrhickey: there was that SP mention, but I've no idea what that's about :-)
10:49dysingerleafw: link ?
10:50rhickeyhttp://www.haskell.org/ghc/docs/latest/html/libraries/array/Data-Array-MArray.html
10:50danlarkinleafw: http://github.com/Chouser/clojure-classes/tree/master
10:50rhickeyfreeze - full copy, unsafeFreeze, um, unsafe
10:52rhickeyand IArray and MArray have very different interfaces it seems
10:52leafwdysinger, danlarkin : thanks.
10:53kobahello
10:53dysingercool /me clones that
10:53cemerickwtf: "Note that because the array is possibly not copied, any subsequent modifications made to the mutable version of the array may be shared with the immutable version."
10:54rhickeycemerick: thus, unsafe
10:54cemerickmy basic reaction is, "what's the point"
10:57rhickeycemerick: well, it's enough to say that transients are different, in important ways
10:58rhickeyI don't know of anything similar (although it's likely there's something)
10:59rhickeyto/from O(1), same shape, mirror API
10:59cemerickrhickey: I'm sometimes prone to hyperbole. Strong opinions, weakly held, etc.
11:00kobahi again..just want to say I'm new to clojure and having just watched the "Clojure for Lisp programmers" video want to express how awesome I think it is
11:01kobaI'm just very happy to have found a new language to delve into and enjoy :-)
11:01cemerickI've been burned by Collections/unmodifiable* too many times to mess with simple wrappers around mutable collections.
11:01drewrkoba: there's no turning back now
11:01rhickeycemerick: I don't think the spirit of your headline was wrong, this is a game-changing feature for those worried about FP and performance
11:01cemerickkoba: welcome :-) Feel free to stick around.
11:01AWizzArdrhickey: what would those hash map do?
11:02AWizzArdWould that solve the problem if very fast instantiation of small immutable objects?
11:02kobathanks - I'm only an undergrad AI student but I'm delighted to see that Lisp still has a future
11:02AWizzArdif ==> of
11:02rhickeyAWizzArd: support transient/persistent!/assoc! etc
11:02cemerickrhickey: Oh, I don't make any apologies for the headline itself. It was meant to stir the waters, attract attention, and be a little fun. Trying to hang serious conversation off of its context is hard, though, for sure.
11:04wlrrhickey: fwiw, i've twice run your vrange/vrange2 comparison. both times (time vrange version) > (time vrange2 version) on *first* run of each. once hotspot kicked in though, vrange2 kicked butt.
11:04kobaat Uni here they teach Java and that is what the students use...I managed to avoided it and decided to learn Common Lisp as the historic AI language instead
11:04kobaavoid*
11:05wlrrhickey: er... i cited first runs backwards above. sorry.
11:05kobaanyone got any suggestions for a first project with Clojure? Something AI related would be great
11:06cemerickwlr: I see this a lot as well, and mentioned it yesterday. It *seems* like clojure code needs more trips through the JIT to reach its performance minima than javac'd java.
11:06rhickeywlr: right, the only times that matter are post-hotspot IMO
11:07AWizzArdkoba: you could develop a lib with support for several kinds of neural networks.
11:08kobaAWizzArd: Could do. I would have thought you could get that from the Java side though
11:09cemerickrhickey: agreed, but I'm curious as to the (apparent) difference in the speed of the optimization itself. Perhaps optimization of boxed numerics takes longer/more runs?
11:09cemerick(takes longer than other optimization paths, that is)
11:09clojurebotthat is not what I wanted
11:09AWizzArdkoba: so we need to find something for which there is no Java solution yet, but which is still AI.
11:10kobaI think I might want to do something with DSLs as that is the main place I've found Python lacking (I've mainly coded in Python)
11:10AWizzArdkoba: you could write a DSL for parsers. EBNF2Clojure or so.
11:10kobahmm..nice idea
11:11rhickeycemerick: these JITs do optimization in several phases, so only after seeing continuing pressure after the first wave of opts will it do another pass. I think in the IBM VM talk at JavaOne they talked about 5 different levels of code 'hotness' each triggering progressively more sophisticated optimization
11:11kobamy lectures have mostly been for natural language parsers. I've only just learnt basic parsing with pyparsing...I like that API though
11:11kobawith a lisp I guess I could get it to just read EBNF
11:11kobawhich would be really nice
11:13kobaOr something with planning domains and logics?
11:14AWizzArdkoba: or you could implement a unicode infix macro "math" for Clojure. So people could write (math "14√π³ * 10x² + αδ")
11:14AWizzArdif it is very good then rhickey would maybe integrate it with a nice reader macro into Clojure :-)
11:15kobaAWizzArd: Another nice idea! Or how about let it read/eval Latex math expressions instead?
11:15AWizzArdwhy not both modes? :-)
11:15kobayeah
11:15kobaI really like that idea...would be great for either formula documentation
11:15stuartsierraLatex is not easy to parse, or implement.
11:16AWizzArdThen all people who say that math is difficult with s-expression syntax would actually have to admit that math in Clojure is more readable than their programming language.
11:16kobahmm...even if I start with a small subset?
11:16AWizzArdtry a small subset
11:16AWizzArdsaving the multiplication for things like 6x + 2y or so
11:16mebaran151Latex isn't even easy to version!
11:16AWizzArdthe multiplication symbol "*" I mean
11:17kobahmm..maybe I should look into defining my own simple markup?
11:17kobathen that could map to simple LaTex expressions for nice formatting maybe
11:18mebaran151any easier way to get all the natural numbers than (iterate inc 1)?
11:19koba+ - \times \frac{}{} \int^{}_{} ^ (superscript) and _ (subscript) should be simple enough
11:20AWizzArdmebaran151: iterate is fine
11:20AWizzArdkoba: but I think that you should still start with *readable* unicode syntax first
11:21kobaAWizzArd: Ok, + - * / () can be found in latex maths too
11:21kobaand ^ would be the same too
11:21AWizzArdincluding pi, square root, summation, superscript numbers in combination with vars such as x⁵⁹
11:22kobawhat is the unicode way of doing root? I would use \sqrt{} normally
11:22kobaand \sum{} for summation
11:23kobahow would you consider a more natural notation for those things?
11:23AWizzArd6√π⁸
11:23kobaok...if you have unicode characters on your keyboard ;-p
11:23kobaor know the codes?
11:23AWizzArdeasier than (* 6 (Math/sqrt (Math/pow Math/PI 8)))
11:24AWizzArdunicode chars directly in source code
11:24kobayeah
11:24AWizzArdit's a thing of the editor to provide those
11:24kobaok, depending on the editor of course
11:24kobabut yeah, as long as it is unambiguous
11:24AWizzArdsure, if a team to decides to use it they know what they are doing
11:25AWizzArdthen they will have to stick to their environment
11:25AWizzArdand several keyboard layouts can easily type unicode, such as mine for example :p
11:25kobathat is a nice project...thanks. I use LaTeX all the time
11:25kobaalso readable maths is good too
11:26koba(I consider Latex readable ;-p)
11:26AWizzArdif you split the task up correctly, then the parser is composable, and one could have different modes.
11:27stuartsierraI don't consider Latex readable. A couple years ago I heard about a language called Fortress, from Sun, that was supposed to include properly-rendered math in source code.
11:27stuartsierraOr maybe it was IBM.
11:27fffejstuartsierra: it was Sun with Guy Steele with Fortress
11:27kobagot it on wikipedia
11:27stuartsierraWhat ever happened with that?
11:28kobahttp://en.wikipedia.org/wiki/Fortress_(programming_language)
11:28kobaapparently version 1 came out last year
11:28fffejstuartsierra: it's still going afaik, there was some interesting work on concurrency recently.
11:28stuartsierraok, cool
11:28kobaok, this will be my project for the rest of the summer then...
11:29fffejsee http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf
11:29kobaI would also like to thank rhickey for his great videos and work on this language
11:30kobaI'll try to get some other AI people here onboard
11:32kobaI don't know how much momentum clojure has atm..that is my only worry before learning the language
11:33kobathere seems to be plenty of people on this channel though
11:33AWizzArdkoba: the phase of no-interest in programming is over
11:34AWizzArdin the months February-May people are not interested in it
11:34kobahmm..what do you mean?
11:35AWizzArdin January many people were interested
11:36AWizzArdin Jan. we had even more people in here
11:36kobastrange
11:36AWizzArdsince many years people stop posting in newsgroups and hanging out in irc programming channels in those months
11:36AWizzArdduring spring mostly :)
11:36kobaah..I see
11:37kobaI rarely use IRC myself, this is a one off :-)
11:37AWizzArdor for example, check the number of patches to bigger systems, such as Clojure itself during that time.
11:38kobadidn't know of such a general trend
11:38kobawell, summer holidays in the nothern hemisphere?
11:38kobathough for students like me, summer is the best time for new projects
11:40kobaanyways, I'm sure I'll be back when I have questions...once again, thanks for the idea!
11:40kobafarewell!
11:55cgrand,(-> [] (with-meta {:foo :bar}) transient persistent! meta)
11:55clojurebotjava.lang.Exception: Unable to resolve symbol: persistent! in this context
11:56mebaran151I don't think clojurebot has been built with upstream clojure yet
11:56Chousukeit's got new new though :P
11:57Chousukebut hm, enough for tonight
11:57ChousukeI have a reader that creates lists, vectors and maps now (and is able to read simple symbols)
11:57cgrandwell, it returns nil: metadata is not (yet) preserved through transient
11:58Chousuke(that is, the easy part is over. I fear I will have to redo everything when I get to the more complicated reader macros)
12:22sh10151Is there a way to get the Clojure REPL to use pprint when printing data structures?
12:23sh10151barring that, a way to get SLIME to use it?
12:31lisppaste8cgrand pasted "TransientHashMap: work in progress" at http://paste.lisp.org/display/84750
12:33leafwlooks like this is part of the clojure in clojure dev -- just thinking aloud
12:33leafwoops didn't read enough, this is just a testing script
12:35cemerickcgrand: looks promising :-)
12:36LauJense`is mutable and conj! in the master branch ?
12:36ChousukeLauJense`: mutable was renamed to transient, and yes, it's in master for vectors
12:36LauJense`k
12:39LauJensenI posted a question on Compojures group regarding long lived http connections and people keep referencing this BOSH standard, but its massive and quite daunting to have to implement. Isnt there a simpler way?
12:52LauJensen...like Symbolic Web from CL
12:54LauJensen(which is now dead)
13:04stuartsierraLong-lived HTTP is hard.
13:05stuartsierraThe only really successful use I've seen is from Google.
13:09LauJensenSymbolic Web actually seemed very functional with very few lines of code as I recall..
13:10stuartsierraMaybe up to a few dozen connections. It's a whole different game with real traffic.
13:12LauJensenWhy?
13:13LauJensen@ stuartsierra
13:13stuartsierraI've heard you've got to futz with TCP stuff to handle so many open connections.
13:13LauJensenhehe :)
13:16rhickeycgrand: neat! this is with packing of inner nodes still? I'd expect the second case to do better, given all but leaf nodes can be reused.
13:17rhickeyand surprised the first case does any better at all!
13:18rhickeyI guess sometimes you have the same size inner node
14:00cgrandrhickey: yup, inner nodes are still packed.
14:00Chousuke+s
14:02Fossiwell, aren't they?
14:02LauJensenI had the same concern Chousuke
14:02ChousukeFossi: no.
14:02cgrandabout persistent! being O(1): would an amortized O(1) be acceptable?
14:02LauJensenFossi, yes and no... hmm, was gonna make a Python joke :)
14:03ChousukeFossi: if you call a destructive operation like (assoc! tv 0 1), you should not reuse the tv name after that.
14:04ChousukeWhile it does work (for now), (do (assoc! tv 0 1) (assoc! tv 1 2)) is not how you should use transients.
14:07cemerickChousuke: More rope is good, I like the knots I can tie with it. Some people were going to hang themselves anyway. (e.g. just tossing around java collections, which I've seen in more clojure code than I'd like)
14:07Carkhwell isn't it true that sometimes an imperative algorithm is easier to pull off ?
14:08Chousukeif you use imperative style, you're reintroducing the burden of side-effects.
14:09Fossiat least in a defined scope, i think that's ok
14:09cemerickrhickey: may I suggest that you eliminate the version.properties file, and move to keeping the version numbers in a clojure file that can be AOT'd? I bring it up because I just finished working with a customer who strips all resource files (e.g. all non-.class files) from all jars they deploy.
14:09Chousukeif you merely use transients and functional style, the "side-effects" are just a detail you can ignore. especially if your algorithm happens to work on truly persistent vectors as well.
14:12Chousukecemerick: isn't the properties file there just to set the correct value for clojure-version at build time?
14:13Chousuke,*clojure-version* ; this I mean
14:13clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
14:13cemerickChousuke: no, it's loaded by core.clj (or core__init.class)
14:13Chousukehmm :/
14:14cemerickI presume rhickey made it an external properties file for a good reason (maybe so that ant's propertyfile task can twiddle a buildnumber?), but that'll make things a little difficult for when we ship this customer a jar later this year that uses clojure.
14:15cemerickideally, the AOT'd clojure jar should contain *only* classfiles
14:22berkI need a little handholding with eclipse plugin
14:22berkHow do I use latest git versions of clojure-contrib and clojure with it?
14:25berkI want to experiment with transients but don't know how to build clojure
14:25baetis-flyanyone know why contrib's prxml prints to *out*? Couldn't it just return a string and let me print it if i want?
14:25gkoberk: get code from github.com, then "ant"
14:25hiredman,(doc prxml)
14:25clojurebot"clojure.contrib.prxml/prxml;[[& args]]; Print XML to *out*. Vectors become XML tags: the first item is the tag name; optional second item is a map of attributes. Sequences are processed recursively, so you can use map and other sequence functions inside prxml. (prxml [:p {:class \"greet\"} [:i \"Ladies & gentlemen\"]]) ; => <p class=\"greet\"><i>Ladies &amp; gentlemen</i></p> PSEUDO-TAGS: some keywords have special meani
14:25gkoit will build the .jar files.
14:26Chousukebaetis-fly: printing to a stream is faster and more flexible.
14:26Chousukebaetis-fly: use 'with-out-str
14:26Chousuke(doc with-out-str)
14:26clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
14:26berkgko: thanks. I already got the files. but just "ant"?
14:26baetis-flyChousuke: oh, nifty. Many thanks.
14:27gkoberk: Yes... "git clone git://github.com/richhickey/clojure.git"
14:27gkoberk: cd clojure
14:27gkoberk: ant
14:27gkoberk: finished
14:27berkok. thanks
14:27gkosame for clojure-contrib.
14:28LauJensensame for clojureql
14:28gkoberk: and if you want to update your current source: cd clojure, git pull original master, ant.
14:29hiredmanfor contrib you want to tell it where to find clojure.jar so it can AOT compile stuff
14:29berkI don't have a standalone ant installed. I'll have to figure out that first. (I'm on windows)
14:30Fossi1i wonder how hard that would be
14:30Fossi1you could cross compile all the libs to dex anyway
14:30gkoMy problem: Emacs+SLIME+clojure: C-- M-x slime clojure => clojure is launched, but in an *inferior-lisp* shell, although it says "Connection opened on local port 59154"... Did I miss something?
14:30Fossi1so it should be more or less only the compiler & output
14:30gkoberk: I'm on Windows too.
14:31hiredmanFossi1: nah, you need an asm library for dex
14:31gkooh, the swank client hasn't connected.
14:31Fossi1hiredman: ah, i see
14:32gkoit is: Connected. Let the hacking commence!
14:33hiredmansome of the android videos from google io seem to suggest that with cupcake android got some ability to do runtime bytecode generation and loading
14:33hiredmanwhich it did not really have before
14:33hiredmanso maybe a dalvik asm lib will follow
14:33Fossi1well, i don't care so much about runtime stuff
14:33Fossi1which would of course be great as well (you can use dex on dalvik for that)
14:34Fossi1but it's annoying that i have to AOt to java from clojure and then to dex again
14:34Fossi1takes quite a while and i hate deployment cycles
14:36Fossi1time for a bit of socialising
14:45cemerickwhat's this "dex"?
14:46hiredmandex is the tool for transforming jvm bytecode into dalvik bytecode
14:46hiredmandex is also the extension for dalvik bytecode files
14:46cemerickah-ha
14:47cemerickis android going anywhere? From afar, it seems to have petered out pretty silently...
14:48rhickeycgrand: could you explain why amortized? and amortized over what, since invoked only once
14:49hiredmancemerick: there tons off handsets in the pipe line running android
14:50rhickeycemerick: could you please bring up the properties file thing on the list?
14:50cemerickrhickey: np
14:51hiredmanhttp://gizmodo.com/search/android%20phones
14:53eevar_htc hero looks nice too
15:51mebaran151how could I build something like a take-while with lookbehind
15:51mebaran151I can't use reduce because it isn't lazy enough
15:51hiredmanuse lazy-seq and roll your own
15:53mebaran151alright
15:53hiredmanor make the function arg to take-while close over an atom or something to do state munging, this is to be frowned upon
15:54mebaran151I'd prefer the lazy-seq approach
15:54mebaran151any good tutorials on lazy-seq: I don't quite grok them yet
15:56stuartsierrabasically you write a recursive function that ends with (cons current-value (call-myself ...)) and wrape the whole thing in lazy-seq
15:59mebaran151I see
16:00mebaran151thanks
16:18konrad_Guys, I installed clojure using aptitude, yet I need to install clojure-contrib now. I downloaded the tarball from github, but how can I compile and install it? There is nothing on the README :(
16:20hiredmanrun ant
16:28cemerickI'll never forgive aptitude for the hour I spent fiddling with a hopelessly-broken glassfish install.
16:28technomancycemerick: yeah, same here with debian's solr.
16:29technomancyit's like they don't even try
16:29cemerickI really wish they wouldn't, period.
16:39LauJensenNice to hear 2 old grumby men discuss package management :)
16:39Fossi:D
16:39Fossii have to admit that i begin losing faith in gentoo
16:40Fossias i did in debian
16:40Fossithe amount of open source and it's dependencies makes page management really nasty
16:41cemerickLauJensen: I'm actually very jovial...and technically young, though I've felt old of late...
16:41cemerick:-)
16:41LauJensenhehe... the fact that you need to defend yourself says something though :)
16:49ari____what is the magic incantation to fix slime+emacs+clojure on OSX? http://pastie.org/571629 swank-clojure-jar-path etc are set properly
16:49ari____i'm using the latest released emacs-23
16:50ari____i'd try to use clojure-install, but that doesn't work for me because of bizarre git+emacs interaction problems atm
16:52technomancyari____: OS X doesn't set a custom PATH correctly for applications launched in a gui. maybe symlink git to somewhere that's on your default path?
16:52technomancyand don't forget to file a bug report with Apple about it.
16:53Chousukehm
16:53ari____mmk
16:53Chousukehere I was worrying about how to handle all the . sugar in my little clojure-reader, but it seems the reader needn't care!
16:54Chousuke(foo.) etc. are apparently expanded by the compiler, not the reader.
16:56ari____clojure-install eventually fails for me with cd: No such directory found via CDPATH environment variable
16:57technomancyari____: oh, someone else was reporting this bug the other day... some problem with autoloads. are you installing it in the default location?
16:59ari____I wasn't, I'll give it another try
17:02ari____that seems to be better, thanks
17:03cemerickChousuke: that's interesting -- in that case, I'm surprised that symbols ending in . aren't allowable (or aren't functional, more like)
17:03ari____i'm concerned with all the difficulty had in installing it manually, I had a valid ccl and everything, just a lot of errors and drama with slime, etc
17:03ari____got to run, but i'll be back later if further debugging is warranted from anyone
17:03ari____thanks
17:03konrad_Is anybody here using vimclojure? I'm trying to install it with ant, yet I'm getting a strange error (http://pastebin.com/m75a3bf36). I've compiled clojure-contrib and set the local.properties file correctly
17:05konrad_oh, it's in the faq :P
17:05drewrLauJensen: what's the latest stable commit of clojureql? should I just wait?
17:09Chousukecemerick: Well, they're just reserved for the implementation
17:09hiredman,(symbol "foo.")
17:09clojurebotfoo.
17:15LauJensendrewr: Just pull HEAD, its stable, although we have recently changed by convention, that all calls that target a table, takes the table-name as the first argument, ie (query table1 *) (insert-into table1 [foo "bar"]) etc
17:16drewrLauJensen: the first example in dk.bestinclass.clojureql.demos.postgres/-main doesn't work for me
17:16LauJensensec
17:16drewrcreate-table generates sql that looks like "CREATE TABLE StoreInformation ( id SERIAL NOT NULL,StoreName,Sales,Date PRIMARY KEY ( id ) )"
17:17LauJensenOk, if you have patience for tomorrow I'd be happy to resolve it. The Postgres support was submitted to us as a patch, so I cant give you the solution just now Im afraid
17:18LauJensenOk till tomorrow?
17:18drewrsure, no problem
17:19LauJensenok great, goodnight all
17:21cemerickhiredman: right, what I was getting at is that if the reader isn't responsible for foo. symbols -> classes/constructors, I'd expect this to work:
17:21cemerick,(let [foo. 5] (+ foo. 5))
17:21clojurebotjava.lang.ClassFormatError: Illegal field name "foo." in class sandbox$eval__3176
17:23hiredmancemerick: expect that to work just because the reader doesn't care is kind of silly
17:23hiredman,read-string
17:23clojurebot#<core$read_string__4939 clojure.core$read_string__4939@1e6cb2a>
17:23hiredman,(read-string "(let [foo. 5] foo.)
17:23clojurebotEOF while reading string
17:23hiredman,(read-string "(let [foo. 5] foo.)")
17:23clojurebot(let [foo. 5] foo.)
17:24hiredmanI imagine it happens at macroexpansion time which sits between read and compile/eval
17:25hiredmanbut maybe is rolled into clojure's compile
17:25cemerickit's not that I care much, it's that I just don't understand what the compiler is doing -- or, given Chousuke finding, I realize my prior understanding was faulty
17:32JAS415that prxml thing is nifty
17:35konrad_Is anybody using vimclojure? I've installed it correctly, and now I'm running some sort of server, but how can I... use it, ie, send code to a REPL?
17:50avitalhi. i see some examples that use lazy-cons but i don't have this. has it been renamed?
17:50dysingerkonrad_: the correct editor is "emacs"
17:50dysinger;)
17:50hiredmanavital: it's gone
17:50avital,lazy-cons
17:51clojurebotjava.lang.Exception: Unable to resolve symbol: lazy-cons in this context
17:51duck1123lazy cons has been replaced with lazy-seq and cons
17:51hiredmanhttp://clojure.org/lazy sort of describes the changes that happened
17:52hiredmanbut it it implies a work in progress
17:52hiredmanbut it is a work doen
17:52hiredmandone
17:53avitalhmm
17:53avitalok let me give it a shot, i might come back for more questions :)
17:53konrad_what is the extension of a clojure file?
17:54avitalkonrad_: .clj
17:55cemerickkonrad_: enclojure is pleasant, FWIW
17:56avitalkonrad_: i am also now using enclojure
17:57avitalis there a built-in function to create a lazy seqence of all numbers? something "like" (range 1 infinity)
17:57opqdonuti just use (iterate inc 0)
17:58avitalopqdonut: cool thanks
18:05mudphoneanyone interested in a seemingly simple stumper?
18:06mudphonethis doesn't run for me in the repl:
18:06mudphone(defn my-doc [x] (doc x))
18:06konrad_oh gosh, I guess I'll have to bother the developer
18:07mudphoneI get: java.lang.Exception: Unable to resolve var: y in this context
18:07mudphoney == x (oops)
18:08hiredmanmudphone: doc is a macro that expands to a call to var
18:08hiredmanand var is special
18:08hiredman,(macroexpand-1 '(doc foo))
18:08clojurebot(clojure.core/let [m__84__auto__ (clojure.core/meta (clojure.core/resolve (quote foo))) al__85__auto__ (:arglists m__84__auto__) docstring__86__auto__ (:doc m__84__auto__)] (if m__84__auto__ (.replaceAll (clojure.core/str al__85__auto__ "; " docstring__86__auto__) "\\s+" " ") (clojure.core/-> hiredman.clojurebot.code-lookup/contrib :vars ((clojure.core/partial clojure.core/filter (clojure.core/fn [a__87__auto__] (clojure.
18:08hiredmaneep
18:08hiredmananyway
18:09hiredmanif you want a doc function
18:09hiredman,(:doc (meta (resolve '+)))
18:09clojurebot"Returns the sum of nums. (+) returns 0."
18:09mudphonehmm
18:10mudphonehiredman: excellent!
18:10hiredman=> (macroexpand-1 '(doc foo))
18:10hiredman(clojure.core/print-doc (var foo))
18:10hiredmanis the actual macroexpand of doc
18:11hiredmanthe above was just an abberation particular to clojurebot
18:11rathorehiredman: what happened earlier when u did the macroexpand?
18:11mudphoneit didn't work for me with print-doc either
18:11mudphonebut, the meta way, seems like it will
18:11hiredmanclojurebot has a custom doc macro
18:11rathorehiredman: ah ok
18:11hiredman,(macroexpand-1 '(print-doc foo))
18:11clojurebot(print-doc foo)
18:11hiredman,(print-doc (relsove '+))
18:11clojurebotjava.lang.Exception: Unable to resolve symbol: relsove in this context
18:12hiredman,(print-doc (resolve '+))
18:12clojurebot------------------------- clojure.core/+ ([] [x] [x y] [x y & more]) Returns the sum of nums. (+) returns 0.
18:12hiredmanmudphone: I imagine you were just missing the call to resolve
18:12mudphonehiredman: I'll try that
18:17mudphonehiredman: if I create my fn like this: (defn my-doc [y] (print-doc (resolve 'y)))
18:17mudphoneI get the :doc metadata for "user/y"
18:19konrad_Is there something like Glade or QTDesigner for Clojure?
18:19cemerickshouldn't the metadata keys in clojure.zip be ::branch?, etc., instead of :zip/branch?
18:20cemerickkonrad_: There's at least a dozen well-supported UI designers for swing, awt, and swt.
18:20cemerickOK, a half-dozen, perhaps.
18:24hiredmanmudphone: you quote y when you call my-doc
18:24hiredmannot inside my-doc
18:25hiredmanthat is why doc is a macro, not a function
18:25hiredmanotherwise you would need to call it like (doc '+)
18:25mudphonehiredman: ah
18:26mudphonehireman: fantastic, thanks
18:41mudphonehiredman: so the meat of my function is now: (:doc (meta (resolve (symbol str-name))))
18:41mudphonewhere I'm getting str-name passed in as a string (the name of the function)
18:41mudphonehiredman: thanks for your help
18:57konrad_what do you guys think about Python?
18:57skalnikIt sucks.
18:57konrad_why?
18:58skalnik", ".join(["5", "6"]) <= Things like that
18:58albinoshachaf: why does that suck?
18:58skalnikI assume you mean me, in which case, it makes no sense
18:59albinooh yeah, wrong person
18:59albinohow would you like it to read to make sense?
18:59ChousukeYou can come up with an example like that for any language.
18:59skalnikalbino: join should be a method on the array, but the array doesn't have a join method
19:00skalnikChousuke: true, but I just think Python has a few design flaws
19:00skalnikI don't really think it sucks ;)
19:00ChousukeAs far as making sense goes, python does rather well.
19:00cemerick*every* language has design flaws *shrug*
19:00albinoshachaf: well JS does it on the array
19:00skalnikBecause it makes sense :)
19:01albinofreak, get the right nick name, gah sorry
19:01skalnikI'd be more upset if I were shachaf ;)
19:04Chousukehmm
19:04ChousukeI wonder what it would take to implement syntax-quote as a regular macro
19:05Chousukeso that the reader would just expand `(foo ~bar) into (syntax-quote (foo (unquote bar)))
19:26ataggartanyone have experience reading a technical book (e.g., Programming Clojure) on a Kindle?
19:31shachafalbino, skalnik: I am *absolutely* upset, and demand some sort of compensation immediately.
19:31skalnikI knew it.
19:32skalnikI always get cranky when people highlight me on accident.
19:40albinoshachaf: well you can't blame skalnik for my stupidity
19:41shachafskalnik: I was not assigning blame, only notifying skalnik that it was correct.
19:41shachafs/skalnik/albino/
19:41shachafConsider the accounts settled -- *this* time.
19:41skalnikRRRRRRRRRRAAAAAAAAAAAAAAAAAAGGGGGEEEEEEEEEEEEEEEEEEEEEEE
19:44shachafskalnik: You should change your nick -- I was here first.
19:44skalniknever.
20:02rhickeyataggart: I've read tech books on a kindle dx - very nice
20:02ataggartrhickey: well my main concern was that the regular woudl just be too small.
20:02ataggartwhich, from watching videos, appears to be the case
20:03rhickeyataggart: probably so
20:20konrad_kindle is evil
20:21konrad_ok, getting vimclosure to work - take 2
20:29mebaran151I'd like to know too actually
20:29mebaran151I gave up and switched to Netbeans, and I'm actually pretty happy with the support
20:36mebaran151is there anyway to test if a seq is lazy or not?
20:37hiredmannot really
20:37JAS415hm
20:37hiredman,(class (range 10))
20:37clojurebotclojure.lang.LazySeq
20:38JAS415can't you check if it implements the class
20:38hiredman,(class (cons 1 (range 10)))
20:38clojurebotclojure.lang.Cons
20:38JAS415haha
20:38JAS415oo
20:38mebaran151so whenever I ask for count
20:38ataggart(class (map + [1 2]))
20:38ataggart,(class (map + [1 2]))
20:38clojurebotclojure.lang.LazySeq
20:38hiredmanmebaran151: counted?
20:38hiredman,(doc counted?)
20:38clojurebot"([coll]); Returns true if coll implements count in constant time"
20:38mebaran151I better make doubly sure
20:38mebaran151o
20:38mebaran151useful
20:38mebaran151just what I was looking for
20:41mebaran151clojure needs a better documentation, though hiredman holds down the fort quite well
20:43hiredmanclojurebot: docs?
20:43clojurebotPardon?
20:46ataggartspending an hour or so really reading the api page has done wonders
20:47hiredmanholy cow
20:47hiredmananyway
20:47hiredmanhttp://clojure.org/sequences is useful
20:47mebaran151I'll review it
22:28hiredmanclojurebot: new new?
22:28clojurebotnew Class(x) is (Class. x)
22:44ari____what's necessary to get compiling working? I have for instance an org/ari___/test.clj, and a (ns org.ari___.test (:gen-class)), but (compile 'org.ari___.test) doesn't seem to work.
22:50mebaran151underscores can be dangerous
22:51mebaran151also is there anyway to get the arity of a function?
22:52hiredmannope
22:53hiredman,(meta #'map)
22:53clojurebot{:ns #<Namespace clojure.core>, :name map, :file "clojure/core.clj", :line 1588, :arglists ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]), :doc "Returns a lazy sequence consisting of the result of applying f to the\n set of first items of each coll, followed by applying f to the set\n of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n
22:53hiredman,(:arglists (meta #'map))
22:53clojurebot([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
22:53ari____the underscore isn't accurate, I'm using the namespace as an example.
22:53hiredmanbut that only works on vars holding functions
22:53ari____the real namespace is org.x.y, for instance.
22:53hiredmanclojurebot: compiling?
22:53clojurebotPardon?
22:53hiredmanclojurebot: compile
22:54clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
22:54Jomyootis transient much faster than persistent?
23:03ari____hiredman: both of these items are true in my case, e.g. java -cp ~/clojure.jar:./classes:./org.x clojure.main
23:03ari____(compile 'org.x.y)
23:04ari____java.io.IOException: No such file or directory (y.clj:1)
23:04hiredmansound pretty clear cut to me
23:04hiredman~classpath
23:04clojurebotclasspath is (System/getProperty "java.class.path")
23:04hiredmanbah
23:04hiredman~namespace
23:05clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
23:06hiredmanif you have a namespace foo.bar and relative to your pwd there exists a file foo/bar.clj then to get foo.bar in your classpath you just need to put the pwd on the classpath
23:08ari____the namespace is org.x.y, on my pwd there is a directory org with a subdirectory x and a file y.clj, as well as a classes directory. java -cp $foo whereas $foo has a colon-separated list of directories including ., ./classes, and ./org and ./org/tim.
23:09hiredman*shrug*
23:14_mstari____: does your 'classes' directory already exist? I've seen that error when I've forgotten to 'mkdir classes' before compiling...
23:15ari____yup
23:15ari____it's very bizarre
23:15ari____it keeps throwing 'No such file or directory' for y.clj
23:15ari____even though the file is clearly there
23:15hiredmanwell, obviously you are doing something wrong
23:15ari____obviously :p
23:16hiredmanso strip down what you are doing
23:16hiredmanfollow the exact example on the website
23:17ari____pardon the snark, but the website has a lot of examples of gen-class but no real examples of the compile process
23:17ari____there are some generalized rules
23:17hiredman~compile
23:17clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
23:17hiredmanthere is, at the bottom of that webpage
23:18ari____(compile xyz) is never called
23:18hiredmanit shouldn't be
23:19hiredman(compile 'org.x.y)
23:22Jomyootis transient much faster?
23:23hiredmanfaster for what?
23:23ari____http://pastie.org/572001
23:23ari____perhaps there's just some error in invocation on my part
23:23ari____i've tried all kinds of variations though
23:24lisppaste8_mst pasted "tiny compilation example" at http://paste.lisp.org/display/84798
23:24hiredmanari____: remove yz from your classpath and replace it with the pwd
23:24_mstthat worked for me...
23:24carkari____:that might niot be what you want...but i personally use compile from the command line
23:25hiredmanari____: that is not going to work anyway
23:25hiredmanthe file has to exist
23:25ari____the file does exist.
23:26hiredmanari____: in the example you pasted it looks like you are trying to compile a namespace created at the repl
23:26ari____look at the top of the example
23:26ari____even when not in the REPL
23:26ari____it won't compile ala _mst's example
23:26hiredmanfine
23:27ari____which is basically same as mine
23:27hiredmandid you do what I said yet?
23:27hiredmanari____: remove yz from your classpath and replace it with the pwd
23:27ari____yes
23:27hiredmanthat will work
23:28cark-> (defn -main [] println "Test") i beleive you're missing a pair of parenthesis there
23:28hiredmanif it does not there is something else you are not sharing
23:29lisppaste8ari_____ pasted "compiling problem" at http://paste.lisp.org/display/84799
23:30ari____cark: corrected but still a problem
23:31carkthe compile call gives an io error, but does a "require" or "use" work ?
23:31clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
23:31ari____use returns nil
23:31carkand is it working ?
23:31carki mean can you call the main function ?
23:32ari____yes
23:32hiredmanari____: the namespace declaration doesn't contain (:gen-class)
23:32ari____hiredman: I only removed it to follow mst's example
23:32carkah that's it
23:32ari____hiredman: in the original one, I had it
23:32ari____and still didn't work
23:32ari____i'll try it again
23:33ari____nope
23:33ari____there is something weird :/
23:34ari____this is a pretty barebones example.
23:34_mstari____: I just followed your example (having fixed the parens) and it worked using clojure-1.0
23:34_mstat first I got exactly the same error and then remembered to create the classes directory :)
23:34carktry putting your test directory in a src dir, and add the src directory to the classpath
23:34carki have still not upgraded to 1.0 =P
23:35_mstyour classes directory is at the same level as yz? not inside of it?
23:36Jomyootis transient feature released?
23:36Jomyootor no?
23:36Jomyootalso does transient benefit collections like hash map?
23:36Jomyootor only vector
23:37carkonly vectors right now i think
23:37carkand not officially released either
23:38ari____cark: nope, that doesn't seem to have worked
23:38ari____clearly i'm doing something wrong, though what I have no idea
23:38Jomyootwill hashmap benefit from transient eventually?
23:39carkhaslao are already using mutation under the hood
23:39carkhashmaps i mean =)
23:39lisppaste8ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#1
23:39lisppaste8hiredman annotated #84799 "example" at http://paste.lisp.org/display/84799#2
23:39ari____what is supposed to be done at that stage?
23:39clojurebotthat is not what I wanted
23:40ari____thanks hired
23:40ari____1sec
23:43ari____oh ho
23:43ari____doesn't work with your example, hired
23:43hiredmanwords hear
23:43ari____yeah
23:43hiredmanbah
23:43hiredmanhere
23:43ari____something with my version of clojure maybe
23:43carkwhat's your jvm version ?
23:43hiredmanare following my example exactly?
23:44ari____1.6.0_13
23:44ari____hiredman: yes, to the letter
23:47hiredmanwhere did you get your clojure jar?
23:48ari____must have been a transient bug between two releases, 1.1.0-snapshot works fine
23:48lisppaste8ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#3
23:48ari____thanks.
23:48ari____:)
23:49ari____appreciate your patience