#clojure log - Aug 04 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:00 mebaran151: so that I can get the first n intersections per se

0:00 hiredman: I 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

0:01 are these sorted-sets?

0:02 mebaran151: I could use a sorted-set easily

0:03 but I shouldn't think sorted-set would matter

0:03 hiredman: ,(first (set 4 5 6))

0:03 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$set

0:03 hiredman: ,(first (set [4 5 6]))

0:03 clojurebot: 4

0:04 hiredman: ,(first (set [5 4 6]))

0:04 clojurebot: 4

0:04 hiredman: hrm

0:05 ok

0:05 hrm

0:06 I don't know

0:07 ok

0:08 ugh

0:08 it is going to be kind of like reduce

0:08 or really reductions

0:08 ,(doc reductions)

0:08 clojurebot: "([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."

0:14 hiredman: lisppaste8: url?

0:14 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

0:15 hiredman pasted "f" at http://paste.lisp.org/display/84715

0:15 hiredman: maybe something like that

0:15 I haven't tested it

0:16 mebaran151: cool

0:16 hiredman: of course I haven't, or else that recur wouldn't be there

0:16 mebaran151: I think reductions should do it

0:16 hiredman: the recur should be replaced with a call to f

0:19 mebaran151: reductions isn't in the standard library ?

0:20 JAS415: so, i'm using apache httpclient 4.0

0:21 but it seems like it sucks compared to commons httpclient (3.0)

0:21 is this true?

0:21 mebaran151: JAS415, check out xlightweb's htttp client

0:21 it's much better, and has a really easy to use async mode

0:21 JAS415: well the thing is that i've got most of the code working

0:22 i can use oauth authentication and grab googlecharts

0:22 problem is httpclient 4.0 wants to encode all my urls without asking

0:22 which is a violation of my trust... :-P

0:22 (and screws up my charts...)

0:23 but i will check out xlightweb certainly

0:27 mebaran151: I started with apacheclient and got sick of it

0:28 besides xlightweb cooperates with the thread model much better

0:28 JAS415: i'm not suprised

0:29 apacheclient is kind of like an unruly 2 year old :-P

0:29 mebaran151: essentially I want to put a filter in front of lazy seq

0:29 xlightweb is brought to you by people who are considered jetty's competition

0:29 that's Serious Business

0:29 hiredman: mebaran151: it's in contrib

0:29 ,(doc reductions)

0:29 clojurebot: "([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."

0:29 hiredman: huh

0:29 oh

0:30 mebaran151: reductions doesn't quite do what I want

0:30 hiredman: yeah

0:30 mebaran151: because it's still giving me a list of lists

0:30 JAS415: what do you want to do exactly?

0:30 hiredman: that's why I said like reductions

0:30 JAS415: you want to filter a lazy seq (wasn't in channel)

0:30 mebaran151: #{0} #{0 6} #{0 6} #{0 6 12} #{0 6 12 18}

0:30 that's a list of sets

0:31 I want to lazy union them

0:31 so that if say I wrote (take 5 (magical laziness))

0:32 JAS415: you'd get union of the first 5

0:32 mebaran151: yeah

0:32 I want that union to look like an infinte stream

0:32 the internal algo should visit each iterative set until it gets enough to satisfy the take

0:33 JAS415: like reduce only with a delay

0:33 hiredman: I don't think that is possible

0:34 JAS415: i feel like you could do it with a hidden atom

0:34 mebaran151: yeah

0:34 a magical hidden atom

0:34 JAS415: use the atom like a closure and make it persistent across

0:34 mebaran151: but that seems a little bit nasty

0:34 JAS415: only problem is that you can access it in any order and get the same thing

0:34 mebaran151: also there might be a bunch of these in fligt

0:34 it would be a pity i I had to write my own take

0:35 JAS415: yeah magic atom is a bit ugly

0:35 mebaran151: and then tell my comrades they couldn't use all the coolness of the lazines fo ojure

0:36 like it seems like a pretty simple lazy function on some level

0:36 JAS415: the description is simple and the actual problem is hard

0:36 hiredman: if you think so, then write it

0:36 mebaran151: keeping hitting successive sets until you get enough to satisfy the take

0:36 heh, I can't figure out a way!

0:37 (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)

0:37 is there a concat-with-filter

0:37 JAS415: eh

0:37 i'm not sure there is a win from making it lazy though

0:38 well there must be i guess

0:38 mebaran151: I have to make it lazy

0:38 there are potentially an infinite number of things

0:38 JAS415: ooh

0:38 hiredman: ok

0:38 that is not going to work

0:38 mebaran151: those sets iterate forever

0:38 JAS415: but if you are doing like

0:39 hiredman: mebaran151: how do you know if 0 is in every set, if there is in infinite number of them to check?

0:39 JAS415: (reduce union (take n (listofsets)))

0:39 arohner: mebaran151: which is infinite? the number of items in a set, or the number of sets?

0:39 hiredman: arohner: no infinite sets

0:40 JAS415: infinite sets are cool

0:40 mebaran151: the number of sets

0:40 an infinite set would be pretty weird

0:40 hiredman: mebaran151: yeah, that is just not going to work

0:40 mebaran151: you don't need to

0:40 JAS415: no there must be a way to

0:40 hiredman: clojurebot: ruleset?

0:40 clojurebot: Titim gan éirí ort.

0:40 mebaran151: thesesets are a little specally

0:40 in that they'rebuilt from unions of the prior sets

0:41 so yeah, each is a superset of the prior set

0:41 they represent pulling more and more data from the databasetab

0:41 so you can be silly and check only the first n sets

0:41 arohner: leaving clojure aside, I don't see how you determine 5 items out of the unions of all these sets lazily

0:41 mebaran151: until you get enough matches

0:42 hiredman: http://paste.lisp.org/display/80355

0:42 JAS415: yeah

0:42 mebaran151: arohner, I would like it if I could just slipstreem it

0:42 JAS415: i used that to make my clojure inline + and * to whatever arity

0:42 mebaran151: so that underneath it's a bunch of iterative sets

0:43 hiredman: the problem with rulesets is you can't generate seqs from them, and all the function in clojure.set turn sets into seqs

0:43 mebaran151: I don't think I'd even need that

0:43 JAS415: yeah i guess they don't have an order do they

0:43 mebaran151: maybe I'm approaching the problem wrong

0:44 JAS415: probably :-P

0:44 mebaran151: I have a series of n cursors

0:44 that each point to a bunch of k v pairs right

0:45 I want to grab the first v values that have a key pointing to them

0:45 so k1 v1 k2 v1 k3 v1 would return k1 and k2

0:46 it's essentially a natural join

0:46 JAS415: (let [seq infinite-lazy-seq-of-sets]

0:46 (repeatedly (memoize #(take %1 seq))))

0:46 ?

0:46 oh

0:46 mebaran151: I have something like that

0:46 JAS415: throw in a reduce union in there

0:46 mebaran151: I do!

0:46 that's how you get the nested sets

0:47 you can't reduce union the whole thing, because I just want the cursors to scan up the number of results that are requested

0:47 hiredman: this is from a database?

0:47 mebaran151: berkeleydb

0:47 it doesn't provide me with no fancy sql's

0:47 hiredman: lazy access to db seems like a bad idea

0:47 JAS415: so..

0:47 mebaran151: oh

0:47 I make sure to close my cursors and everything

0:48 I have a set of functions that return views, which are essentially lazy list representations of a b tree

0:48 lisppaste8: Chouser pasted "lazy-union" at http://paste.lisp.org/display/84716

0:49 JAS415: hahaha sweet

0:49 mebaran151: coolio

0:49 Chouser: I imagine that can be refined a bit

0:49 hiredman: Chouser: and it works on an infinite sequence of sets?

0:49 Chouser: but I should be sleeping.

0:49 hiredman: don't see why not

0:50 mebaran151: gentleman we have a winner

0:50 Chouser: it hangs onto a real set of the elements seen so far, so that'll grow indefinitely

0:50 hiredman: Chouser: because how could it check to see if a value is a member of an infinite number of sets

0:50 mebaran151: you don't have to, because these are just spiraling unions anyway

0:50 JAS415: oh man, that's philosophical

0:50 Chouser: if the first seq is infinite, it'll never look at the others

0:50 mebaran151: if it's in the first set, I'm happy

0:50 if it's the second set I'm happy

0:51 JAS415: oh man

0:51 mebaran151: if it's in the third set I'm happy

0:51 JAS415: just don't write a loop depending on it being in the set

0:51 mebaran151: these sets aren't arbitrary

0:51 they're based off each other

0:51 this was perfect!

0:51 hiredman: well then it's hardly a general lazy-union

0:51 mebaran151: that function was definitely cool beans

0:52 JAS415: gonna be hard to do generally without holding on to a ref

0:52 mebaran151: in the end the iterations end, because you fall off the end of the tree

0:52 so philosophically I'm safe too

0:53 each of those sets contain a result set which is predetermined to be a potential solution to the criteria

0:53 thanks Chouser!

0:53 Chouser: yw

0:53 I thought I'd need a loop, that's why I used lazy-seq

0:54 but since I did the skipping with drop-while, I bet this could be written using iterate instead.

0:54 mebaran151: heh

0:54 Chouser: however, I must refrain. Perhaps as an exercise for the reader.

0:54 mebaran151: iterate is a very cool function

0:54 Chouser: I should not be awake, I just couldn't resist when someone uses words like "impossible". :-)

0:55 mebaran151: (its how I build my result sets in the first place)

0:55 Chouser: g'night!

0:55 mebaran151: ha

0:55 hiredman: call it lazy union if you want

0:56 mebaran151: I understand it's not fully general

0:56 JAS415: doing impossible things is funny

0:57 mebaran151: but I essentially just wanted a stream-union

0:57 sort of thing

0:58 I 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

0:59 so 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

0:59 now a lazy intersection would make much less sene

0:59 *sense

1:00 hiredman: you're right, union is associative

1:00 tomoj: I had a somewhat similar problem that involved a strange solution

1:00 it seems like you'll be generating elements of the sequence faster than they are asked for

1:01 mebaran151: most likely

1:01 the prefetch is not a problem though

1:01 in my code you specify a chunk size of records to fetch at a time, depending on how you plan to use them

1:02 JAS415: perhaps i should be blaming java for my troubles

1:02 mebaran151: hah my logic course has finally paid off

1:02 tomoj: prefetch was problematic for me

1:02 but I am a clojure noob

1:02 mebaran151: as am I

1:03 the other nice thing about clojure lists is there are no mutable operations

1:03 tomoj: I ended up having to do this: https://gist.github.com/4317ccd3662750ec3876

1:03 JAS415: i kind of like being a noob

1:03 mebaran151: so none of my coworkers will be fooled into thinking they can WRITE to the database this way

1:03 tomoj: which is very opaque

1:03 mebaran151: not terribly

1:04 I think I follow it

1:04 heh, we could have an obfuscated clojure contest

1:04 who can write macros that do the most evil

1:04 JAS415: http://paste.lisp.org/display/84717

1:04 i've already written an evil macro

1:04 so this means that it won't parse my string into a uri

1:04 although it will parse it as a url

1:04 string is

1:05 tomoj: the 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

1:05 hiredman: ,(pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x)))

1:05 clojurebot: (1 2 3 4 5 6 7 8 9 10)

1:05 JAS415: string is in the error

1:05 tomoj: so I had to prefetch a bunch of bits and return them one at a time. but the naive implementation did an infinite loop

1:05 mebaran151: intersection is commutative right?

1:05 tomoj: yeah

1:05 JAS415: hum

1:05 mebaran151: yeah it has to be

1:06 tomoj: "and" is commutative

1:06 mebaran151: that's not always the best test

1:07 hiredman: ,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle))

