#clojure log - May 08 2009

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

0:05 hiredman: ,(* 40 50)

0:06 clojurebot: 2000

4:13 AWizzArd: ~ seen scgilardi

4:13 clojurebot: no, I have not seen scgilardi

4:32 sddiew: Could anyone please provide me with a coupon code for the upcoming Programming Clojure book? It's very hard to shell out that much for me...

4:35 jdz: you think that obtaining something valuable for you should not cost you anything?

4:36 how much is the book worth in terms of food for you? 4 dinners? 10?

4:38 sddiew: 9 (rough estimate), I just thought that somebody might have unused discount coupon. I don't want it for free.

4:39 jdz: can you eat dinner for $2 in Poland?

4:39 conflicts with my experience

4:40 (but that's offtopic)

4:41 tWip: on the subject of the book... has anyone tried the epub version on iPhone? is it readable?

4:45 chrizel: tWip, I have it on the iPhone - source code lines are cut off on the side, so its ok to read the normal text but IMHO not perfect for the code - hm, dont know if you can rotate Stanza somehow...

4:48 tWip: ok, good to know

4:49 chrizel: oh, if you rotate its better but some longer code lines still get cut off - at least you can see the whole line in the "define" view

9:41 whitingjr: hello, I want to get debugging my clojure files in eclipse v3.4.2. the breakpoints are not working for any source .clj files

9:42 should I be checking something in eclipse ?

10:23 rhickey: is there a standard layout for repos when using git?

10:26 chrizel: no, not like in svn - "trunk" or something isn't needed

10:28 jdz: there is just one repo, and you branch to your heart's content in it

10:28 create branches and switch between them, that is

10:28 rhickey: right, I understand no structure is required for git itself, just wondering if there were any conventions

10:29 jdz: well, CVS does not have any structures as well, does it?

10:29 i think it's something SVN people have come up with

10:51 cemerick: rhickey: 'master' is checked out by default when cloning a git repo, so almost all repos name their mainline of development 'master'. Other than that, I'm unaware of any other hard idioms.

10:52 rhickey: cemerick: right, but that's not on the filesystem right, just a branch name thing?

10:52 the repo dir is just a free-for-all?

10:52 cemerick: yes, definitely

10:53 rhickey: ok thanks

10:53 * rhickey typed "git init" for the first time yesterday

10:54 cemerick: rhickey: please report to headquarters for your first re-education session immediately ;-)

11:00 noidi: rhickey, this is good to know when learning git :) http://www.gitready.com/advanced/2009/01/17/restoring-lost-commits.html

11:05 * rhickey mired in classloaders and modularity issues

11:05 mollie: hi. clojure.contrib.repl-utils is not auto-loaded correct?

11:06 rhickey: mollie: right, nothing from contrib is auto-loaded

11:06 mollie: ok thanks. im reading a tut that says it is, ill let him know

11:06 hiredman: clojurebot: ping?

11:06 clojurebot: PONG!

11:08 mollie: is there a way to autoload it within your .emacs? or at command line?

11:13 rhickey: mollie: i'm sure there is - can anyone help mollie ?

11:14 mollie: no worries, ill hang around. thanks for your work, im excited about clojure

11:14 rhickey: mollie: you'll get more eyes on the google group if no one here can help right now

11:16 hiredman: mollie: at the commandline you can pass clojure.main forms to be evaluated via -e or files to load and eval via -i

11:16 dunno about emacs

11:16 mollie: ah ok, in .emacs i just call it via a commandline, so that'll prob work, thanks!

11:17 hiredman: so somesomething like 'java clojure.main -i init-stuff.clj -r' would get you a repl

11:17 jdz: mollie: don't you use slime?

11:17 mollie: yes

11:18 but im trying to get at repl-utils/show, which i need to load first

11:18 chrizel: maybe the option "swank-clojure-init-files"? the docstring says "If provided, will be used to initialize the REPL environment."

11:19 dnolen: mollie: one common way is also to provide user.clj file in the class path

11:19 jdz: see the documentation for swank-clojure-init-files in emacs

11:19 oh

11:19 dnolen: then you can require the library you want to autoload when slime starts up

11:19 jdz: i'm late

11:19 mollie: that makes sense, thanks dnolen

11:20 Chouser: Last I knew, user.clj was loaded too early to set things like *print-length*

11:20 I use -i for setting that and loading repl-utils

11:21 dnolen: Chouser: good to know.

12:54 Raynes: "1990 - A committee formed by Simon Peyton-Jones, Paul Hudak, Philip Wadler, Ashton Kutcher, and People for the Ethical Treatment of Animals creates Haskell, a pure, non-strict, functional language."

12:55 Chouser: uh

12:55 cads: and peta, eh?

12:55 Chouser: someone vandalize wikipedia or something?

12:56 bstephenson: Ashton Kutcher? ouch!

12:56 cads: you know, the early haskell mailing list with hudak and peyton-jones going back and forth... is kind of awe inspiring

12:56 hiredman: someone is reading reddit

12:56 gnuvince: The Scheme one about lambdas is awesome

12:56 "Lambdas a relegated to relative obscurity until Java makes them popular again by not having them"

12:56 *are

12:57 Raynes: http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

12:59 cads: I would like to draw interactive images with some of my code, but don't know what library to learn... as far as capabilities, I'd do fine with plain pixel blitting. Do you guys know any clojure projects that already work with graphics?

12:59 I'm not above learning a new library by stealing and adapting working code :)

13:02 Chouser: cads: here's a little something: http://blog.n01se.net/?p=35

13:16 * technomancy feels the christmas cheer

13:17 danlarkin: technomancy's CMOS got reset

13:17 technomancy: hehe

13:18 dnolen___: are .jnilib files included on the classpath just like .jars?

