#clojure log - May 25 2009

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

0:41 duck1123: I still can't get my (serve-file) working in compojure for me.

1:04 is anyone around that's a wiz with classpaths?

1:05 I'm using maven to build a compojure webapp, I need to figure out how to make it so the root that serve-file looks in is the webapp's directory, and not the project root

1:15 memoize: yes! osx, x11/xmonad, emacs, clojure, and slime! anyone have this setup?

1:24 duck1123: I've got the last 3, if that helps. :)

1:29 memoize: duck1123: does doc lookup, autocomplete, work in clojure slime?

1:32 duck1123: when in slime itself?

1:32 let me check

1:32 replaca: memoize: everyone's results seem to vary. doc lookup works for me but not autocomplete. Others claim to have gotten autocomplete to work as well

1:33 duck1123: memoize: yeah, that's working for me

1:33 i have to hit tab for it to work

1:33 memoize: once i get everything working, i'll freeze it all in github as submodules :)

1:34 duck1123: that's what I was doing, but I just switched to 100% maven

1:34 I think I'm going to publish my maven forks of all the clojure libs I use

1:35 memoize: publish or perish

1:36 duck1123: I also think the clojure-maven-plugin needs some work. It requires too much config

1:41 I wish slime could autocomplete namespaces for me in the fn that accept a ns symbol

4:49 AWizzArd: Was there a change in the latest version? As always I used ant to compile the sources, but this time I got like 50 warnings, such as [javac] Warning: clojure\lang\LazySeq.java modified in the future.

4:52 I also got a strange IllegalStateException: Var clojure.core/if is unbound. Any ideas?

4:55 jdz: AWizzArd: i'd suggest doing clean, then find . -type f | xargs touch and then try again

4:56 AWizzArd: it was a fresh checkout

4:56 Did you try the latest version?

4:56 When I try the 1.0 then I can do in the repl: (clojure.core/if 1 2 3) ==> 2

4:57 jdz: i did not. but your symptoms clearly are file-timestamps-in-the-future kinf

4:57 *kind

4:57 AWizzArd: But when I try the current Alpha, then (clojure.core/if 1 2 3) ==> Exception

4:57 jdz: ah ok, I can try to do that trick with touch, thanks

4:58 jdz: is your computer's date set correctly?

4:59 i'm at revision 1372 and i updated last week

4:59 last friday to be precise

4:59 AWizzArd: it was a windows program that changed the timestamps

5:00 just figured it out

5:00 jdz: meh, winblows. the find/touch might be a problem there...

5:01 AWizzArd: cygwin is my friend :-)

5:01 anyway, can you please do (clojure.core/if 1 2 3) in the repl?

5:03 jdz: i get "No such var" exception

5:03 but if is a special form...

5:08 but it clearly was in clojure.core namespace before

5:09 looks like it's not var anymore

5:14 AWizzArd: in the 1.0 it works

5:14 in fresher checkouts it throws an Exception, which results in a problem for users of clojure.contrib.test-is

5:17 eevar2: fresher checkouts of the 1.0 branch?

5:18 or trunk?

5:18 AWizzArd: svn trunk

5:21 jdz: ,(list (ns-resolve 'clojure.core 'if) (ns-resolve 'clojure.core 'map) (ns-resolve 'user 'if) (ns-resolve 'user 'map))

5:21 clojurebot: (#'clojure.core/if #'clojure.core/map nil #'clojure.core/map)

5:21 jdz: ,*clojure-version*

5:21 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}

5:22 jdz: i'm pretty sure that nil should not be there

5:34 AWizzArd: true, that nil looks not right

5:50 hiredman: jdz: after the lazy-seq change if was change to a macro using the if* special form, this was reverted pre-1.0

6:08 jdz: hiredman: but it's still a problem that it is impossible to use fully qualified if special form

6:09 clojure.core/if that is

6:10 and i'm pretty sure if is not the only one here

6:11 like, def has the same problems

6:16 * jdz goes off to try out git bisect for the first time

7:02 jdz: git bisect tells me that rev1363 is the culprit...