1:07 clojurebot: ((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))

1:07 tomoj: mebaran151: not sure what you mean

1:07 intersection is a thin wrapper around "and"

1:07 mebaran151: sometimes grammar rules can trick you

1:07 oh

1:07 yeah, logical and certainly

1:08 tomoj: ah, yeah

1:08 english is weird :)

1:09 JAS415: i can't believe i cant use httprequest without going through URI

1:09 that's lame

1:09 mebaran151: welcome to Java Land

1:10 as I said yesterday, for BerkeleyDB, I've built so many factories I feel like the Soviet Union

1:10 for something as simple as reading a key and writing a key in an ordered Btree, you shouldn't need configuration factory objects

1:11 JAS415: well it just makes it impossible to use that method with certain things

1:11 tomoj: JAS415: what http client are you using?

1:11 JAS415: as much as i really like clojure i hate java

1:11 tomoj: clojure-http-client can take strings

1:11 JAS415: i'm using apache httpclient

1:11 it takes strings but it mangles and converts them

1:11 mebaran151: clojure-http-client is not assynchronous which is a bummer

1:11 JAS415: other things are a no-go as i'm also using oauth signpost

1:12 mebaran151: I'd submit a patch, but I only got async http to work with xlightweb, which for a Java library was actually relatively sane

1:12 java should really come with async http built in

1:12 JAS415: i thought i'd be able to write a library to write interfaces to restful apis, but googlecharts is giving me trouble at the moment

1:12 mebaran151: wasting threads is so 2002

1:12 JAS415: because they use commas

1:13 mebaran151: have you tried it with plain ol' Java.net

1:13 JAS415: so i'm wasting time trying to figure out away around the arbitrary path that httprequest takes through URI encoding

1:13 mebaran151: you can do almost anything in Java.net

1:13 JAS415: I already did it with java.net

1:13 mebaran151: oh, was there failure?

1:13 JAS415: no it worked perfectly

1:13 mebaran151: so, why are you binding Apache Commons?

1:13 JAS415: then i reimplemented it without .net so that i could use oauth properly

1:13 not commons

1:14 4.0 httpclient

1:14 mebaran151: .net won't work with oauth?

1:14 JAS415: i think they are different

1:14 tomoj: mebaran151: what does "async http" mean? the function that does the request returns before the http request finishes?

1:14 JAS415: i was having trouble

1:14 because of twitter actually

1:14 haha

1:14 mebaran151: tomoj, instead of the thread stalling, you just give it a success callback

1:14 tomoj: ah, I see

1:14 mebaran151: so the thread can continue to do other work

1:14 JAS415: oauth only works for twitter auth if you use a certain authorization not supported by .net

1:14 tomoj: luckily I don't need that :)

1:14 mebaran151: later on, some other manager object will pass your callback the data

1:15 like ajax

1:15 JAS415: pretty much this project started off very successfully then managed to cascade into multitudes of incompatibilities

1:16 although i did use the same library to interface with eve-online and twitter, which was fairly neat

1:31 mebaran151: neato

1:31 I do something actually pretty similar, but I script the whole thing in Rhino

1:31 and run the rhino using clojure

1:31 getting Rhino and clojure to talk to one another was a total pain

1:31 Rhino liked to return perverse objects that were essentially binary blobs

1:40 man lazy sequences are cool

2:00 Jomyoot: The .clj file can be compiled?

2:00 and will compiling help prevent ninjas from stealing my source code?

2:00 Carkh: clojurebot: compilation?

2:00 clojurebot: compilation is see compile

2:01 Carkh: clojurebot: compile?

2:01 clojurebot: the 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

2:01 Carkh: that's bytecode compilation, that's always decompilable

2:02 Jomyoot: to what? clojure code?

2:02 or java code

2:02 Carkh: java code

2:02 quite unreadable though