13:21 mollie: i have a dopey question: how come ((cons '+ '(1 2)) throws an error, and (cons '+ '(1 2)) wont eval?

13:21 hiredman: ,(cons '+ '(1 2))

13:21 clojurebot: (+ 1 2)

13:22 hiredman: evals here

13:22 mollie: right, but how do i get 3

13:22 hiredman: (eval (cons '+ '(1 2)))

13:23 ((cons '+ '(1 2)) => ('(+ 1 2))

13:23 which means (+ 1 2) is called as a function, which it isn't

13:23 so you get Exceptions

13:24 mollie: i see

13:24 hiredman: this you first time out with a lisp?

13:25 your

13:25 mollie: kinda sorta, other than hacking on my .emacs over the years

13:26 hiredman: so the reader reads the text "(+ 1 2)" and outputs a list (+ 1 2)

13:26 eval treats the first element in a list as a function and applies it to the rest

13:27 although actually I think clojure's eval is a little more complicated

13:27 mollie: is the eval fn something in most lisps?

13:27 hiredman: yeah

13:28 danlarkin: in all lisps

13:28 hiredman: eval is central to the idea of code as data

13:28 eval takes data and treats it as a program

13:29 technomancy: danlarkin: you OK with licensing clojure-http under the same terms as clojure?

13:29 dnolen___: http://books.google.com/books?id=68j6lEJjMQwC&pg=PA22&lpg=PA22&dq=john+mccarthy+eval&source=bl&ots=Ihu0pYVyvj&sig=nWhLAegPDGtp7GeeotO4dWVgY0o&hl=en&ei=nGsESvfZDaHItge8-42YBw&sa=X&oi=book_result&ct=result&resnum=1

13:30 danlarkin: technomancy: yes

13:30 dnolen___: John Mccarthy 1962

13:30 hiredman: hah

13:30 with m-expressions

13:30 technomancy: danlarkin: ok; will add that to the readme.

13:30 mollie: i guess im used to javascript, where using eval is looked on as a sin of sorts

13:31 hiredman: well

13:31 it still sort of is

13:31 using it is not encouraged

13:31 but it is what is happening under the hood

13:31 danlarkin: you generally do not need to use it

13:31 cads: chouser, iterated function systems are a joy, and that code really looks less scary than I thought gui code was going to look! thanks!

13:32 Chouser: cads: oh, good.

13:32 cads: I just need a pane to project my simulated particles upon :)

13:33 hiredman: the reads text and outputs a datastructure and then eval treats the datastructure as a program

13:33 cads: hiredman: whatever happened to m-expressions

13:33 hiredman: dunno, but thank god they never caught on

13:33 ,(read-str "(+ 1 2)")

13:33 clojurebot: java.lang.Exception: Unable to resolve symbol: read-str in this context

13:34 hiredman: ,(read (-> "(+ 1 2)" java.io.StringReader. java.io.PushbackReader.))

13:34 clojurebot: (+ 1 2)

13:34 Chousuke: cads: implementing m-expressions would've been too much work in the early days of lisp

13:35 cads: they would have been a full syntax but at the same time easily parseable into sexps?

13:35 danlarkin: McCarthy was told that eval could be written in terms of s-expressions and that started to change his mind, IIRC

13:36 cads: hmm

13:37 hiredman: mollie: writing a lisp (basic) interpreter in javascript would not be too hard, and it would give you nice model

13:38 cads: I ran into the bit-c language which uses a lisp syntax for now, and I was puzzled that in the notes the authors seemed to take for granted that the language would eventually be given its own, more expressive syntax

13:38 hiredman: yeah

13:39 it is an idea that keeps coming up but never really goes anywhere

13:39 "we'll start with lisp and add syntax later"

13:39 cads: in the bitc community, or in lispy languages in general?

13:39 mollie: there's been a trend in js to get more functional, its too bad it doesnt support macros. also it could use the persistent data structures of clojure

13:40 hiredman: mollie: Chouser ported a lot of clojure to js

13:40 I am just saying to get a clear model of lisp you can write a little toy lisp interpreter

13:41 mollie: gotcha

13:41 hiredman: cads: my thoery is once you have the minimum needed to express all the concepts you want to express (lisp) you just keep writing in that minimum

13:42 and adding syntax gets just pushed farther and farther back and has less and less priority because all the code is written in lisp

13:43 * technomancy wrote a toy lisp on the bus. it's not that hard.

13:43 hiredman: I would count yours as something more then a toy since you actually are conforming to the scheme spec, right?

13:43 Chousuke: a toy scheme? :)

13:43 sddiew: ,(range 0 1 0.1)

13:43 clojurebot: (0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999)

13:44 technomancy: hiredman: sort of; I never did continuations or hygenic macros though.

13:44 hiredman: my lisp interpreter in php is around 390 lines or so

13:44 sddiew: ,(+ 0.2 1/10)

13:44 clojurebot: 0.30000000000000004

13:45 hiredman: but I added things (just cause) that you wouldn't really need if you where just trying to get a feel for lisp

13:46 I am still lost and confused about continuations

13:46 sddiew: how do I force repl to trim precision to .nn?

13:46 technomancy: hiredman: I think I finally figured out how they worked from a user's perspective, but how you would implement them was totally beyond me.

13:47 read a bit about continuation-passing-style interpreters, which kind of made sense, but would have required a near-complete rewrite to implement

13:47 cads: how much syntax can we add to lisp before we break it?

13:48 technomancy: cads: anything up to CL's LOOP macro. =)

13:48 hiredman: adding syntax breaks my heart, but it might not break the language

13:48 technomancy: hehe

13:48 hiredman: technomancy: doesn't cps get you tco for free?

13:49 technomancy: hiredman: yeah, that was the other cool thing about it

13:49 but Ruby has TCO now, so ...

13:49 hiredman: orly

13:49 technomancy: (FSVO "now")

13:49 in trunk, I think

13:50 cads: very nice

13:50 mollie: jruby is still in our boat though

13:50 cads: hmm

13:50 technomancy: we have a boat? sweet.

13:50 hiredman: I got Elements of Programming Languages, but the first few chapters seem very easy, then around chapter 5 it jumps straight to cps, and I hit a wall

13:50 * technomancy hoists the main sails

13:51 hiredman: does jruby use java's callstack?

13:52 I ended up implementing something like clojure's recur

13:53 technomancy: danlarkin: the main thing I was going to say about resourcefully's get/put etc. is that I think the functions should mirror the verbs in HTTP.

13:53 sure you're still doing requests, but calling the "request" function to perform a POST is like using "funcall" to call a function.

13:54 danlarkin: haha

13:54 cads: would it be bad juju to create lisp that will parse normal arithmetic, in the style of (mathexp E^(I*x*Pi) - E^(-I*x*PI))?

13:55 hiredman: cads: I think someone wrote and infix macro for it

13:55 technomancy: cads: they do that in the Little Schemer book IIRC

13:55 danlarkin: technomancy: I see your point... I guess calling (http/get url) is neat... but it does prevent it from being used

13:56 like.. clojure.core/use I mean

13:56 technomancy: yeah, I'm on the fence about that.

13:56 hiredman: ,(pl inc $ inc $ inc $ 0)

13:56 clojurebot: 3

13:57 cads: hiredman: I'll see if I can find the code, I'm curious how it'd be done... technomancy, in the little schemer, they try to write the halting function!

13:57 hiredman: ,(pl (?map (replicate 3 (?apply vector $ (?map range $ 10 inc � inc � inc) call � ?* $ 10 � call � (?+ -2) map)) shuffle))

13:57 clojurebot: ((60 10 50 100 70 80 30 90 20 40) (30 70 50 20 90 60 80 10 40 100) (90 10 20 60 30 70 80 100 50 40))

13:57 technomancy: cads: it's such a short book, how hard could it be? =)

13:58 hiredman: cads: I think the code was in the pastebin

14:01 cads: would it have to be done as a macro that works at the time where code is being read from a string?

14:01 hiredman: I am pretty sure macroexpansion happens after read time, not durring

14:02 ,(read-str "(pl inc $ inc $ 0)")

14:02 clojurebot: java.lang.Exception: Unable to resolve symbol: read-str in this context

14:02 stuartsierra: yes, macroexpansion happens as the first step of compilation

14:02 hiredman: ,(read (-> "(pl inc $ inc $ inc $ 0)" java.io.StringReader. java.io.PushbackReader.))

14:02 clojurebot: (pl inc $ inc $ inc $ 0)

14:03 hiredman: ,(macroexpand '(pl inc $ inc $ inc $ 0))

14:03 clojurebot: (do (inc (inc (inc 0))))

14:04 Lau_of_DK: Good evening gents

14:04 hiredman: hello

14:06 cads: hiredman: that's the Money operator from haskell!! That's pretty damn sweet.

14:06 hiredman: yeah

14:07 ,(macroexpand '(pl (inc � inc)))

14:07 clojurebot: (do ((comp inc inc)))

14:07 hiredman: ,(pl (inc � inc � inc 0))

14:07 clojurebot: 3

14:08 cads: ,(pl 12345^54321)

14:08 clojurebot: nil

14:08 cads: ,(pl 2^0)

14:08 clojurebot: nil

14:08 hiredman: that wouldn't work

14:08 cads: plap.

14:08 hiredman: ^ is reader magic

14:08 ,^(with-meta [] {:foo 1})

14:08 clojurebot: {:foo 1}

14:08 cads: aah, you're right

14:09 maybe..

14:09 ,(pl 2**0)

14:09 clojurebot: Invalid number: 2**0

14:09 cads: aah, well.

14:09 hiredman: hmm

14:09 cads: what site did you say this code was pasted at?

14:09 ,(pl 2 ** 0)

14:09 clojurebot: java.lang.Exception: Unable to resolve symbol: ** in this context

14:10 hiredman: ~transform

14:10 clojurebot: transform is http://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj

14:10 hiredman: pl lives there

14:10 pl doesn't have any infix math stuff

14:10 the infix math stuff was someting else entirely

14:10 ~url

14:10 clojurebot: excusez-moi

14:10 hiredman: url

14:11 lisppaste8: url

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

14:11 hiredman: http://paste.lisp.org/display/75230

14:14 technomancy: sddiew: did you find with-precision?

14:21 sddiew: ,(with-precision 2 (+ 0.2 0.1))

14:21 clojurebot: 0.30000000000000004

14:21 Chousuke: ,(doc with-precision)

14:21 clojurebot: "([precision & exprs]); Sets the precision and rounding mode to be used for BigDecimal operations. Usage: (with-precision 10 (/ 1M 3)) or: (with-precision 10 :rounding HALF_DOWN (/ 1M 3)) The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."

14:27 danlarkin: oh that's handy

14:28 and wrong? you'd think people would just use decimal math...

14:29 gnuvince: ~s decim fraction

14:29 clojurebot: Pardon?

14:29 technomancy: something's funky with kevinoneill's github mirror

14:29 gnuvince: damn

14:29 technomancy: keeps updating the release_1.0 tag every hour

14:29 hiredman: ,(with-precision 2 (+ 0.2M 0.1M))

14:29 clojurebot: 0.3M

14:29 gnuvince: (+ 1/5 1/10)

14:29 ,(+ 1/5 1/10)

14:29 clojurebot: 3/10

14:29 hiredman: ,(prn 0.3M)

14:29 clojurebot: 0.3M

14:31 sddiew: ,(range 0 1 0.1M)

14:31 clojurebot: (0 0.1M 0.2M 0.3M 0.4M 0.5M 0.6M 0.7M 0.8M 0.9M)

14:31 sddiew: ok, now how do I get rid of M

14:32 stuartsierra: ,(str 0.1M)

14:32 clojurebot: "0.1"

14:32 stuartsierra: ,(double 0.1M)

14:32 clojurebot: 0.1

14:33 sddiew: ok, float would do

14:33 gnuvince: ,(time (reduce + 0M (range 0 10000 0.1M)))

14:33 clojurebot: 499995000.0M

14:33 "Elapsed time: 1748.184 msecs"

14:33 gnuvince: ,(time (reduce + 0.0 (range 0 10000 0.1)))

14:33 clojurebot: 4.9999500000040805E8

14:33 "Elapsed time: 567.003 msecs"

14:33 gnuvince: Not bad

14:34 sddiew: so in order to generate (0 0.1 0.2 0.3 ...) etc. I have to generate sequence of BigDecimals and then convert them to normal? hmm..

14:34 stuartsierra: ,(map #(/ % 10) (range 1 10))

14:34 clojurebot: (1/10 1/5 3/10 2/5 1/2 3/5 7/10 4/5 9/10)

14:35 stuartsierra: ,(map #(float (/ % 10)) (range 1 10))

14:35 clojurebot: (0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)

14:35 sddiew: ,(map #(float %) (range 0 1 1/10))

14:35 clojurebot: (0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)

14:35 sddiew: ok

14:37 a bit faster

14:37 stuartsierra: ,(map float (range 0 1 1/10))

14:37 clojurebot: (0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)

14:37 cads: ,(range 0 1 0.1)

14:37 clojurebot: (0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999)

14:37 cads: that's a bit afflicted :)

14:38 stuartsierra: Probably just what you'd get from C or Java.

14:38 abrooks: It is.

14:38 cads: (+ 0.1 0.1 0.1)

14:39 ,(+ 0.1 0.1 0.1)

14:39 clojurebot: 0.30000000000000004

14:39 sddiew: ,(+ 0.2 0.1)

14:39 clojurebot: 0.30000000000000004

14:39 sddiew: ,(+ 0.2 1/10)

14:39 clojurebot: 0.30000000000000004

14:39 Chousuke: floating point arithmetic is tricky

14:39 V-ille2: Hi all, are there any plans to do a JSR-223 implementation for clojure? Or does such integration already exist?

14:39 Chousuke: what's that?

14:39 V-ille2: javax.script

14:39 abrooks: People IEEE754 is counterintuitive because we think it decimal fractions but IEEE754 is binary.

14:39 stuartsierra: I've thought about implementing javax.script for Clojure, but haven't had a need.

14:40 technomancy: stuartsierra: hey, have you looked at danlarkin's json lib at all?

14:41 stuartsierra: just glanced

14:41 abrooks: Actually, IIRC, IBM added decimal floating point a while back but they're the only ones who use it.

14:41 My memory's fuzzy here.

14:42 AWizzArd: stuartsierra: The patch for partition-by looks good. I commented on the issue, thanks :)

14:42 sddiew: ,(+ 0.2 0.05 0.05)

14:42 clojurebot: 0.3

14:43 technomancy: stuartsierra: I was wondering what the reason for there being two json libs was.

14:43 cads: still, abrooks, it's hard to understand why a reasonable floating point representation would get that residual 4e^-17 error on something like 0.1 + 0.2

14:43 stuartsierra: technomancy: two people scratched two itches :)

14:44 danlarkin: technomancy: replaca already probed yesterday

14:44 technomancy: stuartsierra: right; of course. =) just thought you two should coordinate.

14:45 abrooks: cads: Hang on and I'll try to find a good link that I've pointed people to before.

14:45 stuartsierra: At some point I'm sure we will. Not a big priority for me right now. JSON is pretty easy, after all.

14:45 hiredman: there is no reasonable floating point representation, there is only IEEE754

14:46 technomancy: danlarkin: you had some edge cases the contrib lib couldn't handle?

14:48 danlarkin: well I don't know why exactly contrib.json didn't handle that data correctly, but yeah last time I looked there we some missing pieces, or so it appeared to me

14:48 stuartsierra: do you remember where?

14:51 cads: abrooks, I'm sure I've read a mathematician's primer to floating points, so I know enough about how complicated and strange they are to forgive them

14:52 danlarkin: technomancy: check out http://github.com/tomfaulhaber/clojure-json/tree/pretty -- replaca is working on changing clojure-json to work with contrib's pretty printer

14:52 abrooks: cads: http://www.h-schmidt.net/FloatApplet/IEEE754.html

14:53 danlarkin: stuartsierra: it was a while ago.. I just remember not seeing a lot of the special casing of numbers and stuff that I had to do... but maybe you're handling it more elegantly

14:53 abrooks: cads: I'm not finding my usual reference at the moment.

14:54 stuartsierra: danlarkin: Don't know. I didn't try to handle numbers very carefully, just used "pr".

14:54 danlarkin: stuartsierra: and also with replaca's test data set contrib.json was producing array elements that should have been strings but were not quoted

14:55 abrooks: cads: Actually this one is better: http://babbage.cs.qc.edu/IEEE-754/Decimal.html

14:55 stuartsierra: Yes, I know it didn't force JSON object keys to be strings. I'm adding that now.

14:56 technomancy: stuartsierra: actually I kind of like keywords better

14:56 since you can use them as functions

14:57 but that's a breaking change...

14:57 wups; gotta take off; will be online later

14:57 stuartsierra: And JSON doesn't have keywords.

14:59 mollie: when they first tried json without keys as strings they had some nasty bugs, cause js has a bunch of reserved keywords they dont even use

15:02 stuartsierra: exactly

15:03 hiredman: I think he meant when you read, turn the read string keys into keywords

15:03 and perform the opposite process when writing

15:04 stuartsierra: hiredman: I didn't want to do that b/c I don't know if the key is a valid keyword.

15:04 Instead, I wrote c.c.walk/keywordize-keys for that purpose.

15:04 hiredman: ok

15:05 bradford: I want to define a function that takes two functions, some arguments, and applies both functions to the arguments

15:06 ,(defn both [p q [args]] ((p args) (q args)))

15:06 clojurebot: DENIED

15:06 bradford: how would I define such a function?

15:07 stuhood: probably exactly like that, but use the 'apply' function

15:07 (defn both [p q [args]] ((apply p args) (apply q args)))

15:08 hiredman: well

15:08 Chousuke: ,(let [both (fn [p q & args] [(apply p args) (apply q args)])] (both + - 1 2 3))

15:08 clojurebot: [6 -4]

15:22 dnolen: is it possible to go over anjava Enumeration in Clojure with a seq?

15:22 stuartsierra: yes: enumeration-seq

15:22 dnolen: clojure is awesome :)

15:23 Chouser: yes: awesome

16:49 aking: So I've got Clojure working on the BeagleBoard.. any decent micro-benchmarks to see what kind of speed difference it is?

16:50 Did a quick fib test - was surprised to see it at 0.7ms vs 0.073ms

16:50 much faster than I was expecting

16:51 hiredman: what jvm?

16:52 aking: Cacao

16:52 v0.99.4

16:52 hiredman: beagleboard, interesting

16:53 mollie: ive never heard of it before, looks cool

16:53 hiredman: the building appliances is very interesting

16:53 digash: ~seen rhickey

16:53 clojurebot: rhickey was last seen joining #clojure, 40 minutes ago

16:54 aking: Mainly got the beagleboard for its support of OpenGLES 2.0 - should be fun contorling that from Clojure

16:54 hiredman: aking: you should try the code from http://clojure.org/refs

16:54 aking: good idea - trying some stuff now

16:55 hiredman: or http://clojure.org/concurrent_programming

16:56 I was thinking I'd like to make some sort of dashboard for the office, with clojure of course

16:56 digash: i have a proposal for partition improvement http://gist.github.com/109002, how do i submit it?

16:56 hiredman: mostly just to display the weather

16:57 mollie: im interested in hci, this looks promising

16:57 hiredman: digash: submit a CA then send something to the google group

16:58 digash: hiredman: CA done. will submit to the googlegroup, thanks.

17:01 hiredman: aking: what are you using the bb for?

17:02 aking: hiredman: for the ogl shaders - something to test some game code I writing

17:03 hiredman: Oh

17:03 interesting

17:03 so graphics performance is ok?

17:03 aking: hiredman: It's also my day job - clojure is a nice break from the low level C stuff I have to write

17:04 hiredman: not sure yet - been getting the environment setup for the last few days.

17:04 mollie: are there any decent java 3d engines?

17:04 hiredman: ~sophia

17:04 clojurebot: Titim gan �ir� ort.

17:04 hiredman: ~sopha

17:04 clojurebot: I don't understand.

17:04 hiredman: bah

17:05 mollie: jmonkeyengine is one

17:05 aking: jmonkey is suppose to be good

17:12 rhickey: digash: are you proposing changing the behavior of partition when last segment not aligned? or only wen padding supplied?

17:12 when

17:13 hiredman: 1.0 is out, break everything!

17:13 stuhood: jump straight to 2.0!

17:13 rhickey: anything break with 1366?

17:14 digash: only when padding suplied

17:14 rhickey: not a breaking change

17:15 rhickey: digash: I see, that looks like a good way to handle it

17:15 digash: rhickey: i went through about ten versions, before i got to this one.

17:15 stuhood: ~def partition

17:17 hiredman: nothing seems to be broken

17:18 slashus2: Is "use" going to be changed into a macro as well?

17:19 technomancy: it does seem to be a common source of confusion how different the ns macro's "use" is from regular use

17:20 slashus2: right

17:20 Chouser: ns's :use just calls the 'use' function. How is it different?

17:20 technomancy: Chouser: just the quoting

17:20 Chouser: ah

17:20 technomancy: it's not a big deal, but people just starting out get confused

17:23 aking: hiredman: yup - all those ref tests seem to run fine. Though cacao seeems to get bogged down in gc for large loops

17:23 but it's jit seems fine with more normal use

17:23 hiredman: hmmm

17:24 must be higher then normal java object churn

17:24 digash: rhickey: just realized that when-let is not really needed so changed it to when http://gist.github.com/109002

17:25 aking: I'll also have to give it a try against jamvm as well - it might perform better.. dunno

17:25 hiredman: how much of a pain is it to set up?

17:27 rhickey: digash: it seems to me that when you have a pad argument (4 arg version), nil or not, you should get a final segment, i.e. pad was supplied

17:27 hiredman: like do I need to have a linux install to build a linux image to put on the thing, or can I just download one somewhere?

17:27 aking: If you go the make your own openembedded route (which I did), just need 40Gb of HD space and then it's one line to build your own image

17:27 hiredman: :(

17:27 aking: you can download it - I'll probably start putting my image up somewhere - I haven't seen any with java preinstalled

17:29 hiredman: hmmm

17:31 digash: rhickey: i had a version like that, but the implementation was more complicated

17:33 rhickey: digash: well, the implementation without the pad is already there, could just add your new code for new arity

17:33 digash: rhickey: sure, that is how I started and then collapsed the two using nil, since they were almost identical

17:33 rhickey: but the difference between (partition 3 3 [1 2 3 4 5] nil) and (partition 3 3 [1 2 3 4 5] []) is strange, clojure doesn't really do flags like that

17:34 digash: rhickey: let me dig out my other implementation.

17:34 rhickey: ok

17:35 digash: steve makes a good point too: http://groups.google.com/group/clojure/msg/a45f6f0bb1323f32

17:38 digash: rhickey: yep, makes sense

17:38 Chouser: I've used concat, which doesn't seem too bad when I've got a couple (or more) things to pad.

17:39 (partition 3 (concat [1 2 3 4] [0 0]))

17:39 where it starts to feel silly is when I've only got a single extra, and I just want nils

17:40 (partition 2 (concat [1 2 3] [nil]))

17:41 digash: it work if you know how many are hanging at the end.

17:41 rhickey: I think the repeat case is the strongest

17:41 will use only as much as needed to make last segment

17:42 digash: or cycle

17:42 rhickey: digash: right

17:43 Chouser: it would seem a bit awkward to put a thing that gets appended before the thing it's appending to, wouldn't it?

17:43 rhickey: Mathematica has a mode that loops, I always found weird and not useful for me

17:44 digash: yes, I was inspired by mathematica but i thing with cycle and repeat most of them could be easily done.

17:45 except {-1, 1} thing which I only used in cellular automata on the cycle background.

17:46 V-ille2: rhickey: any plans to support JSR-223 aka javax.script in clojure?

17:46 rhickey: Chouser: I'd like to see it swapped around, you might be right but consistency says coll last for seq fns, also partial application is consistent, again the repeat/cycle is less weird

17:47 V-ille2: I'm not opposed, but not something I'm personally going to take on

17:50 digash: when you are ready, remember I can't take a contribution from github - attach to issue

17:50 bbl

17:52 technomancy: is clojure.core/stream? something that leaked in from the streams branch?

17:52 digash: rhickey: will clean it up with all the suggestions and attach to an issue.

17:53 V-ille2: rhickey: I'm not sure if I'd have time to do it - as you may know, I hack abcl. But, I'd like to have JSR-223 available for other alternatives. CLforJava seems a bit behind-the-scenes, so I have no idea about them.

17:58 technomancy: danlarkin: do you think it would make sense for http.client/request to accept an InputStream as a body?

17:59 hiredman: yes

17:59 technomancy: and then just copy bytes from it to the connection's OutputStream

17:59 danlarkin: technomancy: yeah

17:59 * technomancy is still getting his bearings wrt JVM I/O functions

17:59 danlarkin: maybe it should use contrib.duckstreams and just take anything that it can use

18:00 technomancy: danlarkin: how about this? http://p.hagelb.org/http-client-send-body.html

18:02 danlarkin: haha, I love this: (spit out body)

18:03 technomancy: (repeatedly (chew body))

18:03 hiredman: vaguely sinister

18:03 technomancy: ;; nom.nom.nom

18:05 danlarkin: technomancy: check out clojure.contrib.duck-streams/slurp*

18:06 and the reader definition for an InputStream

18:07 technomancy: danlarkin: I think I want to send it straight to the output rather than buffering it in a string builder though.

18:08 danlarkin: what for?

18:08 technomancy: so it works for bodies of any size without ballooning memory usage

18:11 danlarkin: mmmmhm

18:11 that's valid

18:11 technomancy: seems duck-streams could do with a "copy between streams" function

18:12 danlarkin: technomancy: agreed

18:12 clojurebot: technomancy is to blame for all failures

18:12 technomancy: oh snap!

18:12 danlarkin: clojurebot: seconded!

18:12 clojurebot: No entiendo

18:12 hiredman: zing!

18:12 thats what you get for spacing out at the library

18:13 technomancy: I moved to a coffee shop, actually.

18:13 hiredman: oh, alright then

18:21 technomancy: danlarkin: do you need to close the OutputStream before you can read from the InputStream?

18:22 danlarkin: I do not know

18:22 hiredman: yes

18:22 .flush might be enough, or you might need to .close it

18:23 technomancy: thanks

18:23 hiredman: but I remember having all kinds of trouble with posting to twitter because of this

18:25 gcv: any clojure-swank experts here?

18:30 technomancy: gcv: I think there's only one clojure-swank expert in existence: the guy who wrote it.

18:30 and he... doesn't seem to be around any more

18:31 but you can ask your question

18:33 gcv: I think I've sorta got swank-clojure-extra-classpaths worked out with some elisp hackery, but if I just put a directory in there, I can't get slime-edit-definition to jump to a function in there

18:33 it seems to work fine with clojure.jar or something else which embeds sources in a jar file, but not in a directory directly

18:34 technomancy: hmm... works for me with M-x slime-project

18:34 http://p.hagelb.org/slime-project.html

18:35 gcv: technomancy: ah, that's promising

18:35 technomancy: thanks, I'll try to see if I can match my custom slime setup to what works here

18:35 technomancy: gcv: that's assuming you use clojure-pom and mvn process-resources to unpack in target/dependency

18:36 which is a great way to go if you've got complicated dependencies, but may not be your cuppa for simple projects

18:40 gcv: technomancy: no, I don't use maven... I actually had a bad brush with maven1 about four years ago, and have avoided anything to do with it since. I'm sure it's better now, but I've avoided it in my explorations of Clojure for the time being.

18:40 technomancy: gcv: well you'll get tired of handling deps manually before too long. hopefully by then there's a nice clojuretastic wrapper for handling mvn repos though. =)

18:41 using clojure-pom pretty much takes the pain away though since you've only got to write 5 lines of XML or so.

18:41 of course, writing three lines of clojure would be preferrable. =)

18:42 gcv: amen to that

18:53 technomancy: danlarkin: about to commit body stream support

18:53 I added connection pooling/keepalive support to the TODO; anything else that belongs there?

18:55 danlarkin: technomancy: sweet, I'm gonna use it later tonight :)

18:57 technomancy: push'd

19:17 ataggart: anyone know how I can stop a runaway recursion in the slime repl? other than waiting for the stack to blow

19:18 bradford: anyone notice with-open behaving incorrectly?

19:18 Cark: ataggart:kill the buffer

19:18 ctdean: In the top level thread? C-c C-c

19:18 bradford: I am getting "No matching field found: close for class com.rabbitmq.client.impl.AMQConnection"

19:19 Cark: ah slime, different beast ... using vanilla clojure-mode here

19:19 bradford: seels like with-open is trying to call a field close rather than a method?

19:19 danlarkin: technomancy: I have been writing a couchdb api, halfassedly so far

19:19 ctdean: Otherwise, I think you're SOL. You'll need to find the Thread and kill it. easier just to exit slime. ,sayonarra

19:20 * misspelled

19:20 ataggart: alas, I know how to do none of that. Though C-c C-c worked

19:20 <-- emacs noob

19:20 ctdean: lol, yep

19:21 You can enter comma commands in slime. Do you know about those?

19:21 technomancy: danlarkin: I started playing around with that... Couch is so close to HTTP itself that very little is needed to wrap it.

19:22 danlarkin: technomancy: indeed, makes it an easy target :)