7:02 now should check if it's really the case

7:08 eliantor: hi i'm trying to install clojure-contrib...

7:09 if i use clojure release it doesn't compile

7:09 if i use the svn snapshot it does

7:09 alinp: hi

7:09 set is returning an ordered set ?

7:09 eliantor: but then i miss functions from clojure, such as lazy-cons

7:09 for example

7:09 alinp: .(set (list 4 4 5 3 2 4))

7:10 ,(set (list 4 4 5 3 2 4))

7:10 clojurebot: #{2 3 4 5}

7:10 alinp: ,(doc set)

7:10 clojurebot: "([coll]); Returns a set of the distinct elements of coll."

7:13 leafw: alinp: use sorted-set

7:13 ,(doc sorted-set)

7:13 clojurebot: "([& keys]); Returns a new sorted set with supplied keys."

7:14 alinp: leafw: why to use sorted-set if set is returning them sorted ? :)

7:14 it's a coincidence ?

7:14 leafw: alinp: yes

7:14 alinp: I see

7:14 thanks

7:14 leafw: yw

7:15 ,(set 1 2 3 5 -1 0 10 6 2 2 4 3 3)

7:15 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$set

7:15 leafw: ,(set [1 2 3 5 -1 0 10 6 2 2 4 3 3])

7:15 clojurebot: #{0 1 2 3 4 5 6 10 -1}

7:15 leafw: ,(sorted-set [1 2 3 5 -1 0 10 6 2 2 4 3 3])

7:15 clojurebot: #{[1 2 3 5 -1 0 10 6 2 2 4 3 3]}

7:16 leafw: doesn't work the same way

7:16 ,(sorted-set 1 2 3 5 -1 0 10 6 2 2 4 3 3)

7:16 clojurebot: #{-1 0 1 2 3 4 5 6 10}

7:16 leafw: rhickey: is there any reason why set and sorted-set don't accept the same kind of arguments?

7:18 rhickey: ,(doc hash-set)

7:18 clojurebot: "([] [& keys]); Returns a new hash set with supplied keys."

7:18 eliantor: ,(doc lazy-cons)

7:18 clojurebot: java.lang.Exception: Unable to resolve var: lazy-cons in this context

7:18 rhickey: ,(doc sorted-set)

7:18 clojurebot: "([& keys]); Returns a new sorted set with supplied keys."

7:18 eliantor: ,(doc frest)

7:18 clojurebot: java.lang.Exception: Unable to resolve var: frest in this context

7:18 leafw: I see, has-set is the equivalent of sorted-set.

7:19 s/has-set/hash-set/

7:19 ,(doc vec)

7:19 clojurebot: "([coll]); Creates a new vector containing the contents of coll."

7:20 leafw: so "set" is more akin to "vec", working on a collection.

7:20 rhickey: leafw: right

7:20 leafw: thanks.

7:23 AWizzArd: rhickey: in 1372 I get an exception for (clojure.core/if 1 2 3). That is a bit unfortunate because contribs test-is doesn't work anymore.

7:26 jdz: git bisect tells me that r1356 has broken the clojure.core/if thing

7:27 eliantor: is there any difference between next and rest?

7:27 jdz: eliantor: next returns an object, rest -- a sequence

7:28 eliantor: jdz: so for example (rest [2 3 4]) is a vector?

7:28 jdz: no, a sequence

7:29 hmm, scratch my comment about next vs. rest

7:29 eliantor: jdz: oh i meant (next [2 3 4])

7:31 jdz: eliantor: as far as i understand from documentation, next and rest will differ when given a sequence of one element left

7:31 next allows nil-punning