2:03 mebaran151: it makes a class for every fn and other such construction

2:03 (in java you've got classes and classes)

2:03 Jomyoot,

2:03 Java itself can be fairly easily precompiled

2:03 *decompiled

2:05 Jomyoot: yes but wouldn't we get unreadable java code

2:05 Carkh: give it a try

2:05 hiredman: it would be odd looking, but I think readable

2:06 http://georgejahad.com/clojure/clojureDecompiled.html

2:06 mebaran151: eh, 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

2:06 JAS415: unreadable java code, redundant! :-P

2:06 Carkh: lots of indirections, and i guess an object for every closure

2:06 JAS415: i fixed my problem

2:07 Jomyoot: hader to read than decompiled java

2:08 what is your favorite programming fonts?

2:08 hiredman: dejavu sans mono has the best unicode coverage by far

2:09 mebaran151: Jomyoot, 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

2:09 hiredman: consolas is very nice, but I like having all the glyphs

2:09 mebaran151: I like Monaco or Monospaced at 13

2:09 Inconsolata is nice too

2:09 and free as in freedom!

2:10 hiredman: the Droid fonts from android have a nice monospaced font

2:10 but again, dejavu sans mono just has more glyphs

2:11 mebaran151: I tried Droid, not quite as elegant as Inconsolata

2:13 hiredman: λ · → ↑ א₀ ♥ ¡ ¿ ‽ ؟ əə

2:15 JAS415: why are people decompiling clojure?

2:15 hiredman: to get a better understanding

2:16 JAS415: i just read the source...

2:16 hiredman: *shrug*

2:17 JAS415: seems silly to go to all the trouble if you can just download a copy of the java :-P

2:17 hiredman: it's interesting to see what the class a function compiles to looks like

2:17 mebaran151: it's cool to see how the functions translate out

2:18 hiredman, are extra chars really worth more

2:18 a friend of mine has been campaigning for them

2:18 hiredman: Yes

2:18 mebaran151: but it seems so nasty to get them to work properly everywhere

2:18 hiredman: maybe

2:18 JAS415: how are you going to type them?

2:18 hiredman: I don't remember

2:18 JAS415: depends

2:18 mebaran151: he's a smart guy: I think the extra char disease in an artifact of the Comp Sci PhD process...

2:19 JAS415: i would be more worried about that

2:19 mebaran151: *is an

2:19 JAS415: i remember using alt and keypad or something

2:19 mebaran151: you can map your keyboard

2:19 hiredman: you can do that

2:19 mebaran151: and then confuse your friends!

2:19 JAS415: impress women?

2:19 mebaran151: on his keyboard, he remapped the parens to ; and '

2:19 hiredman: for irssi I have it setup to auto replace somethings with other things lambda => λ

2:19 mebaran151: and did a bunch of other things

2:20 hiredman: ¿ => ¿

2:20 er

2:20 .? => ¿

2:20 mebaran151: /\ wasn't good enough :P

2:21 JAS415: i haven't yet met a female impressed by macro writing ability

2:21 even my current girlfriend just laughs at me

2:21 hiredman: ,(pl (inc · inc · inc 1))

2:21 clojurebot: 4

2:21 mebaran151: make a macro that makes bunny pictures

2:22 everybody loves bunny pictures

2:23 JAS415: that's true

2:23 i do like bunnies

2:23 sound logic

2:42 mebaran151: I had a hard enough time trying to explain to an actionscript guy on my team why infinite lists were just so cool

2:43 when I was doing Ruby, I always thought the Lisp people's were exaggerating the coolness of macros: I was naive and wrong

2:45 the coolness of macros can only be appreciated by those who have witnessed their power firsthanded

2:54 tomoj: mebaran151: YES

2:54 I am the only one of the group of CS kids I know who appreciates lisp

2:54 well, only rubyist too, but..

2:59 mebaran151: we needz moar sp33d!!!111

2:59 Raynes: MOAR!

3:02 mebaran151: I 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

3:44 Fossi: is there a quick way to get the negative of a number or is it (- 0 num)?

3:45 _mst: just (- num) will do the job

3:46 Fossi: ah, right

4:20 LauJensen: Top of the morning gents

4:27 mebaran151: does or short circuit?

4:30 tomoj: mebaran151: yup

4:30 I discovered that from (doc or)

4:31 mebaran151: ha, but it's easier to ask on IRC!

4:31 Fossi: (or (do (print "foo") true) (print "bar"))

4:31 tomoj: I always have my repl open

4:31 mebaran151: yep I just did the test

4:31 I had my repl open

4:32 but it was giving me weird results

4:32 tomoj: ,(or (do (print "foo") true) (print "bar"))

4:32 clojurebot: true

4:32 mebaran151: turned out I'd forgotten my own argument order

4:32 clojurebot: foo

4:32 mebaran151: so what I thought was nil, truly wasn't!

4:32 tomoj: was that a pun

4:46 gko: How do you deal concurrency with sockets?

4:48 AWizzArd: gko: depending on what you do.. there are things that are parallelizable while others are not.

4:49 gko: AWizzArd: typical use: pool of (client) sockets used on demand by pool of threads.

4:51 AWizzArd: each thread could request at anytime the use of a socket to send a request. Does (dosync ...) protect usage?

4:59 mebaran151: tomoj, I wish I was so clever

4:59 gko, I think so

5:00 though I don't know how well it works with sideeffects...

5:02 gko: mebaran151: right... if some thread is sending/receiving data, the socket referenced by the ref doesn't change value...

5:02 mudphone: anyone know how to save *out* to a string?

5:05 gko: ,(.write *out* "test")

5:05 clojurebot: test

5:06 mudphone: gko: 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

5:06 Fossi: mudphone: with-out-str

5:07 mudphone: Fossi: great, that looks awesome

5:07 gko: How to make *out* to print out in the REPL when in a thread?

5:07 (.write *out* "test") => OK

5:07 Fossi: mudphone: but if you only want it for one strint, there's print-str

5:08 gko: but: (.start (Thread. (fn [] (.write *out* "Hello")))) => nothing

5:08 mudphone: ,(do (def my-var (with-out-string (println "hello"))) my-var)

5:08 clojurebot: DENIED

5:08 opqdonut: with-out-string, yes

5:08 mudphone: ,(def my-var (with-out-string (println "hello")))

5:08 clojurebot: DENIED

5:09 mudphone: doh

5:09 Fossi: ,(print-str "something")

5:09 clojurebot: "something"

5:09 tomoj: why are those denied?

5:09 mudphone: ,(with-out-string (println "hello"))

5:09 clojurebot: java.lang.Exception: Unable to resolve symbol: with-out-string in this context

5:09 Fossi: gko: maybe start slime with slime-redirect-inferior-output

5:09 tomoj: it's with-out-str

5:09 mudphone: ,(with-out-str (println "hello"))

5:09 clojurebot: "hello\n"

5:09 opqdonut: ,(with-out-str (println "hello"))

5:09 clojurebot: "hello\n"

5:09 opqdonut: gah

5:10 mudphone: excellent

5:10 gracias

5:10 Fossi: mudphone: as i said, if you only want to format one string, there's print-str as well

5:10 and format of yourse

5:10 *course

5:11 mudphone: ,(print-str (println "hello"))

5:11 clojurebot: "nil"

5:11 hello

5:12 mudphone: Fossi: I think I need with-out-str

5:12 gko: Fossi: (slime-redirect-inferior-output) => no effect

5:12 mudphone: Fossi: Thanks

5:12 I'm setting up an ajaxy front end to serve up (doc) calls

5:13 Fossi: more like (print-str "%s" "string")

5:13 ups

5:14 gko: Fossi: oh... if I do a println, then the stuff with (.write *out* ...) comes out...

5:14 Fossi: mudphone: yeah, then you want with-out-str

5:14 gko: hmmm. buffer flushing? or lazyness?

5:14 gko: Fossi: have to flush it...

5:15 mudphone: Fossi: I always think I have to do more work than I really do :)