19:22 technomancy: would be great to have as an example of how http.client works though.

19:22 ataggart: @ctdean: nope. I haven't yet figured out how to distinguish slime from emacs

19:24 ctdean: If you're at the beginning of a prompt in slime repl, you can type , There are shortcut commands availble.

19:25 technomancy: ctdean: did not know that; thanks

19:26 ctdean: sure thing. ", quit" and ", in" are what I mostly use

19:26 ataggart: I see three places to enter text: the bottom thing where all the M- C- stuff shows up, the window holding my code, and the window showing the clojure repl

19:26 * technomancy has been considering hacking swank-clojure to make backtraces more readable

19:27 technomancy: grey out all the clojure internal lines

19:27 ataggart: which one is the "slime repl"?

19:27 technomancy: allow hyperlinking

19:27 danlarkin: technomancy: yeah helps me find missing features :)

19:28 ctdean: the slime repl is the one showing the clojure repl

19:28 ataggart: (user=> , quit

19:28 , quit

19:28 clojurebot: java.lang.Exception: Unable to resolve symbol: quit in this context

19:28 ataggart: java.lang.Exception: Unable to resolve symbol: quit in this context (NO_SOURCE_FILE:0)

19:29 so typing ". quit" in the clojure repl didn't work

19:29 ctdean: If your cursor is at the right spot, as soon as you hit "," you should be able to enter a special shortcut in the echo are (on the bottom)

19:29 ataggart: what's the right spot?

19:29 technomancy: ataggart: are you in *inferior-lisp* then?

19:29 ctdean: Ah.

19:29 Yes, the buffer is named *slime-repl XYZ*

19:30 where XYZ is probably "nil"

19:30 ataggart: The top half of my screen shows the code, the bottom half shows the repl and allong the bottom it says "*inferior-lisp*"

19:30 danlarkin: technomancy: one thing I'd like is to not have to send the Accept header with every request, but I couldn't find any .removeHeader method or equivalent in the javadoc

19:30 technomancy: ataggart: your slime is probably not configured to use the repl module

19:31 ataggart: lovely

19:31 technomancy: danlarkin: yeah, that's odd

19:31 ctdean: Wow, didn't know that was possible.

19:31 technomancy: ctdean: they moved the repl module into contrib; it's not loaded by default anymore. =\

19:31 ataggart: well I cobbled this setup from about a dozen different, partially working "tutorials"

19:31 ctdean: Right, I recall all that now.

19:32 technomancy: ataggart: the easiest way to get going is to use M-x clojure-install from a recent clojure-mode.el

19:32 all this rummaging around in outdated tutorials is not necessary

19:32 ataggart: I have no idea what most of that means

19:33 technomancy: ataggart: if you have clojure-mode.el installed in your Emacs directory, you can press M-x clojure-install RET, and it will download and configure Clojure, contrib, slime, and clojure-swank all for you.

19:33 only like 2 lines of configuration required.

19:33 ctdean: You can also look at http://gist.github.com/109057 for what I do

19:33 ataggart: "if you have clojure-mode.el installed in your Emacs directory" I do'nt follow this

19:33 I downloaded Aquamacs

19:33 and then the slime thing

19:34 technomancy: hrm... I don't know how it works with aquamacs slime

19:34 ataggart: what I wouldn't give for a damn eclipse plugin

19:35 ctdean: Yes, the emacs learning curve is steep. and slime is not the easiest thing to start with

19:35 technomancy: ctdean: slime is pretty straightforward actually

19:35 with regular Emacs you just get clojure-mode via the package manager or manually, hit M-x clojure-install, copy two lines of code to your .emacs, and you're good to go.

19:36 ataggart: but I like writing code with more UI than a commandline

19:36 ctdean: Maybe just for clojure, I don't know about that. But using the base slime and even just one CL is a tricky

19:36 technomancy: ctdean: true, that gets wacky

19:37 ataggart: how anyone can write a lot of code quickly in a terminal window is beyond me.

19:37 technomancy: ataggart: it helps if you quit using the mouse

19:37 bloody rodent just slows you down

19:37 ataggart: maybe for those of you who can touch-type

19:37 ctdean: atm, I'm supporting multiple users with 4 (count 'em 4!) different lisps

