#clojure logs

2009-05-25

00:41duck1123I still can't get my (serve-file) working in compojure for me.
01:04duck1123is anyone around that's a wiz with classpaths?
01:05duck1123I'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
01:15memoizeyes! osx, x11/xmonad, emacs, clojure, and slime! anyone have this setup?
01:24duck1123I've got the last 3, if that helps. :)
01:29memoizeduck1123: does doc lookup, autocomplete, work in clojure slime?
01:32duck1123when in slime itself?
01:32duck1123let me check
01:32replacamemoize: everyone's results seem to vary. doc lookup works for me but not autocomplete. Others claim to have gotten autocomplete to work as well
01:33duck1123memoize: yeah, that's working for me
01:33duck1123i have to hit tab for it to work
01:33memoizeonce i get everything working, i'll freeze it all in github as submodules :)
01:34duck1123that's what I was doing, but I just switched to 100% maven
01:34duck1123I think I'm going to publish my maven forks of all the clojure libs I use
01:35memoizepublish or perish
01:36duck1123I also think the clojure-maven-plugin needs some work. It requires too much config
01:41duck1123I wish slime could autocomplete namespaces for me in the fn that accept a ns symbol
04:49AWizzArdWas 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.
04:52AWizzArdI also got a strange IllegalStateException: Var clojure.core/if is unbound. Any ideas?
04:55jdzAWizzArd: i'd suggest doing clean, then find . -type f | xargs touch and then try again
04:56AWizzArdit was a fresh checkout
04:56AWizzArdDid you try the latest version?
04:56AWizzArdWhen I try the 1.0 then I can do in the repl: (clojure.core/if 1 2 3) ==> 2
04:57jdzi did not. but your symptoms clearly are file-timestamps-in-the-future kinf
04:57jdz*kind
04:57AWizzArdBut when I try the current Alpha, then (clojure.core/if 1 2 3) ==> Exception
04:57AWizzArdjdz: ah ok, I can try to do that trick with touch, thanks
04:58jdzis your computer's date set correctly?
04:59jdzi'm at revision 1372 and i updated last week
04:59jdzlast friday to be precise
04:59AWizzArdit was a windows program that changed the timestamps
05:00AWizzArdjust figured it out
05:00jdzmeh, winblows. the find/touch might be a problem there...
05:01AWizzArdcygwin is my friend :-)
05:01AWizzArdanyway, can you please do (clojure.core/if 1 2 3) in the repl?
05:03jdzi get "No such var" exception
05:03jdzbut if is a special form...
05:08jdzbut it clearly was in clojure.core namespace before
05:09jdzlooks like it's not var anymore
05:14AWizzArdin the 1.0 it works
05:14AWizzArdin fresher checkouts it throws an Exception, which results in a problem for users of clojure.contrib.test-is
05:17eevar2fresher checkouts of the 1.0 branch?
05:18eevar2or trunk?
05:18AWizzArdsvn trunk
05:21jdz,(list (ns-resolve 'clojure.core 'if) (ns-resolve 'clojure.core 'map) (ns-resolve 'user 'if) (ns-resolve 'user 'map))
05:21clojurebot(#'clojure.core/if #'clojure.core/map nil #'clojure.core/map)
05:21jdz,*clojure-version*
05:21clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
05:22jdzi'm pretty sure that nil should not be there
05:34AWizzArdtrue, that nil looks not right
05:50hiredmanjdz: after the lazy-seq change if was change to a macro using the if* special form, this was reverted pre-1.0
06:08jdzhiredman: but it's still a problem that it is impossible to use fully qualified if special form
06:09jdzclojure.core/if that is
06:10jdzand i'm pretty sure if is not the only one here
06:11jdzlike, def has the same problems
07:02jdzgit bisect tells me that rev1363 is the culprit...
07:02jdznow should check if it's really the case
07:08eliantorhi i'm trying to install clojure-contrib...
07:09eliantorif i use clojure release it doesn't compile
07:09eliantorif i use the svn snapshot it does
07:09alinphi
07:09alinpset is returning an ordered set ?
07:09eliantorbut then i miss functions from clojure, such as lazy-cons
07:09eliantorfor example
07:09alinp.(set (list 4 4 5 3 2 4))
07:10alinp,(set (list 4 4 5 3 2 4))
07:10clojurebot#{2 3 4 5}
07:10alinp,(doc set)
07:10clojurebot"([coll]); Returns a set of the distinct elements of coll."
07:13leafwalinp: use sorted-set
07:13leafw,(doc sorted-set)
07:13clojurebot"([& keys]); Returns a new sorted set with supplied keys."
07:14alinpleafw: why to use sorted-set if set is returning them sorted ? :)
07:14alinpit's a coincidence ?
07:14leafwalinp: yes
07:14alinpI see
07:14alinpthanks
07:14leafwyw
07:15leafw,(set 1 2 3 5 -1 0 10 6 2 2 4 3 3)
07:15clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$set
07:15leafw,(set [1 2 3 5 -1 0 10 6 2 2 4 3 3])
07:15clojurebot#{0 1 2 3 4 5 6 10 -1}
07:15leafw,(sorted-set [1 2 3 5 -1 0 10 6 2 2 4 3 3])
07:15clojurebot#{[1 2 3 5 -1 0 10 6 2 2 4 3 3]}
07:16leafwdoesn't work the same way
07:16leafw,(sorted-set 1 2 3 5 -1 0 10 6 2 2 4 3 3)
07:16clojurebot#{-1 0 1 2 3 4 5 6 10}
07:16leafwrhickey: is there any reason why set and sorted-set don't accept the same kind of arguments?
07:18rhickey,(doc hash-set)
07:18clojurebot"([] [& keys]); Returns a new hash set with supplied keys."
07:18eliantor,(doc lazy-cons)
07:18clojurebotjava.lang.Exception: Unable to resolve var: lazy-cons in this context
07:18rhickey,(doc sorted-set)
07:18clojurebot"([& keys]); Returns a new sorted set with supplied keys."
07:18eliantor,(doc frest)
07:18clojurebotjava.lang.Exception: Unable to resolve var: frest in this context
07:18leafwI see, has-set is the equivalent of sorted-set.
07:19leafws/has-set/hash-set/
07:19leafw,(doc vec)
07:19clojurebot"([coll]); Creates a new vector containing the contents of coll."
07:20leafwso "set" is more akin to "vec", working on a collection.
07:20rhickeyleafw: right
07:20leafwthanks.
07:23AWizzArdrhickey: 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.
07:26jdzgit bisect tells me that r1356 has broken the clojure.core/if thing
07:27eliantoris there any difference between next and rest?
07:27jdzeliantor: next returns an object, rest -- a sequence
07:28eliantorjdz: so for example (rest [2 3 4]) is a vector?
07:28jdzno, a sequence
07:29jdzhmm, scratch my comment about next vs. rest
07:29eliantorjdz: oh i meant (next [2 3 4])
07:31jdzeliantor: as far as i understand from documentation, next and rest will differ when given a sequence of one element left
07:31jdznext allows nil-punning
07:31jdz(anybody correct me if i'm wrong please)
07:32eliantor,(next [1])
07:32clojurebotnil
07:32hoeckjdz: I think you're right
07:32eliantor,(rest [1])
07:32clojurebot()
07:32eliantorok
07:33hoeckand rest is lazy, it doesn't evaluate the first argument of the rest sequence
07:34jdzhoeck: next does the same (or so it seems to me from doc)
07:34jdzoh, nvm me
07:35jdzfirst != first of rest
07:35hoeckyeah, but it evaluates the first and the second argument of a given sequence
07:35hoeck(I mean next)
07:38jdzon the clojure.core/if note: shouldn't (clojure.core/def x 42) work?
07:39AWizzArdjdz: I would spontaneously answer that both should work, if and def.
07:40AWizzArdbut none of them does
07:40AWizzArdIt's a bit difficult when macros expand to if/def.
07:40jdzwell, at least the clojure.core/if worked before
07:40AWizzArdtrue
07:48rhickeyAWizzArd: why would it refer explicitly to clojure.core/if?
07:49jdzi can imagine making a namespace that does not refer to clojure.core
07:49jdzbut that is not the case here
07:51rhickeyAWizzArd: ant -Dclojure.jar=../clojure/trunk/clojure.jar test - 0 failures, 0 errors
07:52Chousuke,`if
07:52clojurebotif
07:53Chousukehmm.
08:10AWizzArdrhickey: 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.
08:10rhickeyAWizzArd: I just did that
08:11rhickeycontrib 843
08:11rhickeyclojure 1373
08:12AWizzArdI tried 1372. Will now try 1373
08:19AWizzArdwell, maybe some hundred tests simply don't pass in contrib
08:20rhickeywhat is your recipe?
08:20AWizzArdI'll now check if tests in my code still fail with the clojure.core/if problem.
08:21AWizzArdrhickey: do all tests pass for you? (clojure-contrib)
08:21jdzthey pass for me too
08:21rhickeyAWizzArd: yes, all tests pass
08:22AWizzArdfor me clojure passes correctly, but not contrib
08:22clojurebotfor is not a loop
08:22AWizzArdand test_datalog again works perfectly
08:24rhickeyAWizzArd: how do you invoke the tests?
08:27AWizzArdant -Dclojure.jar=clojure.jar test
08:27AWizzArdI copied the clojure.jar into the contrib repo which I just checked out
08:29rhickeyAWizzArd: same recipe works fine here
08:31AWizzArdstrange
08:35AWizzArdAnd 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
08:37AWizzArdah no, now my own tests do work, used the wrong file. Anyway, still strange that my contrib tests don't work.
10:33blbrowncan you define constructors for 'proxy' syntax. E.g. I get the error. No matching ctor found for class
10:36jdzblbrown: did you pass correct arguments using the second parameter?
10:40blbrowndidn't pass any, that is probably it
10:44blbrownjdz, am I doing this right. This is the clojure and similar java code: http://paste.lisp.org/display/80787
10:45jdzit appears that you should be passing an instance of Shell, not the class named Shell
10:46blbrownjdz: yep, that works.
12:35dnolenis future the best way to run a async one-off function?
14:08alrex021I 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:08alrex021Or for that matter, how do I include any jars so clojure REPL allows me to import, use them
14:09dnolenpass classpaths to the repl when you start it up with -cp.
14:09dnolenare you using Slime?
14:11alrex021Yes, I am using slime in Auqamacs to me exact
14:11dnolen(setq swank-clojure-extra-classpaths (list "path/to/some.jar")) in your .emacs file.
14:11alrex021so no command line so I can pass -cp like regular java command line call
14:12alrex021ahh, got it. thanks
15:34bradfordhow do i force an integer division to produce a float rather than a ratio?
15:35Chouser,(float (/ 5 2))
15:35clojurebot2.5
15:35Chouser,(/ 5.0 2)
15:35clojurebot2.5
15:35Chouser,(/ (float 5) 2)
15:35clojurebot2.5
15:35Chousertake your pick
15:35bradfordcool - so since i am dealing with symbols, I jsut ahve to float the result as in your first case
15:36bradfordthx
15:36Chouserin that case, the ratio is being produced and then converted to a float.
15:36Chouserafaik.
15:36bradfordso u are saying if i float one of the symbols first it is more efficient?
15:37bradfordas in your last example (where 5 and 2 are replaced with x and y)
15:37ChouserI don't know that to be true. Perhaps I shouldn't have said anything.
15:37bradfordhehe
15:38Chouseryou've got an x and y that are locals?
15:38sopelwhat's the clojure way to make writes to a file descriptor atomic?
15:38bradfordyes
15:38Chouserbradford: are they primitive ints, or Integers?
15:38Chouserbradford: and does performance actually matter?
15:38Chousersopel: however Java does it, I suppose.
15:39bradfordits 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:39hiredmanatomic filesystem writes is a difficult problem, and generally should be handled by the filesystem
15:39Chouserbradford: ok, so do whatever looks clearest, makes the most sense.
15:40Chouserprobably (float) around the outside so it's clear that's what you're getting.
15:40bradfordjust left the float on the outside ;-)
15:41sopelhiredman; i mean i have an open file and i want multiple writers to append data to it.
15:41sopelso i guess i'll just use java locks
15:41Chouseroh!
15:41Chousukeyou can use an agent :/
15:41Chousersopel: you just want to synchronize writes within one process?
15:41sopelyea
15:41hiredmansopel: that is not atomic writes
15:41hiredmanthat is serializing writes
15:41sopelok, sorry.
15:41Chousersopel: yeah, what Chousuke said. and agent
15:42Chouseran agent
15:43Chouserrhickey: streams had that at one point, didn't they?
15:43rhickeychunked seqs work with blocks of data internally, amortizing the laziness and allocation costs
15:43clojurebotrhickey is a T-1000 sent from the future
15:43Chousuke:P
15:44Chousukerhickey: doing this in git? :)
15:44rhickeythis 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:44rhickeynone of the statefulness
15:44Chousersounds nice
15:45rhickeyyeah, what happens is the blocks inside say, vectors, get processed directly
15:46michhello 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:46rhickeyopens 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:46rhickeyI am much happier with this than I was with streams.
15:47rhickeyChousuke: yes, in git - hopefully I'll be able to check it back in when I'm done :)
15:48Chousukerhickey: well, you can always use git format-patch to export a whole bunch of patches.
15:48rhickeydata structures that can support chunked seqs will return them by default from seq
15:48Chousukeif everything else fails :)
15:48rhickeyI'll need names for chunked first/rest/next
15:50rhickeyfirst+, rest+, next+ ?
15:51rhickeylogically it is first-chunk, rest-after-the-first-chunk
15:51hiredmanfirsts rests nexts
15:52Chouserrest-after-the-first-chunk may return chunked or not?
15:53rhickeyChouser: right, chunkedSeqs are fully interoperable with ordinary seqs, can have a heterogeneous chain
15:54Chouserfirst-chunk and after-chunk?
15:54rhickeyreduce of map of 1 million item vector is 2.5x faster with chunked seqs
15:55Chouserwith no change in top-level code, right? wow.
15:55Chouserdo rude blog posts motivate you?
15:55rhickeyChouser: tight now there is a separate map* and reduce*, but will become a branch in the map/reduce code
15:56rhickeyChouser: 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:57rhickeyblock-oriented code can have much better cache behavior
15:57michhello there! If anybody has possibly used the netbeans and eclipse plugin, could you please tell me which one is more "stable"- usable?
15:57clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline mich
15:58hiredmanclojurebot: behave
15:58clojurebotExcuse me?
15:58rhickeyI think 10-20x boost with vectors-of-primitives is possible
15:58cp2anyone see this? http://github.com/vii/teepeedee2/tree/master
15:58rhickeyplus they will be safe
15:58hiredmanoof, wow
15:59rhickeythe 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:59rhickeybut upgrading map/reduce/filter will be huge
16:00rhickeythe 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:01gnuvinceQuick 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:01rhickeygnuvince: polish your resume?
16:01marklargnuvince: what do you mean by 'blows up'?
16:02marklarbut yeah, if you can't use a data recovery service, polish your resume :(
16:02Chousukewhat do you mean there are no backups? :(
16:02Chousukedid they blow up too?
16:03gnuvinceChousuke: the boss thought a backup tape was too expensive
16:03Chousukeright.
16:03gnuvinceAnd some hard drives are currently giving me weird errors
16:03cp2his fault then
16:03hiredman:(
16:04gnuvinceWe advised about this about a year ago, but I think we got the "current economic conditions" excuse.
16:04gnuvinceHopefully it's just a glitch
16:04gnuvinceBut my day's been pretty bad so far
16:05lisppaste8rhickey pasted "better lazy-seq recursion handling" at http://paste.lisp.org/+1QCG
16:05mich... 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:06rhickeyalong the way to chunked seqs I enhanced lazy-seq you'll be able to write non-memory-retaining version like this
16:06rhickey^
16:06cp2mich: ive always liked enclojure (the netbeans plugin) better than others
16:06cp2by others i mean the eclipse one and la clojure for intellij idea
16:06michok so you have tried both i see
16:06cp2yeah
16:07cp2eclipse one briefly
16:07michcp2: 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:08cp2idk, it has some minor bugs
16:08cp2but imo its the best one so far
16:11cp2http://support.microsoft.com/kb/168702
16:11cp2hmmm
16:11cp2"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:17rhickeyreduce+filter+map - 4x faster chunked
16:18Chousuke:)
16:32gnuvincerhickey: is that for the "regular" functions or the stream specific ones?
16:36Chouser,(let [foo nil] (when foo (.write foo "hi")))
16:36clojurebotjava.lang.NullPointerException
16:37ChouserI get that in both 1.0.0 and 1371
16:38Chouserand 1373
16:39Chousernote that's a compile-time exception.
16:39Chouser,(let [foo nil] (fn [] (when foo (.write foo "hi"))))
16:39clojurebotjava.lang.NullPointerException
17:36kotarakStartsWithK Bad news. Doing recursive build of contrib blows up my ant with OutOfMemory: PermGen space
17:37StartsWithKkotarak: hmm.. that should not happen
17:38kotarakStartsWithK: I can send you the patch and you can try. Maybe I'm doing something wrong.
17:38StartsWithKkotarak: did you use ivy:buildlist to generate order of subant calls?
17:38kotarakStartsWithK: Yes.
17:38StartsWithKkotarak: sure, ksojat (gmail)
17:39StartsWithKi now have a simple ant wrapper, just pushed it on my cloak fork, ivy should be next
17:41kotarakMail is away...
17:43kotarakStartsWithK: ant -f build-modular.xml publish-all-local
17:44StartsWithKkotarak: i will need lates contrib? and clojure 1.0.0?
17:45kotarakStartsWithK: you can modify the dependencies as you like. I'm not sure about the contrib revision.
17:45kotarakStartsWithK: one in toplevel ivy.xml, one in gen-modules.clj
17:46kotarakStartsWithK: I have contrib rev839
17:48Anniepoosomebody here willing to answer a noobie Clojure/IntelliJ question?
17:49kotarakAnniepoo: clojure is easy, IntelliJ might be more difficult....
17:49kotarakAnniepoo: just ask :)
17:50Anniepookk - I have a little Clojure program that brings up a swing window
17:51Anniepooit's throwing a nullpointerexception when the window becomes visible
17:51Anniepooto make sure it wasn't some stupid mistake I backported the code to Java, and that works fine
17:51kotarakAnniepoo: maybe you can post the offending code?
17:51kotaraklisppaste8: url
17:51lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
17:53lisppaste8Anniepoo pasted "brokennoobswinginclojure" at http://paste.lisp.org/+1QCL
17:53chouser_extra parens around let
17:54chouser_let returns whatever it's final expression (in this case 'println') returns
17:54chouser_println returns nil, so the let returns nil
17:54Anniepoook
17:54chouser_the parens around the let means it tries to call it's return value (nil) as a function.
17:55Anniepooah!
17:55Anniepoothanks
17:55Anniepoonow, the debugger's useless for a stack trace. Is there a better way to debug than println's?
17:56chouser_you may be following an out of date tutorial. The java interop style is old-fashioned.
17:56Anniepoopossibly
17:56StartsWithKkotarak: i need to place ivy.jar in my ~/.ant/lib dir?
17:56chouser_I don't know about IntelliJ, but at most REPLs you can do (.printStackTrace *e) to see a stack trace.
17:56lisppaste8kotarak annotated #80805 "boinkbox for anniepoo" at http://paste.lisp.org/+1QCL#1
17:57kotarakStartsWithK: yes
17:57kotarakAnniepoo: as Chouser_ said: your style is oldfashioned. I annotated your paste. (see above)
17:58chouser_kotarak: that's not quite right...
17:58Anniepoothanks
17:58Anniepoonot understanding
17:58kotarakThere is a dot missing at the add. But otherwise it should work, no?
17:59Anniepoo(-> .getContentPane (add (JLabel. message) BorderLayout/CENTER))
17:59Anniepoowhats with the -> ??
17:59Anniepoo(y'all rock)
17:59cp2,(doc ->)
17:59clojurebot"([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:59kotarakAnniepoo: (-> a f g h) <=> (h (g (f a)))
17:59chouser_that's a macro that turns (-> a b c) into (c (b a))
18:00kotarakAnniepoo: or in Java. (-> a f g h) <=> a.f().g().h()
18:00chouser_but since it's in a doto, the first expression (a) is coming from the doto's first expression.
18:00kotarakOps
18:00kotarakOh dear...
18:00chouser_kotarak: that may be just a tiny bit too clever. :-)
18:00Anniepooyah, folks
18:00kotarakAnniepoo: Listen to chouser_ not me. It's too late today... :/
18:00clojureboteveryday is Rich Hickey Appreciation Day
18:01Anniepookk
18:02Anniepoothanks
18:03StartsWithKkotarak: i get a build error http://paste.pocoo.org/show/119085/ something about auto-agents missing on classpath
18:03lisppaste8Chouser annotated #80805 "another boinkBox" at http://paste.lisp.org/+1QCL#2
18:03StartsWithKi think this may take a while
18:04chouser_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:04chouser_...and (Classname/member) for static members
18:04Anniepoook
18:05chouser_Then if you want to mix in some 'doto' or -> usages to reduce repitition, that's up to you.
18:05cp2chouser_: you're all lowercase today, whats wrong? :(
18:05ChouserMessing around with the logging stuff
18:05chouser_don't mind me.
18:05cp2heh, i see
18:07kotarakStartsWithK: Hmm... my contrib has a auto_agent.clj....
18:08StartsWithKkotarak: this is 845, and auto-agent is there too
18:08kotarakhmm..
18:09AnniepooIf I want to get rid of the -> syntax, does doto bimd some sort of 'this'?
18:09StartsWithKthere is no src/ dir in modules/auto-agent
18:09StartsWithKshould there be one?
18:10Chouser_Anniepoo: I posted a version there with no ->
18:10kotarakAnniepoo: no, the doto thing will always be the first argument
18:10kotarakStartsWithK: no. The modules use the toplevel src dir
18:11StartsWithKno, wait, auto-agents is missing from 845
18:11Anniepoothanks all, I'm beginning to get this
18:11StartsWithKi'll just get 839..
18:11Anniepoomonads here I come
18:11Anniepoo8cP
18:15Anniepoodang, I can't find documentation of the -> form
18:15kotarakAnniepoo: type (doc ->) in a repl
18:16kotarak,(doc ->)
18:16clojurebot"([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:35bradfordhow would i print output from my repl to a file? I am doing some analysis that dumps a big map.
18:36bradfordI saw print-doc, but not sure what that is or how to use it
18:38bradfordwait, that probably prints doc as in documenteion :-)
18:38StartsWithKbradford: you could use clojure-contrib spit (in duck-streams lib)
19:23albinomajore request, can the released zip files create a directory and inflate all files into it. Something like clojure-1.0 would be fine.
19:45durka42is there a take-while analog to split-at?
19:45Chouser_,(doc split-with)
19:45clojurebot"([pred coll]); Returns a vector of [(take-while pred coll) (drop-while pred coll)]"
19:46durka42but it seems like the naive implementation does a lot more work than necessary
19:47Chouser_it'll run the pred twice on each item up to the split. is your pred expensive?
19:48durka42not really, i'm just micro-optimizing :)
19:59dnolenhttp://news.ycombinator.com/item?id=625948, nice :)
20:00dnolenChouser's clojure-jna on hacker news.
20:00Chouser_cute, ain't it? I wonder if anyone's used it for anything...
20:07Chouser_rhickey: thanks!
20:08Chouser_rhickey: do you want a 1.x patch for that?
20:09Chouser_ant
20:09Chouser_heh, sorry.
20:09rhickeyChouser_: sure
20:09Chouser_hm, actually, that doesn't really fix the problem.
20:09rhickeyno?
20:10Chouser_This code should be legal, shouldn't it? (let [foo nil] (fn [] (when foo (.write foo "hi"))))
20:11rhickeyYou 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:12rhickeyruntime error otherwise
20:13rhickeywhich I can do, is this real code or an exercise :)
20:14Chouser_based on real code. I'm getting you something (slightly) less ridiculous.
20:14rhickeyok
20:14Chouser_(fn [] (loop [foo nil] (if foo (.write foo "hi") (recur (java.io.FileWriter. "tmp.txt")))))
20:14rhickeyah ok, hang on a sec
20:15Chouser_In my real code I type hinted foo to avoid the error.
20:16Chouser_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:17rhickeyI didn't consider loop's rebinding ability
20:17Chouser_I'll probably want this hinted anyway, I suppose.
20:18rhickeyright, but I can't disallow due to loop
20:19rhickeyso there will be a reflection warning
20:20rhickeyfyi, I've been thinking about the chunked seqs for weeks, not a response to negative publicity :)
20:23Chouser_:-) Well, I chose the word motivated on purpose. That's different than inspired or instructed.
20:23rhickeytotally unrelated
20:26rhickeyI 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:30rhickeystill struggling with names for chunked rest/next, after-chunk isn't quite it :)
20:30rhickeya uniform pre/suffix would be great
20:32rhickeyI guess chunked-first, chunked-rest, chunked-next fit the bill, if somewhat clunky
20:33rhickeyan alternative to "chunk" also welcome, considered blocks, but blocked has totally different connotation
20:34Chousukeslice? mmh.
20:34slashus2glob?
20:35rhickeyit has to work as an adjective for seq
20:35rhickeythere are regular seqs and ____ seqs
20:36Chousukepartition is too long I suppose :/
20:36slashus2dollop lump?
20:36technomancythere'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:38rhickeytechnomancy: 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:38rhickeyseqn/restn/nextn ?
20:39liebkeI like seqn/restn/nextn
20:39technomancyreminds me a bit too much of CL
20:39slashus2What does the n represent?
20:39Chousukea chunk of n items? :P
20:40rhickeyslashus2: more than one
20:40technomancythough you could certainly do worse
20:40Chousukerest+?
20:41rhickeyChousuke: I mentioned + earlier, not sure they convey anything (not that * or n do strongly)
20:41cp2so, i dont mean to be... annoying
20:41cp2but are there plans for a better compiler?
20:42cp2because i think its pretty silly that the current setup doesnt optimize some things
20:42cp2or, a lot of things
20:42cp2i guess thats due in part to javac
20:42Chousukethe current compiler will get rewritten in clojure eventually
20:42rhickeycp2: optimization should never be a first priority, and it's still early days
20:42cp2because i know javac doesnt optimize much at all
20:42slashus2frame-seq/frame-rest/frame-next
20:43cp2rhickey: of course, and im glad more focus is being placed on the language =)
20:43cp2and Chousuke that sounds good
20:43rhickeycp2: but HotSpot does, a lot
20:43cp2rhickey: oh yeah, i know
20:44ChousukeI like the frame name.
20:44rhickeyso, when they get more escape analysis in place it will obviate much of the boxing analysis I would waste my time on now
20:45cp2sounds good
20:46rhickeyother 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:47ataggartbeing late to the party, what problem was the "chunked seq" addressing?
20:48rhickeyso 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:03rhickeyataggart: chunked seqs are about maximizing the performance of the high-level seq fns like map/reduce/filter
21:03ataggartvery well. do you imagine this would be a transparent optimization, or one requiring the calling of different functions?
21:04rhickeyalso opening the door to math ops that work on chunks of primitives
21:04rhickeytransparent for the most part, also some extra fns that let you, e.g. map a chunk-aware fn over chunks
21:05ataggartahh yes the old (time (+ 1 (+ 2 3)) < (time (+ 1 2 3)) critique I've been reading about
21:05cp2heh
21:05rhickeyand making the math ops chunk-aware
21:05cp2thats what founded my question ^
21:05rhickeywon't do anything at all for (+ 1 2 3)
21:05cp2but i do realise that clojure is still a young language, lots of room for improvement
21:06rhickeymuch more about making (mapn + v1 v2 v3) crank
21:08rhickeybecause 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:08ataggartagreed entirely