5:15 Fossi: same here, rally :)

5:15 *really

5:15 man, i can't type today... :\

5:16 mudphone: does sed work here?

5:16 s/sed/something/

5:16 guess not

5:44 Fossi: what's the compiled clojure in clojure.jar good for?

5:46 i'd like the smallest clojure build possible, because dexing for the dalvik vm takes ages like this

5:46 Chousuke: clojure-slim is supposed to be that I think?

5:46 the jar

5:47 Fossi: yeah, but i don't quite get what i need the clojure sources and the java things for

5:48 *are

5:48 i guess only including the clj would make the deployment faster, because it's only text to the dexer

5:48 but then everthing needs to be compiled in time, right?

6:26 LauJensen: (doc conj!)

6:26 clojurebot: "/;nil; "

6:26 LauJensen: (doc future)

6:26 clojurebot: "([& 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."

6:26 LauJensen: Man thats awesome

6:27 Where does he get the ideas for this stuff? :)

6:31 Fossi: future?

6:34 LauJensen: Yea among other things

6:36 eevar2: LauJensen: books/papers on languages and language design?

6:37 Jomyoot: I don't want #file.txt# all over

6:37 Fossi: well, future is part of java :)

6:37 Jomyoot: how do I remove that?

6:39 arbscht: Jomyoot: are those emacs backups?

6:39 Jomyoot: yep

6:40 arbscht: Jomyoot: for details try M-x apropos backup, or ask in #emacs, or check emacswiki.org

6:41 basically you can set backup-directory-alist to put backups in a designated directory. or you can disable the feature altogether somehow

6:42 LauJensen: (setq backup-directory-alist (list (cons ".*" (expand-file-name "~/.emacsbackup/"))))

6:42 I think the #file# files are locks though, and they go away soon as you close the buffer, but the clj~ are the backups

6:47 vvl: #files# should be auto-save files

6:47 which can be disabled as well

6:48 Raynes: I just have all my auto-saves and backups sent to a .saves directory.

7:31 djpowell: cool - on the newnew branch, jad core$future_call$obj__6472.class actually manages to decompile it to java

8:15 adityo: i have a query?how do i write obj.methodname("value") into Clojure (.methodname value obj)

8:16 Chousuke: adityo: (.methodname obj value)

8:16 or actually, "value" since it's a string :P

8:16 ,(.substring "Foobar" 2)

8:16 clojurebot: "obar"

8:16 adityo: Chousuke: thanks, "value" it :)

8:58 lnostdal: hi, 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?

9:01 Fossi: eh, what?

9:02 lnostdal: Fossi, 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

9:02 Fossi: you can compile to java or run from the repl or whatever you want

9:02 * Fossi scratches head

9:03 Fossi: i'm not sure i get what you are up to

9:03 lnostdal: ok

9:03 mccraig: lnostdal: there is no save image function in clojure

9:45 dysinger: whasup danlarkin

9:45 danlarkin: mornin!

9:46 rhickey: so, any experience reports w/transients?

9:47 cgrand: rhickey: is anyone working on TransientHashMap?

9:47 rhickey: cgrand: I'm not yet, I'm sure that's even more in demand than the vector

9:47 danlarkin: no speedup in clojure-json array decoding, so I guess the vector operations are not the bottleneck

9:48 rhickey: danlarkin: it will only improve write speed, reads for transients are the same (v. good) as for normal persistents

9:49 cgrand: I think the same strategy will work for all of the tree=based data structures

9:50 danlarkin: rhickey: Yeah I mean conjing up a clojure vector from a json array

9:50 rhickey: ah

9:50 cgrand: rhickey: yeah, I guess that there's no need to introduce a Node type, edit can be added to existing INode impls

9:51 rhickey: cgrand: right, I was using raw arrays in pv, there are already nodes in pmap

9:51 cgrand: but one can not change IName to AName because LeafNode extends AMapEntry :-(

9:51 rhickey: one complication is the sparse nature of the maps. Maintaining that would make key-inserting/deleting ops no faster

9:53 I have ideas about partial-sparseness, e.g. non-sparse for all but the last level or two

9:53 this would remove some of the bit twiddling from the intermediate steps, at a minor cost in space

9:54 overall better lookup times, and more amenable to transients

9:55 value-modifying ops would get huge speedup from transients even with the current structure

9:58 I also have ideas about getting rid of the key/value hlding LeafNode objects, using an array pair in the inner nodes

9:59 holding

10:00 cgrand: hmm... does this mean that I shouldn't try to write TransientHashMap and that you prefer to rework PersistentHashMap before?

10:02 rhickey: cgrand: 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:02 cgrand: great!

10:03 rhickey: I could use the help

10:06 unfortunately the hashmap code is a little, ... tricky :)

10:09 cgrand: I noticed

10:10 rhickey: I'm not sure the polymorphic nodes bought me as much as they did with the RB tree in PTreeMap

10:10 cgrand: you understand the edit mechanism in PersistentVector ok?

10:10 cgrand: yes

10:10 rhickey: cool

10:34 Chousuke: hmm

10:35 My clojure reader written in Clojure has now successfully read "(())" as (())!

10:36 I wonder at which point will I encounter something that forces me to start over, though.

10:40 cemerick: rhickey: I guess I was somewhat too extemporaneous with my proggit title, eh? :-/

10:43 rhickey: cemerick: I liked it, but it is subject to wildly varying interpretations

10:44 cemerick: yeah. DRMacIver and I both misunderstood each other. Typical internet discourse, etc.

10:45 rhickey: yeah

10:45 cemerick: I should have just said "Hey, this ain't LTU, whadda want?!" :-D

10:45 dysinger: cemerick: heh DRMacIver - don't get me started

10:46 cemerick: dysinger: run-ins?

10:46 dysinger: yes

10:46 cemerick: I remember him being helpful in #scala when I used to hang there

10:46 of course, I wasn't there long

10:47 leafw: anybody knows that tool is being used to render the UML diagrams of clojure classeS?

10:47 rhickey: cemerick: 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:47 dysinger: I am sure most of the time he's fine cemerick

10:47 as am I ;)

10:47 rhickey: DRMacIver always seems reasonable to me

10:48 cemerick: rhickey: there was that SP mention, but I've no idea what that's about :-)

10:49 dysinger: leafw: link ?

10:50 rhickey: http://www.haskell.org/ghc/docs/latest/html/libraries/array/Data-Array-MArray.html

10:50 danlarkin: leafw: http://github.com/Chouser/clojure-classes/tree/master

10:50 rhickey: freeze - full copy, unsafeFreeze, um, unsafe

10:52 and IArray and MArray have very different interfaces it seems

10:52 leafw: dysinger, danlarkin : thanks.

10:53 koba: hello

10:53 dysinger: cool /me clones that

10:53 cemerick: wtf: "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:54 rhickey: cemerick: thus, unsafe

10:54 cemerick: my basic reaction is, "what's the point"

10:57 rhickey: cemerick: well, it's enough to say that transients are different, in important ways

10:58 I don't know of anything similar (although it's likely there's something)

10:59 to/from O(1), same shape, mirror API

10:59 cemerick: rhickey: I'm sometimes prone to hyperbole. Strong opinions, weakly held, etc.

11:00 koba: hi 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:00 * rhickey waits for cgrand to finish TransientHashMap... :)

11:01 koba: I'm just very happy to have found a new language to delve into and enjoy :-)

11:01 cemerick: I've been burned by Collections/unmodifiable* too many times to mess with simple wrappers around mutable collections.

11:01 drewr: koba: there's no turning back now

11:01 rhickey: cemerick: 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:01 cemerick: koba: welcome :-) Feel free to stick around.