19:37 technomancy: unfortunately aquamacs encourages use of the mouse. =\

19:38 ataggart: not really. I can't figure out what good this bloody UI is doing

19:38 I can't drag the partitions around or anything

19:38 I've been interested in clojure since last summer

19:38 and I just can't get around to ever writing any

19:39 I keep having to fight the tools

19:40 oh well, maybe in another year

19:41 emacsen: I love Emacs, but if you had to choose a nice cross platform clj editor and repl tool, what would you choose?

19:41 ctdean: I know many very productive developers who just do it old school: use emacs or vi to edit the code; copy and paste to a repl in another window.

19:42 emacsen: ctdean: come on dude, I just said "I love emacs but..."

19:42 This is "I'm trying to show Clojure to others, and I don't want to impose emacs on them"

19:42 technomancy: ctdean: what languages?

19:42 Cark: ataggart : there is a netbean plugin also

19:43 ctdean: Lisps. Scheme mostly, but CL too.

19:45 technomancy: ctdean: there's a reason they call scheme minimalist I guess. =)

19:46 ctdean: member:technomancy: yep. I spent many years in Scheme and I do miss the simplicity sometimes.

19:46 ok, I'm an irc dummy :(

19:50 emacsen: ctdean, what do you miss?

19:51 ctdean: I don't know enough to have a good opinion on clojure, but the although CL is productive it seems like a big ball of contradictions when compared to scheme.