7:31 (anybody correct me if i'm wrong please)

7:32 eliantor: ,(next [1])

7:32 clojurebot: nil

7:32 hoeck: jdz: I think you're right

7:32 eliantor: ,(rest [1])

7:32 clojurebot: ()

7:32 eliantor: ok

7:33 hoeck: and rest is lazy, it doesn't evaluate the first argument of the rest sequence

7:34 jdz: hoeck: next does the same (or so it seems to me from doc)

7:34 oh, nvm me

7:35 first != first of rest

7:35 hoeck: yeah, but it evaluates the first and the second argument of a given sequence

7:35 (I mean next)

7:38 jdz: on the clojure.core/if note: shouldn't (clojure.core/def x 42) work?

7:39 AWizzArd: jdz: I would spontaneously answer that both should work, if and def.

7:40 but none of them does

7:40 It's a bit difficult when macros expand to if/def.

7:40 jdz: well, at least the clojure.core/if worked before

7:40 AWizzArd: true

7:48 rhickey: AWizzArd: why would it refer explicitly to clojure.core/if?

7:49 jdz: i can imagine making a namespace that does not refer to clojure.core

7:49 but that is not the case here

7:51 rhickey: AWizzArd: ant -Dclojure.jar=../clojure/trunk/clojure.jar test - 0 failures, 0 errors

7:52 Chousuke: ,`if

7:52 clojurebot: if

7:53 Chousuke: hmm.

8:10 AWizzArd: rhickey: I do a fresh checkout of clojure, compile it with ant. Then I make a fresh checkout of contrib and compile it. Then I run the tests as you suggested. I got hundreds of error messages.

8:10 rhickey: AWizzArd: I just did that

8:11 contrib 843

8:11 clojure 1373

8:12 AWizzArd: I tried 1372. Will now try 1373

8:19 well, maybe some hundred tests simply don't pass in contrib

8:20 rhickey: what is your recipe?

8:20 AWizzArd: I'll now check if tests in my code still fail with the clojure.core/if problem.

8:21 rhickey: do all tests pass for you? (clojure-contrib)

8:21 jdz: they pass for me too

8:21 rhickey: AWizzArd: yes, all tests pass

8:22 AWizzArd: for me clojure passes correctly, but not contrib

8:22 clojurebot: for is not a loop

8:22 AWizzArd: and test_datalog again works perfectly

8:24 rhickey: AWizzArd: how do you invoke the tests?

8:27 AWizzArd: ant -Dclojure.jar=clojure.jar test

8:27 I copied the clojure.jar into the contrib repo which I just checked out

8:29 rhickey: AWizzArd: same recipe works fine here

8:31 AWizzArd: strange

8:35 And my own unit tests also don't work anymore - I get exceptions that "Var clojure.core/if is unbound." This does not happen when I use 1.0

8:37 ah no, now my own tests do work, used the wrong file. Anyway, still strange that my contrib tests don't work.

10:33 blbrown: can you define constructors for 'proxy' syntax. E.g. I get the error. No matching ctor found for class

10:36 jdz: blbrown: did you pass correct arguments using the second parameter?

10:40 blbrown: didn't pass any, that is probably it

10:44 jdz, am I doing this right. This is the clojure and similar java code: http://paste.lisp.org/display/80787

10:45 jdz: it appears that you should be passing an instance of Shell, not the class named Shell

10:46 blbrown: jdz: yep, that works.

12:35 dnolen: is future the best way to run a async one-off function?

14:08 alrex021: I am trying to give Incanter lib a try. How do I get my Emacs env to include the necessary jars on classpath so I can give it a try?

14:08 Or for that matter, how do I include any jars so clojure REPL allows me to import, use them

14:09 dnolen: pass classpaths to the repl when you start it up with -cp.

14:09 are you using Slime?

14:11 alrex021: Yes, I am using slime in Auqamacs to me exact

14:11 dnolen: (setq swank-clojure-extra-classpaths (list "path/to/some.jar")) in your .emacs file.

14:11 alrex021: so no command line so I can pass -cp like regular java command line call

14:12 ahh, got it. thanks

15:34 bradford: how do i force an integer division to produce a float rather than a ratio?

15:35 Chouser: ,(float (/ 5 2))

15:35 clojurebot: 2.5

15:35 Chouser: ,(/ 5.0 2)

15:35 clojurebot: 2.5

15:35 Chouser: ,(/ (float 5) 2)

15:35 clojurebot: 2.5

15:35 Chouser: take your pick

15:35 bradford: cool - so since i am dealing with symbols, I jsut ahve to float the result as in your first case

15:36 thx

15:36 Chouser: in that case, the ratio is being produced and then converted to a float.

15:36 afaik.

15:36 bradford: so u are saying if i float one of the symbols first it is more efficient?

15:37 as in your last example (where 5 and 2 are replaced with x and y)

15:37 Chouser: I don't know that to be true. Perhaps I shouldn't have said anything.

15:37 bradford: hehe

15:38 Chouser: you've got an x and y that are locals?

15:38 sopel: what's the clojure way to make writes to a file descriptor atomic?

15:38 bradford: yes

15:38 Chouser: bradford: are they primitive ints, or Integers?

15:38 bradford: and does performance actually matter?

15:38 sopel: however Java does it, I suppose.

15:39 bradford: its not really a big deal for now becasue this computation is happening on so much data that i'm not worried about mico optimizations to algorithms yet

15:39 hiredman: atomic filesystem writes is a difficult problem, and generally should be handled by the filesystem

15:39 Chouser: bradford: ok, so do whatever looks clearest, makes the most sense.

15:40 probably (float) around the outside so it's clear that's what you're getting.

15:40 bradford: just left the float on the outside ;-)

15:41 sopel: hiredman; i mean i have an open file and i want multiple writers to append data to it.

15:41 so i guess i'll just use java locks

15:41 Chouser: oh!

15:41 Chousuke: you can use an agent :/

15:41 * rhickey working on chunked seqs

15:41 Chouser: sopel: you just want to synchronize writes within one process?

15:41 sopel: yea

15:41 hiredman: sopel: that is not atomic writes

15:41 that is serializing writes

15:41 sopel: ok, sorry.

15:41 Chouser: sopel: yeah, what Chousuke said. and agent

15:42 an agent

15:43 rhickey: streams had that at one point, didn't they?

15:43 rhickey: chunked seqs work with blocks of data internally, amortizing the laziness and allocation costs

15:43 clojurebot: rhickey is a T-1000 sent from the future

15:43 Chousuke: :P

15:44 rhickey: doing this in git? :)

15:44 rhickey: this is still the pull model of seqs, in fact chunked seqs are seqs, support first.rest, and have not of the stateflness that streams had, plus they are faster

15:44 none of the statefulness

15:44 Chouser: sounds nice

15:45 rhickey: yeah, what happens is the blocks inside say, vectors, get processed directly

15:46 mich: hello there i just got a quick question if i don't want to use emacs or such which plugin is better/more stable : eclipse or netbeans?

15:46 rhickey: opens the door to defining the basic math ops on blocks (I had a prototype of that at one point), and then vectors of primitives. In the end game, the high level code using map/reduce/filter should be almost as fast as hand-written loops using primitive arrays + recur

15:46 I am much happier with this than I was with streams.

15:47 Chousuke: yes, in git - hopefully I'll be able to check it back in when I'm done :)

15:48 Chousuke: rhickey: well, you can always use git format-patch to export a whole bunch of patches.

15:48 rhickey: data structures that can support chunked seqs will return them by default from seq

15:48 Chousuke: if everything else fails :)

15:48 rhickey: I'll need names for chunked first/rest/next

15:50 first+, rest+, next+ ?

15:51 logically it is first-chunk, rest-after-the-first-chunk

15:51 hiredman: firsts rests nexts

15:52 Chouser: rest-after-the-first-chunk may return chunked or not?

15:53 rhickey: Chouser: right, chunkedSeqs are fully interoperable with ordinary seqs, can have a heterogeneous chain

15:54 Chouser: first-chunk and after-chunk?

15:54 rhickey: reduce of map of 1 million item vector is 2.5x faster with chunked seqs

15:55 Chouser: with no change in top-level code, right? wow.

15:55 do rude blog posts motivate you?

15:55 rhickey: Chouser: tight now there is a separate map* and reduce*, but will become a branch in the map/reduce code

15:56 Chouser: no, but I've been trying to reconcile the higher-level stuff with perf for a while, just never liked the streams. This has the potential to be stunningly fast, a much bigger deal than just merging stages

15:57 block-oriented code can have much better cache behavior

15:57 mich: hello there! If anybody has possibly used the netbeans and eclipse plugin, could you please tell me which one is more "stable"- usable?

15:57 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline mich

15:58 hiredman: clojurebot: behave

15:58 clojurebot: Excuse me?

15:58 rhickey: I think 10-20x boost with vectors-of-primitives is possible

15:58 cp2: anyone see this? http://github.com/vii/teepeedee2/tree/master

15:58 rhickey: plus they will be safe

15:58 hiredman: oof, wow

15:59 rhickey: the best thing about this is that the chunked seqs are seqs, if someone doesn't want to bother to upgrade a seq fn of their own they can just ignore it

15:59 but upgrading map/reduce/filter will be huge

16:00 the gameplan is - chunked seq infrastructure, chunked seqs for all current data structures where they make sense, vectors of primitives, persistent T-trees for the sorted collections, math ops on chunks

16:01 gnuvince: Quick question to the guys who are/have been in IT: what do you do when the single server with all the company's data blows up and no backups are available?

16:01 rhickey: gnuvince: polish your resume?

16:01 marklar: gnuvince: what do you mean by 'blows up'?

16:02 but yeah, if you can't use a data recovery service, polish your resume :(

16:02 Chousuke: what do you mean there are no backups? :(

16:02 did they blow up too?

16:03 gnuvince: Chousuke: the boss thought a backup tape was too expensive

16:03 Chousuke: right.

16:03 gnuvince: And some hard drives are currently giving me weird errors

16:03 cp2: his fault then

16:03 hiredman: :(

16:04 gnuvince: We advised about this about a year ago, but I think we got the "current economic conditions" excuse.

16:04 Hopefully it's just a glitch

16:04 But my day's been pretty bad so far

16:05 lisppaste8: rhickey pasted "better lazy-seq recursion handling" at http://paste.lisp.org/+1QCG

16:05 mich: ... ok either my question is too simple,or something like that...can anyone tell me please from personal experince which IDE plugin works better for clojure netbeans or eclipse?

16:06 rhickey: along the way to chunked seqs I enhanced lazy-seq you'll be able to write non-memory-retaining version like this

16:06 ^

16:06 cp2: mich: ive always liked enclojure (the netbeans plugin) better than others

16:06 by others i mean the eclipse one and la clojure for intellij idea

16:06 mich: ok so you have tried both i see

16:06 cp2: yeah

16:07 eclipse one briefly

16:07 mich: cp2: i saw little activity on the google site of the netbeans plugin, either its THAT good already .. bur why still alpha? hm but thx for advice i think i try that!

16:08 cp2: idk, it has some minor bugs

16:08 but imo its the best one so far

16:11 http://support.microsoft.com/kb/168702

16:11 hmmm

16:11 "If you move your mouse pointer continuously while the data is being returned to Microsoft Excel, the query may not fail. Do not stop moving the mouse until all the data has been returned to Microsoft Excel. "

16:17 rhickey: reduce+filter+map - 4x faster chunked

16:18 Chousuke: :)

16:32 gnuvince: rhickey: is that for the "regular" functions or the stream specific ones?

16:36 Chouser: ,(let [foo nil] (when foo (.write foo "hi")))

16:36 clojurebot: java.lang.NullPointerException

16:37 Chouser: I get that in both 1.0.0 and 1371

16:38 and 1373

16:39 note that's a compile-time exception.

16:39 ,(let [foo nil] (fn [] (when foo (.write foo "hi"))))

16:39 clojurebot: java.lang.NullPointerException

17:36 kotarak: StartsWithK Bad news. Doing recursive build of contrib blows up my ant with OutOfMemory: PermGen space

17:37 StartsWithK: kotarak: hmm.. that should not happen

17:38 kotarak: StartsWithK: I can send you the patch and you can try. Maybe I'm doing something wrong.

17:38 StartsWithK: kotarak: did you use ivy:buildlist to generate order of subant calls?

17:38 kotarak: StartsWithK: Yes.

17:38 StartsWithK: kotarak: sure, ksojat (gmail)

17:39 i now have a simple ant wrapper, just pushed it on my cloak fork, ivy should be next

17:41 kotarak: Mail is away...

17:43 StartsWithK: ant -f build-modular.xml publish-all-local

17:44 StartsWithK: kotarak: i will need lates contrib? and clojure 1.0.0?

17:45 kotarak: StartsWithK: you can modify the dependencies as you like. I'm not sure about the contrib revision.

17:45 StartsWithK: one in toplevel ivy.xml, one in gen-modules.clj

17:46 StartsWithK: I have contrib rev839

17:48 Anniepoo: somebody here willing to answer a noobie Clojure/IntelliJ question?

17:49 kotarak: Anniepoo: clojure is easy, IntelliJ might be more difficult....

17:49 Anniepoo: just ask :)

17:50 Anniepoo: kk - I have a little Clojure program that brings up a swing window

17:51 it's throwing a nullpointerexception when the window becomes visible

17:51 to make sure it wasn't some stupid mistake I backported the code to Java, and that works fine

17:51 kotarak: Anniepoo: maybe you can post the offending code?

17:51 lisppaste8: url

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

17:53 Anniepoo pasted "brokennoobswinginclojure" at http://paste.lisp.org/+1QCL

17:53 chouser_: extra parens around let

17:54 let returns whatever it's final expression (in this case 'println') returns

17:54 println returns nil, so the let returns nil

17:54 Anniepoo: ok

17:54 chouser_: the parens around the let means it tries to call it's return value (nil) as a function.

17:55 Anniepoo: ah!

17:55 thanks

17:55 now, the debugger's useless for a stack trace. Is there a better way to debug than println's?

17:56 chouser_: you may be following an out of date tutorial. The java interop style is old-fashioned.

17:56 Anniepoo: possibly

17:56 StartsWithK: kotarak: i need to place ivy.jar in my ~/.ant/lib dir?

17:56 chouser_: I don't know about IntelliJ, but at most REPLs you can do (.printStackTrace *e) to see a stack trace.

17:56 lisppaste8: kotarak annotated #80805 "boinkbox for anniepoo" at http://paste.lisp.org/+1QCL#1

17:57 kotarak: StartsWithK: yes

17:57 Anniepoo: as Chouser_ said: your style is oldfashioned. I annotated your paste. (see above)

17:58 chouser_: kotarak: that's not quite right...

17:58 Anniepoo: thanks

17:58 not understanding

17:58 kotarak: There is a dot missing at the add. But otherwise it should work, no?

17:59 Anniepoo: (-> .getContentPane (add (JLabel. message) BorderLayout/CENTER))

17:59 whats with the -> ??

17:59 (y'all rock)

17:59 cp2: ,(doc ->)

17:59 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

17:59 kotarak: Anniepoo: (-> a f g h) <=> (h (g (f a)))

17:59 chouser_: that's a macro that turns (-> a b c) into (c (b a))

18:00 kotarak: Anniepoo: or in Java. (-> a f g h) <=> a.f().g().h()

18:00 chouser_: but since it's in a doto, the first expression (a) is coming from the doto's first expression.

18:00 kotarak: Ops

18:00 Oh dear...

18:00 chouser_: kotarak: that may be just a tiny bit too clever. :-)

18:00 Anniepoo: yah, folks

18:00 kotarak: Anniepoo: Listen to chouser_ not me. It's too late today... :/

18:00 clojurebot: everyday is Rich Hickey Appreciation Day

18:01 Anniepoo: kk

18:02 thanks

18:03 StartsWithK: kotarak: i get a build error http://paste.pocoo.org/show/119085/ something about auto-agents missing on classpath

18:03 lisppaste8: Chouser annotated #80805 "another boinkBox" at http://paste.lisp.org/+1QCL#2

18:03 StartsWithK: i think this may take a while

18:03 * StartsWithK goes to poke at ant build thingy..

18:04 chouser_: Anniepoo: lots of ways to structure that of course, but these days it's generally preferred to use (.method instance arg1 arg2) for instance method calls

18:04 ...and (Classname/member) for static members

18:04 Anniepoo: ok

18:05 chouser_: Then if you want to mix in some 'doto' or -> usages to reduce repitition, that's up to you.

18:05 cp2: chouser_: you're all lowercase today, whats wrong? :(

18:05 Chouser: Messing around with the logging stuff

18:05 chouser_: don't mind me.

18:05 cp2: heh, i see

18:07 kotarak: StartsWithK: Hmm... my contrib has a auto_agent.clj....

18:08 StartsWithK: kotarak: this is 845, and auto-agent is there too

18:08 kotarak: hmm..

18:09 Anniepoo: If I want to get rid of the -> syntax, does doto bimd some sort of 'this'?

18:09 StartsWithK: there is no src/ dir in modules/auto-agent

18:09 should there be one?

18:10 Chouser_: Anniepoo: I posted a version there with no ->

18:10 kotarak: Anniepoo: no, the doto thing will always be the first argument

18:10 StartsWithK: no. The modules use the toplevel src dir

18:11 StartsWithK: no, wait, auto-agents is missing from 845

18:11 Anniepoo: thanks all, I'm beginning to get this

18:11 StartsWithK: i'll just get 839..

18:11 Anniepoo: monads here I come

18:11 8cP

18:15 dang, I can't find documentation of the -> form

18:15 kotarak: Anniepoo: type (doc ->) in a repl

18:16 ,(doc ->)

18:16 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

18:35 bradford: how would i print output from my repl to a file? I am doing some analysis that dumps a big map.

18:36 I saw print-doc, but not sure what that is or how to use it

18:38 wait, that probably prints doc as in documenteion :-)

18:38 StartsWithK: bradford: you could use clojure-contrib spit (in duck-streams lib)

19:23 albino: majore request, can the released zip files create a directory and inflate all files into it. Something like clojure-1.0 would be fine.

19:45 durka42: is there a take-while analog to split-at?

19:45 Chouser_: ,(doc split-with)

19:45 clojurebot: "([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]"

19:46 durka42: but it seems like the naive implementation does a lot more work than necessary

19:47 Chouser_: it'll run the pred twice on each item up to the split. is your pred expensive?

19:48 durka42: not really, i'm just micro-optimizing :)

19:48 * durka42 has to run

19:59 dnolen: http://news.ycombinator.com/item?id=625948, nice :)

20:00 Chouser's clojure-jna on hacker news.

20:00 Chouser_: cute, ain't it? I wonder if anyone's used it for anything...

20:07 rhickey: thanks!

20:08 rhickey: do you want a 1.x patch for that?

20:09 ant

20:09 heh, sorry.

20:09 rhickey: Chouser_: sure

20:09 Chouser_: hm, actually, that doesn't really fix the problem.

20:09 rhickey: no?

20:10 Chouser_: This code should be legal, shouldn't it? (let [foo nil] (fn [] (when foo (.write foo "hi"))))

20:11 rhickey: You can't expect the compiler to know one way or the other if it's ok, but take away the "when foo" and what behavior would you want?

20:12 runtime error otherwise

20:13 which I can do, is this real code or an exercise :)

20:14 Chouser_: based on real code. I'm getting you something (slightly) less ridiculous.

20:14 rhickey: ok

20:14 Chouser_: (fn [] (loop [foo nil] (if foo (.write foo "hi") (recur (java.io.FileWriter. "tmp.txt")))))

20:14 rhickey: ah ok, hang on a sec

20:15 Chouser_: In my real code I type hinted foo to avoid the error.

20:16 actually, that's really close to me real code. The loop cycles through several files, writing to each. But I don't know the first file until the first time through the loop.

20:17 rhickey: I didn't consider loop's rebinding ability

20:17 Chouser_: I'll probably want this hinted anyway, I suppose.

20:18 rhickey: right, but I can't disallow due to loop

20:19 so there will be a reflection warning

20:20 fyi, I've been thinking about the chunked seqs for weeks, not a response to negative publicity :)

20:23 Chouser_: :-) Well, I chose the word motivated on purpose. That's different than inspired or instructed.

20:23 rhickey: totally unrelated

20:26 I find these micro-bechmarks tedious, but the big-picture issue of making the simplest high-level code perform well is interesting - I'd love for people to use map/filter/reduce with impunity

20:30 still struggling with names for chunked rest/next, after-chunk isn't quite it :)

20:30 a uniform pre/suffix would be great

20:32 I guess chunked-first, chunked-rest, chunked-next fit the bill, if somewhat clunky

20:33 an alternative to "chunk" also welcome, considered blocks, but blocked has totally different connotation

20:34 Chousuke: slice? mmh.

20:34 slashus2: glob?

20:35 rhickey: it has to work as an adjective for seq

20:35 there are regular seqs and ____ seqs

20:36 Chousuke: partition is too long I suppose :/

20:36 slashus2: dollop lump?

20:36 technomancy: there's precedence for using *-ed names for functions that are similar with a twist, though that may go too far in the brevity vs clarity tradeoff

20:38 rhickey: technomancy: I was totally there with * for a while when the design allowed for empty chunks in the sequence, now it doesn't and * makes less sense (to me)

20:38 seqn/restn/nextn ?

20:39 liebke: I like seqn/restn/nextn

20:39 technomancy: reminds me a bit too much of CL

20:39 slashus2: What does the n represent?

20:39 Chousuke: a chunk of n items? :P

20:40 rhickey: slashus2: more than one

20:40 technomancy: though you could certainly do worse

20:40 Chousuke: rest+?

20:41 rhickey: Chousuke: I mentioned + earlier, not sure they convey anything (not that * or n do strongly)

20:41 cp2: so, i dont mean to be... annoying

20:41 but are there plans for a better compiler?

20:42 because i think its pretty silly that the current setup doesnt optimize some things

20:42 or, a lot of things

20:42 i guess thats due in part to javac

20:42 Chousuke: the current compiler will get rewritten in clojure eventually

20:42 rhickey: cp2: optimization should never be a first priority, and it's still early days

20:42 cp2: because i know javac doesnt optimize much at all

20:42 slashus2: frame-seq/frame-rest/frame-next

20:43 cp2: rhickey: of course, and im glad more focus is being placed on the language =)

20:43 and Chousuke that sounds good

20:43 rhickey: cp2: but HotSpot does, a lot

20:43 cp2: rhickey: oh yeah, i know

20:44 Chousuke: I like the frame name.

20:44 rhickey: so, when they get more escape analysis in place it will obviate much of the boxing analysis I would waste my time on now

20:45 cp2: sounds good

20:46 rhickey: other than that, things are so simple, architectural things (like the chunked seqs we are discussing) yield much more bang for the buck than micro-optimization

20:47 ataggart: being late to the party, what problem was the "chunked seq" addressing?

20:48 rhickey: so there's a micro way to look at boxing, each local and its use etc, then there's a macro view that says, the platform requires objects, so let's amortize the allocation over a whole buffer of primitives

21:03 ataggart: chunked seqs are about maximizing the performance of the high-level seq fns like map/reduce/filter

21:03 ataggart: very well. do you imagine this would be a transparent optimization, or one requiring the calling of different functions?

21:04 rhickey: also opening the door to math ops that work on chunks of primitives

21:04 transparent for the most part, also some extra fns that let you, e.g. map a chunk-aware fn over chunks

21:05 ataggart: ahh yes the old (time (+ 1 (+ 2 3)) < (time (+ 1 2 3)) critique I've been reading about

21:05 cp2: heh

21:05 rhickey: and making the math ops chunk-aware

21:05 cp2: thats what founded my question ^

21:05 rhickey: won't do anything at all for (+ 1 2 3)

21:05 cp2: but i do realise that clojure is still a young language, lots of room for improvement

21:06 rhickey: much more about making (mapn + v1 v2 v3) crank

21:08 because if you care about the perf of a small expr, it must be because you have to run it over a lot of numbers - where are they? what is the pipeline?

21:08 ataggart: agreed entirely

Logging service provided by n01se.net