11:01 AWizzArd: rhickey: what would those hash map do?

11:02 Would that solve the problem if very fast instantiation of small immutable objects?

11:02 koba: thanks - I'm only an undergrad AI student but I'm delighted to see that Lisp still has a future

11:02 AWizzArd: if ==> of

11:02 rhickey: AWizzArd: support transient/persistent!/assoc! etc

11:02 cemerick: rhickey: 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:04 wlr: rhickey: 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:04 koba: at 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:04 avoid*

11:05 wlr: rhickey: er... i cited first runs backwards above. sorry.

11:05 koba: anyone got any suggestions for a first project with Clojure? Something AI related would be great

11:06 cemerick: wlr: 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:06 rhickey: wlr: right, the only times that matter are post-hotspot IMO

11:07 AWizzArd: koba: you could develop a lib with support for several kinds of neural networks.

11:08 koba: AWizzArd: Could do. I would have thought you could get that from the Java side though

11:09 cemerick: rhickey: 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:09 (takes longer than other optimization paths, that is)

11:09 clojurebot: that is not what I wanted

11:09 AWizzArd: koba: so we need to find something for which there is no Java solution yet, but which is still AI.

11:10 koba: I 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:10 AWizzArd: koba: you could write a DSL for parsers. EBNF2Clojure or so.

11:10 koba: hmm..nice idea

11:11 rhickey: cemerick: 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:11 koba: my lectures have mostly been for natural language parsers. I've only just learnt basic parsing with pyparsing...I like that API though

11:11 with a lisp I guess I could get it to just read EBNF

11:11 which would be really nice

11:13 Or something with planning domains and logics?

11:14 AWizzArd: koba: or you could implement a unicode infix macro "math" for Clojure. So people could write (math "14√π³ * 10x² + αδ")

11:14 if it is very good then rhickey would maybe integrate it with a nice reader macro into Clojure :-)

11:15 koba: AWizzArd: Another nice idea! Or how about let it read/eval Latex math expressions instead?

11:15 AWizzArd: why not both modes? :-)

11:15 koba: yeah

11:15 I really like that idea...would be great for either formula documentation

11:15 stuartsierra: Latex is not easy to parse, or implement.

11:16 AWizzArd: Then 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:16 koba: hmm...even if I start with a small subset?

11:16 AWizzArd: try a small subset

11:16 saving the multiplication for things like 6x + 2y or so

11:16 mebaran151: Latex isn't even easy to version!

11:16 AWizzArd: the multiplication symbol "*" I mean

11:17 koba: hmm..maybe I should look into defining my own simple markup?

11:17 then that could map to simple LaTex expressions for nice formatting maybe

11:18 mebaran151: any easier way to get all the natural numbers than (iterate inc 1)?

11:19 koba: + - \times \frac{}{} \int^{}_{} ^ (superscript) and _ (subscript) should be simple enough

11:20 AWizzArd: mebaran151: iterate is fine

11:20 koba: but I think that you should still start with *readable* unicode syntax first

11:21 koba: AWizzArd: Ok, + - * / () can be found in latex maths too

11:21 and ^ would be the same too

11:21 AWizzArd: including pi, square root, summation, superscript numbers in combination with vars such as x⁵⁹

11:22 koba: what is the unicode way of doing root? I would use \sqrt{} normally

11:22 and \sum{} for summation

11:23 how would you consider a more natural notation for those things?

11:23 AWizzArd: 6√π⁸

11:23 koba: ok...if you have unicode characters on your keyboard ;-p

11:23 or know the codes?

11:23 AWizzArd: easier than (* 6 (Math/sqrt (Math/pow Math/PI 8)))

11:24 unicode chars directly in source code

11:24 koba: yeah

11:24 AWizzArd: it's a thing of the editor to provide those

11:24 koba: ok, depending on the editor of course

11:24 but yeah, as long as it is unambiguous

11:24 AWizzArd: sure, if a team to decides to use it they know what they are doing

11:25 then they will have to stick to their environment

11:25 and several keyboard layouts can easily type unicode, such as mine for example :p

11:25 koba: that is a nice project...thanks. I use LaTeX all the time

11:25 also readable maths is good too

11:26 (I consider Latex readable ;-p)

11:26 AWizzArd: if you split the task up correctly, then the parser is composable, and one could have different modes.

11:27 stuartsierra: I 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:27 Or maybe it was IBM.

11:27 fffej: stuartsierra: it was Sun with Guy Steele with Fortress

11:27 koba: got it on wikipedia

11:27 stuartsierra: What ever happened with that?

11:28 koba: http://en.wikipedia.org/wiki/Fortress_(programming_language)

11:28 apparently version 1 came out last year

11:28 fffej: stuartsierra: it's still going afaik, there was some interesting work on concurrency recently.

11:28 stuartsierra: ok, cool

11:28 koba: ok, this will be my project for the rest of the summer then...

11:29 fffej: see http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf

11:29 koba: I would also like to thank rhickey for his great videos and work on this language

11:30 I'll try to get some other AI people here onboard

11:32 I don't know how much momentum clojure has atm..that is my only worry before learning the language

11:33 there seems to be plenty of people on this channel though

11:33 AWizzArd: koba: the phase of no-interest in programming is over

11:34 in the months February-May people are not interested in it

11:34 koba: hmm..what do you mean?

11:35 AWizzArd: in January many people were interested

11:36 in Jan. we had even more people in here

11:36 koba: strange

11:36 AWizzArd: since many years people stop posting in newsgroups and hanging out in irc programming channels in those months

11:36 during spring mostly :)

11:36 koba: ah..I see

11:37 I rarely use IRC myself, this is a one off :-)

11:37 AWizzArd: or for example, check the number of patches to bigger systems, such as Clojure itself during that time.

11:38 koba: didn't know of such a general trend

11:38 well, summer holidays in the nothern hemisphere?

11:38 though for students like me, summer is the best time for new projects

11:40 anyways, I'm sure I'll be back when I have questions...once again, thanks for the idea!

11:40 farewell!

11:55 cgrand: ,(-> [] (with-meta {:foo :bar}) transient persistent! meta)

11:55 clojurebot: java.lang.Exception: Unable to resolve symbol: persistent! in this context

11:56 mebaran151: I don't think clojurebot has been built with upstream clojure yet

11:56 Chousuke: it's got new new though :P

11:57 but hm, enough for tonight

11:57 I have a reader that creates lists, vectors and maps now (and is able to read simple symbols)

11:57 cgrand: well, it returns nil: metadata is not (yet) preserved through transient

11:58 Chousuke: (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:22 sh10151: Is there a way to get the Clojure REPL to use pprint when printing data structures?

12:23 barring that, a way to get SLIME to use it?

12:31 lisppaste8: cgrand pasted "TransientHashMap: work in progress" at http://paste.lisp.org/display/84750

12:33 leafw: looks like this is part of the clojure in clojure dev -- just thinking aloud

12:33 oops didn't read enough, this is just a testing script

12:35 cemerick: cgrand: looks promising :-)

12:36 LauJense`: is mutable and conj! in the master branch ?

12:36 Chousuke: LauJense`: mutable was renamed to transient, and yes, it's in master for vectors