19:52 technomancy: design-by-committee.

19:53 emacsen: ctdean, right, I guess I'm asking what you miss in Scheme vs Clojure

19:53 ctdean: Right. I get that and I like CL a whole bunch. It's just the reality of the project.

19:54 emacsen: scheme has a few things clj doesn't have but none of them are big deals IMHO

19:54 ctdean: Clojure seems super great, but I don't know enough to really compare Scheme vs. Clojure

19:54 emacsen: continuations, hygenic macros, and something else... something more obscure

19:55 ctdean: The only things I do miss are necessary design constraints: named let (TCO) is a big one

19:55 emacsen: TCO, that's it :)

19:55 bleh... I mean do recur gets you pretty close and it's actually explicit

19:56 ctdean: I'll be a heretic: I actually like defmacro better

19:56 emacsen: does the clj regex builtin have a substitution mechanism?

19:56 ctdean: There is one in contrib

19:58 ,(doc re-sub)

19:58 clojurebot: java.lang.Exception: Unable to resolve var: re-sub in this context

19:58 emacsen: I don't see an easy way to search all the docs

19:58 ctdean: it's in str-utils

19:59 and re-gsub

19:59 emacsen: thx

19:59 ctdean: I find the docs difficult to navigate. not sure why.

19:59 emacsen: there isn't a searching function is there