12:36 LauJense`: k

12:39 LauJensen: I 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:52 ...like Symbolic Web from CL

12:54 (which is now dead)

13:04 stuartsierra: Long-lived HTTP is hard.

13:05 The only really successful use I've seen is from Google.

13:09 LauJensen: Symbolic Web actually seemed very functional with very few lines of code as I recall..

13:10 stuartsierra: Maybe up to a few dozen connections. It's a whole different game with real traffic.

13:12 LauJensen: Why?

13:13 @ stuartsierra

13:13 stuartsierra: I've heard you've got to futz with TCP stuff to handle so many open connections.

13:13 * stuartsierra runs away before his ignorance is revealed

13:13 LauJensen: hehe :)

13:16 rhickey: cgrand: 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:17 and surprised the first case does any better at all!

13:18 I guess sometimes you have the same size inner node

14:00 cgrand: rhickey: yup, inner nodes are still packed.

14:00 * Chousuke fear transients are going to make people think they're suddenly allowed to write imperative algorithms.

14:00 Chousuke: +s

14:02 Fossi: well, aren't they?

14:02 LauJensen: I had the same concern Chousuke

14:02 Chousuke: Fossi: no.

14:02 cgrand: about persistent! being O(1): would an amortized O(1) be acceptable?

14:02 LauJensen: Fossi, yes and no... hmm, was gonna make a Python joke :)

14:03 Chousuke: Fossi: if you call a destructive operation like (assoc! tv 0 1), you should not reuse the tv name after that.

14:04 While it does work (for now), (do (assoc! tv 0 1) (assoc! tv 1 2)) is not how you should use transients.

14:07 cemerick: Chousuke: 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:07 Carkh: well isn't it true that sometimes an imperative algorithm is easier to pull off ?

14:08 Chousuke: if you use imperative style, you're reintroducing the burden of side-effects.

14:09 Fossi: at least in a defined scope, i think that's ok

14:09 cemerick: rhickey: 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:09 Chousuke: if 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:12 cemerick: isn't the properties file there just to set the correct value for clojure-version at build time?

14:13 ,*clojure-version* ; this I mean

14:13 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}

14:13 cemerick: Chousuke: no, it's loaded by core.clj (or core__init.class)

14:13 Chousuke: hmm :/

14:14 cemerick: I 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:15 ideally, the AOT'd clojure jar should contain *only* classfiles

14:22 berk: I need a little handholding with eclipse plugin

14:22 How do I use latest git versions of clojure-contrib and clojure with it?

14:25 I want to experiment with transients but don't know how to build clojure

14:25 baetis-fly: anyone know why contrib's prxml prints to *out*? Couldn't it just return a string and let me print it if i want?

14:25 gko: berk: get code from github.com, then "ant"

14:25 hiredman: ,(doc prxml)

14:25 clojurebot: "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:25 gko: it will build the .jar files.

14:26 Chousuke: baetis-fly: printing to a stream is faster and more flexible.

14:26 baetis-fly: use 'with-out-str

14:26 (doc with-out-str)

14:26 clojurebot: "([& 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:26 berk: gko: thanks. I already got the files. but just "ant"?

14:26 baetis-fly: Chousuke: oh, nifty. Many thanks.

14:27 gko: berk: Yes... "git clone git://github.com/richhickey/clojure.git"

14:27 berk: cd clojure

14:27 berk: ant

14:27 berk: finished

14:27 berk: ok. thanks

14:27 gko: same for clojure-contrib.

14:28 LauJensen: same for clojureql

14:28 * Fossi1 should write a dex compiler for clojure

14:28 gko: berk: and if you want to update your current source: cd clojure, git pull original master, ant.

14:29 hiredman: for contrib you want to tell it where to find clojure.jar so it can AOT compile stuff

14:29 berk: I don't have a standalone ant installed. I'll have to figure out that first. (I'm on windows)

14:30 Fossi1: i wonder how hard that would be

14:30 you could cross compile all the libs to dex anyway

14:30 gko: My 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:30 Fossi1: so it should be more or less only the compiler & output

14:30 gko: berk: I'm on Windows too.

14:31 hiredman: Fossi1: nah, you need an asm library for dex

14:31 gko: oh, the swank client hasn't connected.

14:31 Fossi1: hiredman: ah, i see

14:32 gko: it is: Connected. Let the hacking commence!

14:33 hiredman: some 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:33 which it did not really have before

14:33 so maybe a dalvik asm lib will follow

14:33 Fossi1: well, i don't care so much about runtime stuff

14:33 which would of course be great as well (you can use dex on dalvik for that)

14:34 but it's annoying that i have to AOt to java from clojure and then to dex again

14:34 takes quite a while and i hate deployment cycles

14:36 time for a bit of socialising

14:45 cemerick: what's this "dex"?

14:46 hiredman: dex is the tool for transforming jvm bytecode into dalvik bytecode

14:46 dex is also the extension for dalvik bytecode files

14:46 cemerick: ah-ha

14:47 is android going anywhere? From afar, it seems to have petered out pretty silently...

14:48 rhickey: cgrand: could you explain why amortized? and amortized over what, since invoked only once

14:49 * eevar_ is buyinng a samsung galaxy once they ship here

14:49 hiredman: cemerick: there tons off handsets in the pipe line running android

14:50 rhickey: cemerick: could you please bring up the properties file thing on the list?

14:50 cemerick: rhickey: np

14:51 hiredman: http://gizmodo.com/search/android%20phones

14:53 eevar_: htc hero looks nice too

15:51 mebaran151: how could I build something like a take-while with lookbehind

15:51 I can't use reduce because it isn't lazy enough

15:51 hiredman: use lazy-seq and roll your own

15:53 mebaran151: alright

15:53 hiredman: or make the function arg to take-while close over an atom or something to do state munging, this is to be frowned upon

15:54 mebaran151: I'd prefer the lazy-seq approach

15:54 any good tutorials on lazy-seq: I don't quite grok them yet

15:56 stuartsierra: basically you write a recursive function that ends with (cons current-value (call-myself ...)) and wrape the whole thing in lazy-seq

15:59 mebaran151: I see

16:00 thanks

16:18 konrad_: 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:20 hiredman: run ant

16:27 * cemerick cringes @ getting java libs via package managers (they're almost always old, improperly-built, etc etc)

16:28 cemerick: I'll never forgive aptitude for the hour I spent fiddling with a hopelessly-broken glassfish install.

16:28 * danlarkin *thinks* the gentoo ebuild of clojure and contrib is correct, not that it matters right now. The guy writing it was nice enough to come in here and ask if he'd done it right

16:28 technomancy: cemerick: yeah, same here with debian's solr.

16:29 it's like they don't even try

16:29 cemerick: I really wish they wouldn't, period.

16:39 LauJensen: Nice to hear 2 old grumby men discuss package management :)

16:39 Fossi: :D

16:39 i have to admit that i begin losing faith in gentoo

16:40 as i did in debian

16:40 the amount of open source and it's dependencies makes page management really nasty

16:41 cemerick: LauJensen: I'm actually very jovial...and technically young, though I've felt old of late...

16:41 :-)

16:41 LauJensen: hehe... the fact that you need to defend yourself says something though :)

16:49 ari____: 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:49 i'm using the latest released emacs-23

16:50 i'd try to use clojure-install, but that doesn't work for me because of bizarre git+emacs interaction problems atm

16:52 technomancy: ari____: 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:52 and don't forget to file a bug report with Apple about it.

16:53 Chousuke: hm

16:53 ari____: mmk

16:53 Chousuke: here I was worrying about how to handle all the . sugar in my little clojure-reader, but it seems the reader needn't care!

16:54 (foo.) etc. are apparently expanded by the compiler, not the reader.

16:56 ari____: clojure-install eventually fails for me with cd: No such directory found via CDPATH environment variable

16:57 technomancy: ari____: oh, someone else was reporting this bug the other day... some problem with autoloads. are you installing it in the default location?

16:59 ari____: I wasn't, I'll give it another try

17:02 that seems to be better, thanks

17:03 cemerick: Chousuke: that's interesting -- in that case, I'm surprised that symbols ending in . aren't allowable (or aren't functional, more like)

17:03 ari____: 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:03 got to run, but i'll be back later if further debugging is warranted from anyone

17:03 thanks

17:03 konrad_: 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:05 oh, it's in the faq :P

17:05 drewr: LauJensen: what's the latest stable commit of clojureql? should I just wait?

17:09 Chousuke: cemerick: Well, they're just reserved for the implementation

17:09 hiredman: ,(symbol "foo.")

17:09 clojurebot: foo.

17:15 LauJensen: drewr: 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:16 drewr: LauJensen: the first example in dk.bestinclass.clojureql.demos.postgres/-main doesn't work for me

17:16 LauJensen: sec

17:16 drewr: create-table generates sql that looks like "CREATE TABLE StoreInformation ( id SERIAL NOT NULL,StoreName,Sales,Date PRIMARY KEY ( id ) )"

17:17 LauJensen: Ok, 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:18 Ok till tomorrow?

17:18 drewr: sure, no problem

17:19 LauJensen: ok great, goodnight all

17:21 cemerick: hiredman: 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:21 ,(let [foo. 5] (+ foo. 5))

17:21 clojurebot: java.lang.ClassFormatError: Illegal field name "foo." in class sandbox$eval__3176

17:23 hiredman: cemerick: expect that to work just because the reader doesn't care is kind of silly

17:23 ,read-string

17:23 clojurebot: #<core$read_string__4939 clojure.core$read_string__4939@1e6cb2a>

17:23 hiredman: ,(read-string "(let [foo. 5] foo.)

17:23 clojurebot: EOF while reading string

17:23 hiredman: ,(read-string "(let [foo. 5] foo.)")

17:23 clojurebot: (let [foo. 5] foo.)

17:24 hiredman: I imagine it happens at macroexpansion time which sits between read and compile/eval

17:25 but maybe is rolled into clojure's compile

17:25 cemerick: it'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:32 JAS415: that prxml thing is nifty

17:35 konrad_: 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:50 avital: hi. i see some examples that use lazy-cons but i don't have this. has it been renamed?

17:50 dysinger: konrad_: the correct editor is "emacs"

17:50 ;)

17:50 hiredman: avital: it's gone

17:50 avital: ,lazy-cons

17:51 clojurebot: java.lang.Exception: Unable to resolve symbol: lazy-cons in this context

17:51 duck1123: lazy cons has been replaced with lazy-seq and cons

17:51 hiredman: http://clojure.org/lazy sort of describes the changes that happened

17:52 but it it implies a work in progress

17:52 but it is a work doen

17:52 done

17:53 avital: hmm

17:53 ok let me give it a shot, i might come back for more questions :)

17:53 konrad_: what is the extension of a clojure file?

17:54 avital: konrad_: .clj

17:55 cemerick: konrad_: enclojure is pleasant, FWIW

17:56 avital: konrad_: i am also now using enclojure

17:57 is there a built-in function to create a lazy seqence of all numbers? something "like" (range 1 infinity)

17:57 opqdonut: i just use (iterate inc 0)

17:58 avital: opqdonut: cool thanks

18:05 mudphone: anyone interested in a seemingly simple stumper?

18:06 this doesn't run for me in the repl:

18:06 (defn my-doc [x] (doc x))

18:06 konrad_: oh gosh, I guess I'll have to bother the developer

18:07 mudphone: I get: java.lang.Exception: Unable to resolve var: y in this context

18:07 y == x (oops)

18:08 hiredman: mudphone: doc is a macro that expands to a call to var

18:08 and var is special

18:08 ,(macroexpand-1 '(doc foo))

18:08 clojurebot: (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:08 hiredman: eep

18:08 anyway

18:09 if you want a doc function

18:09 ,(:doc (meta (resolve '+)))

18:09 clojurebot: "Returns the sum of nums. (+) returns 0."

18:09 mudphone: hmm

18:10 hiredman: excellent!

18:10 hiredman: => (macroexpand-1 '(doc foo))

18:10 (clojure.core/print-doc (var foo))

18:10 is the actual macroexpand of doc

18:11 the above was just an abberation particular to clojurebot

18:11 rathore: hiredman: what happened earlier when u did the macroexpand?

18:11 mudphone: it didn't work for me with print-doc either

18:11 but, the meta way, seems like it will

18:11 hiredman: clojurebot has a custom doc macro

18:11 rathore: hiredman: ah ok

18:11 hiredman: ,(macroexpand-1 '(print-doc foo))

18:11 clojurebot: (print-doc foo)

18:11 hiredman: ,(print-doc (relsove '+))

18:11 clojurebot: java.lang.Exception: Unable to resolve symbol: relsove in this context

18:12 hiredman: ,(print-doc (resolve '+))

18:12 clojurebot: ------------------------- clojure.core/+ ([] [x] [x y] [x y & more]) Returns the sum of nums. (+) returns 0.

18:12 hiredman: mudphone: I imagine you were just missing the call to resolve

18:12 mudphone: hiredman: I'll try that

18:17 hiredman: if I create my fn like this: (defn my-doc [y] (print-doc (resolve 'y)))

18:17 I get the :doc metadata for "user/y"

18:19 konrad_: Is there something like Glade or QTDesigner for Clojure?

18:19 cemerick: shouldn't the metadata keys in clojure.zip be ::branch?, etc., instead of :zip/branch?

18:20 konrad_: There's at least a dozen well-supported UI designers for swing, awt, and swt.

18:20 OK, a half-dozen, perhaps.

18:24 hiredman: mudphone: you quote y when you call my-doc

18:24 not inside my-doc

18:25 that is why doc is a macro, not a function

18:25 otherwise you would need to call it like (doc '+)

18:25 mudphone: hiredman: ah

18:26 hireman: fantastic, thanks

18:41 hiredman: so the meat of my function is now: (:doc (meta (resolve (symbol str-name))))

18:41 where I'm getting str-name passed in as a string (the name of the function)

18:41 hiredman: thanks for your help

18:57 konrad_: what do you guys think about Python?

18:57 skalnik: It sucks.

18:57 konrad_: why?

18:58 skalnik: ", ".join(["5", "6"]) <= Things like that

18:58 albino: shachaf: why does that suck?

18:58 skalnik: I assume you mean me, in which case, it makes no sense

18:59 albino: oh yeah, wrong person

18:59 how would you like it to read to make sense?

18:59 Chousuke: You can come up with an example like that for any language.

18:59 skalnik: albino: join should be a method on the array, but the array doesn't have a join method

19:00 Chousuke: true, but I just think Python has a few design flaws

19:00 I don't really think it sucks ;)

19:00 Chousuke: As far as making sense goes, python does rather well.

19:00 cemerick: *every* language has design flaws *shrug*

19:00 albino: shachaf: well JS does it on the array

19:00 skalnik: Because it makes sense :)

19:01 albino: freak, get the right nick name, gah sorry

19:01 skalnik: I'd be more upset if I were shachaf ;)

19:04 Chousuke: hmm

19:04 I wonder what it would take to implement syntax-quote as a regular macro

19:05 so that the reader would just expand `(foo ~bar) into (syntax-quote (foo (unquote bar)))