20:01 technomancy: ~ find-doc

20:01 clojurebot: No entiendo

20:01 technomancy: ~find-doc

20:01 clojurebot: Pardon?

20:01 technomancy: ...

20:01 ataggart: clojurebot is a smartass

20:06 ctdean: Is there something like *load-pathname* in clojure?

20:12 emacsen: is there a reference doc somewhere on the regex syntax clojure uses? eg "all digits" -> \d

20:12 ctdean: It's the Java one

20:12 emacsen: or does it just use the java one

20:12 ctdean: So the java docs

20:12 emacsen: ah :)

20:30 dreish: Seems like circular (use)s should throw some of helpful error.

20:30 some kind of

21:08 danlarkin: dreish: agreed, it also would be nice if they didn't cause an error at all :)

21:21 dreish: Well, that's what it does now. So instead you've got to figure out why you get the error "can't resolve symbol some-function" in a file where you're clearly including the library where that function is defined.

21:29 danlarkin: dreish: I mean I wish it worked

21:29 dreish: I'm not sure what would be the right thing to do, other than just throw an error.

21:29 If A requires B, but B requires A, neither one can be compiled.

21:30 danlarkin: there's gotta be something

21:31 it doesn't make sense to me that a program can be valid when it's in one file, but clojure can't deal with it if I split it up into two files