19:26 ataggart: anyone have experience reading a technical book (e.g., Programming Clojure) on a Kindle?

19:31 shachaf: albino, skalnik: I am *absolutely* upset, and demand some sort of compensation immediately.

19:31 skalnik: I knew it.

19:32 I always get cranky when people highlight me on accident.

19:40 albino: shachaf: well you can't blame skalnik for my stupidity

19:41 shachaf: skalnik: I was not assigning blame, only notifying skalnik that it was correct.

19:41 s/skalnik/albino/

19:41 Consider the accounts settled -- *this* time.


19:44 shachaf: skalnik: You should change your nick -- I was here first.

19:44 skalnik: never.

20:02 rhickey: ataggart: I've read tech books on a kindle dx - very nice

20:02 ataggart: rhickey: well my main concern was that the regular woudl just be too small.

20:02 which, from watching videos, appears to be the case

20:03 rhickey: ataggart: probably so

20:20 konrad_: kindle is evil

20:21 ok, getting vimclosure to work - take 2

20:29 mebaran151: I'd like to know too actually

20:29 I gave up and switched to Netbeans, and I'm actually pretty happy with the support

20:36 is there anyway to test if a seq is lazy or not?

20:37 hiredman: not really

20:37 JAS415: hm

20:37 hiredman: ,(class (range 10))

20:37 clojurebot: clojure.lang.LazySeq

20:38 JAS415: can't you check if it implements the class

20:38 hiredman: ,(class (cons 1 (range 10)))

20:38 clojurebot: clojure.lang.Cons

20:38 JAS415: haha

20:38 oo

20:38 mebaran151: so whenever I ask for count

20:38 ataggart: (class (map + [1 2]))

20:38 ,(class (map + [1 2]))

20:38 clojurebot: clojure.lang.LazySeq

20:38 hiredman: mebaran151: counted?

20:38 ,(doc counted?)

20:38 clojurebot: "([coll]); Returns true if coll implements count in constant time"

20:38 mebaran151: I better make doubly sure

20:38 o

20:38 useful

20:38 just what I was looking for

20:41 clojure needs a better documentation, though hiredman holds down the fort quite well

20:43 hiredman: clojurebot: docs?

20:43 clojurebot: Pardon?

20:46 ataggart: spending an hour or so really reading the api page has done wonders

20:47 hiredman: holy cow

20:47 * hiredman blinks

20:47 hiredman: anyway

20:47 http://clojure.org/sequences is useful

20:47 mebaran151: I'll review it

22:28 hiredman: clojurebot: new new?

22:28 clojurebot: new Class(x) is (Class. x)

22:44 ari____: 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:50 mebaran151: underscores can be dangerous

22:51 also is there anyway to get the arity of a function?

22:52 hiredman: nope

22:53 ,(meta #'map)

22:53 clojurebot: {: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:53 hiredman: ,(:arglists (meta #'map))

22:53 clojurebot: ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])

22:53 ari____: the underscore isn't accurate, I'm using the namespace as an example.

22:53 hiredman: but that only works on vars holding functions

22:53 ari____: the real namespace is org.x.y, for instance.

22:53 hiredman: clojurebot: compiling?

22:53 clojurebot: Pardon?

22:53 hiredman: clojurebot: compile

22:54 clojurebot: the 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:54 Jomyoot: is transient much faster than persistent?

23:03 ari____: hiredman: both of these items are true in my case, e.g. java -cp ~/clojure.jar:./classes:./org.x clojure.main

23:03 (compile 'org.x.y)

23:04 java.io.IOException: No such file or directory (y.clj:1)

23:04 hiredman: sound pretty clear cut to me

23:04 ~classpath

23:04 clojurebot: classpath is (System/getProperty "java.class.path")

23:04 hiredman: bah

23:04 ~namespace

23:05 clojurebot: namespaces 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:06 hiredman: if 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:08 ari____: 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:09 hiredman: *shrug*

23:14 _mst: ari____: does your 'classes' directory already exist? I've seen that error when I've forgotten to 'mkdir classes' before compiling...

23:15 ari____: yup

23:15 it's very bizarre

23:15 it keeps throwing 'No such file or directory' for y.clj

23:15 even though the file is clearly there

23:15 hiredman: well, obviously you are doing something wrong

23:15 ari____: obviously :p

23:16 hiredman: so strip down what you are doing

23:16 follow the exact example on the website

23:17 ari____: pardon the snark, but the website has a lot of examples of gen-class but no real examples of the compile process

23:17 there are some generalized rules

23:17 hiredman: ~compile

23:17 clojurebot: the 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:17 hiredman: there is, at the bottom of that webpage

23:18 ari____: (compile xyz) is never called

23:18 hiredman: it shouldn't be

23:19 (compile 'org.x.y)

23:22 Jomyoot: is transient much faster?

23:23 hiredman: faster for what?

23:23 ari____: http://pastie.org/572001

23:23 perhaps there's just some error in invocation on my part

23:23 i've tried all kinds of variations though

23:24 lisppaste8: _mst pasted "tiny compilation example" at http://paste.lisp.org/display/84798

23:24 hiredman: ari____: remove yz from your classpath and replace it with the pwd

23:24 _mst: that worked for me...

23:24 cark: ari____:that might niot be what you want...but i personally use compile from the command line

23:25 hiredman: ari____: that is not going to work anyway

23:25 the file has to exist

23:25 ari____: the file does exist.

23:26 hiredman: ari____: in the example you pasted it looks like you are trying to compile a namespace created at the repl

23:26 ari____: look at the top of the example

23:26 even when not in the REPL

23:26 it won't compile ala _mst's example

23:26 hiredman: fine

23:27 ari____: which is basically same as mine

23:27 hiredman: did you do what I said yet?

23:27 ari____: remove yz from your classpath and replace it with the pwd

23:27 ari____: yes

23:27 hiredman: that will work

23:28 cark: -> (defn -main [] println "Test") i beleive you're missing a pair of parenthesis there

23:28 hiredman: if it does not there is something else you are not sharing

23:29 lisppaste8: ari_____ pasted "compiling problem" at http://paste.lisp.org/display/84799

23:30 ari____: cark: corrected but still a problem

23:31 cark: the compile call gives an io error, but does a "require" or "use" work ?

23:31 clojurebot: the 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:31 ari____: use returns nil

23:31 cark: and is it working ?

23:31 i mean can you call the main function ?

23:32 ari____: yes

23:32 hiredman: ari____: the namespace declaration doesn't contain (:gen-class)

23:32 ari____: hiredman: I only removed it to follow mst's example

23:32 cark: ah that's it

23:32 ari____: hiredman: in the original one, I had it

23:32 and still didn't work

23:32 i'll try it again

23:33 nope

23:33 there is something weird :/

23:34 this is a pretty barebones example.

23:34 _mst: ari____: I just followed your example (having fixed the parens) and it worked using clojure-1.0

23:34 at first I got exactly the same error and then remembered to create the classes directory :)

23:34 cark: try putting your test directory in a src dir, and add the src directory to the classpath

23:34 i have still not upgraded to 1.0 =P

23:35 _mst: your classes directory is at the same level as yz? not inside of it?

23:36 Jomyoot: is transient feature released?

23:36 or no?

23:36 also does transient benefit collections like hash map?

23:36 or only vector

23:37 cark: only vectors right now i think

23:37 and not officially released either

23:38 ari____: cark: nope, that doesn't seem to have worked

23:38 clearly i'm doing something wrong, though what I have no idea

23:38 Jomyoot: will hashmap benefit from transient eventually?

23:39 cark: haslao are already using mutation under the hood

23:39 hashmaps i mean =)

23:39 lisppaste8: ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#1

23:39 hiredman annotated #84799 "example" at http://paste.lisp.org/display/84799#2

23:39 ari____: what is supposed to be done at that stage?

23:39 clojurebot: that is not what I wanted

23:40 ari____: thanks hired

23:40 1sec

23:43 oh ho

23:43 doesn't work with your example, hired

23:43 hiredman: words hear

23:43 ari____: yeah

23:43 hiredman: bah

23:43 here

23:43 ari____: something with my version of clojure maybe

23:43 cark: what's your jvm version ?

23:43 hiredman: are following my example exactly?

23:44 ari____: 1.6.0_13

23:44 hiredman: yes, to the letter

23:47 hiredman: where did you get your clojure jar?

23:48 ari____: must have been a transient bug between two releases, 1.1.0-snapshot works fine

23:48 * ari____ bashes head against keyboard

23:48 lisppaste8: ari_____ annotated #84799 "untitled" at http://paste.lisp.org/display/84799#3

23:48 ari____: thanks.

23:48 :)

23:49 appreciate your patience

Logging service provided by n01se.net