21:31 I understand the reasons, I just think there's gotta be a way

21:31 dreish: I don't see how it would be valid if it were in one file.

21:32 One half of the file has to come before the other half. They can't both come first.

21:32 danlarkin: because you can use things like (declare foo)

21:32 dreish: Right ...

21:32 So maybe have a .h file, plus a .c file?

21:33 Wait, wrong language.

21:33 danlarkin: :) Never say never

21:34 not about header files I mean, but circular dependency detection /can/ be done

21:34 dreish: Sure, that seems like it should be easy.

21:34 Easy enough that I want to fix it myself to avoid having to figure this out again, now that I know it's something to check? Maybe not.

21:35 danlarkin: if it were easy it'd be done already

21:51 emacsen: so, anyone have a particular non-emacs Clojure IDE they like?

21:52 dreish: I don't think so. Everyone loves emacsen.

21:52 emacsen: dreish, me too, but I dunno if I want to show clj in only emacs

21:52 erohtar: is there a way to redefine functions from core?

21:53 danlarkin: emacsen: there's a large vi contingent, but not sure that counts as an "IDE", but then again, maybe emacs doesn't either

21:53 dreish: Was just kidding. I think there's at least one real IDE out there, but I've never had any interested in anything but emacs myself.

21:54 erohtar: In a pinch, you can always switch to the core ns, redefine your function, and get out.

21:54 erohtar: dreish: thanks

21:54 dreish: I think I remember there being a way to disassociate a symbol from the namespace in which it was defined, which I would guess you could use before redefining it, but that's more work.

21:55 erohtar: no, just redefining if enuff for my purposes

21:58 danlarkin: erohtar: you can also use binding

21:59 erohtar: danlarkin: true - i just tried it, and for some reason, i thought you couldn't redefine stuff from core

21:59 danlarkin: are there any special restrictions on what u can do with stuff in core?

22:00 danlarkin: no

22:00 not that I can think of

22:00 erohtar: ok great

22:00 i didnt think there would be, but i guess i was tired when i tried this earlier

22:00 danlarkin: keep in mind that if you rebind something like =, you'll mess up tons 'o stuff

22:00 erohtar: yes...

22:00 dreish: Or make it much more awesome!

22:01 erohtar: i wanted to disable a couple of things inside the scope executing something

22:02 specifically, all clojure support for state

22:02 so things like ref, etc.

Logging service provided by n01se.net