#clojure logs

2009-05-08

00:05hiredman,(* 40 50)
00:06clojurebot2000
04:13AWizzArd~ seen scgilardi
04:13clojurebotno, I have not seen scgilardi
04:32sddiewCould 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...
04:35jdzyou think that obtaining something valuable for you should not cost you anything?
04:36jdzhow much is the book worth in terms of food for you? 4 dinners? 10?
04:38sddiew9 (rough estimate), I just thought that somebody might have unused discount coupon. I don't want it for free.
04:39jdzcan you eat dinner for $2 in Poland?
04:39jdzconflicts with my experience
04:40jdz(but that's offtopic)
04:41tWipon the subject of the book... has anyone tried the epub version on iPhone? is it readable?
04:45chrizeltWip, 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...
04:48tWipok, good to know
04:49chrizeloh, 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
09:41whitingjrhello, I want to get debugging my clojure files in eclipse v3.4.2. the breakpoints are not working for any source .clj files
09:42whitingjrshould I be checking something in eclipse ?
10:23rhickeyis there a standard layout for repos when using git?
10:26chrizelno, not like in svn - "trunk" or something isn't needed
10:28jdzthere is just one repo, and you branch to your heart's content in it
10:28jdzcreate branches and switch between them, that is
10:28rhickeyright, I understand no structure is required for git itself, just wondering if there were any conventions
10:29jdzwell, CVS does not have any structures as well, does it?
10:29jdzi think it's something SVN people have come up with
10:51cemerickrhickey: '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:52rhickeycemerick: right, but that's not on the filesystem right, just a branch name thing?
10:52rhickeythe repo dir is just a free-for-all?
10:52cemerickyes, definitely
10:53rhickeyok thanks
10:54cemerickrhickey: please report to headquarters for your first re-education session immediately ;-)
11:00noidirhickey, this is good to know when learning git :) http://www.gitready.com/advanced/2009/01/17/restoring-lost-commits.html
11:05molliehi. clojure.contrib.repl-utils is not auto-loaded correct?
11:06rhickeymollie: right, nothing from contrib is auto-loaded
11:06mollieok thanks. im reading a tut that says it is, ill let him know
11:06hiredmanclojurebot: ping?
11:06clojurebotPONG!
11:08mollieis there a way to autoload it within your .emacs? or at command line?
11:13rhickeymollie: i'm sure there is - can anyone help mollie ?
11:14mollieno worries, ill hang around. thanks for your work, im excited about clojure
11:14rhickeymollie: you'll get more eyes on the google group if no one here can help right now
11:16hiredmanmollie: at the commandline you can pass clojure.main forms to be evaluated via -e or files to load and eval via -i
11:16hiredmandunno about emacs
11:16mollieah ok, in .emacs i just call it via a commandline, so that'll prob work, thanks!
11:17hiredmanso somesomething like 'java clojure.main -i init-stuff.clj -r' would get you a repl
11:17jdzmollie: don't you use slime?
11:17mollieyes
11:18molliebut im trying to get at repl-utils/show, which i need to load first
11:18chrizelmaybe the option "swank-clojure-init-files"? the docstring says "If provided, will be used to initialize the REPL environment."
11:19dnolenmollie: one common way is also to provide user.clj file in the class path
11:19jdzsee the documentation for swank-clojure-init-files in emacs
11:19jdzoh
11:19dnolenthen you can require the library you want to autoload when slime starts up
11:19jdzi'm late
11:19molliethat makes sense, thanks dnolen
11:20ChouserLast I knew, user.clj was loaded too early to set things like *print-length*
11:20ChouserI use -i for setting that and loading repl-utils
11:21dnolenChouser: good to know.
12:54Raynes"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:55Chouseruh
12:55cadsand peta, eh?
12:55Chousersomeone vandalize wikipedia or something?
12:56bstephensonAshton Kutcher? ouch!
12:56cadsyou know, the early haskell mailing list with hudak and peyton-jones going back and forth... is kind of awe inspiring
12:56hiredmansomeone is reading reddit
12:56gnuvinceThe Scheme one about lambdas is awesome
12:56gnuvince"Lambdas a relegated to relative obscurity until Java makes them popular again by not having them"
12:56gnuvince*are
12:57Rayneshttp://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html
12:59cadsI 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:59cadsI'm not above learning a new library by stealing and adapting working code :)
13:02Chousercads: here's a little something: http://blog.n01se.net/?p=35
13:17danlarkintechnomancy's CMOS got reset
13:17technomancyhehe
13:18dnolen___are .jnilib files included on the classpath just like .jars?
13:21molliei have a dopey question: how come ((cons '+ '(1 2)) throws an error, and (cons '+ '(1 2)) wont eval?
13:21hiredman,(cons '+ '(1 2))
13:21clojurebot(+ 1 2)
13:22hiredmanevals here
13:22mollieright, but how do i get 3
13:22hiredman(eval (cons '+ '(1 2)))
13:23hiredman((cons '+ '(1 2)) => ('(+ 1 2))
13:23hiredmanwhich means (+ 1 2) is called as a function, which it isn't
13:23hiredmanso you get Exceptions
13:24molliei see
13:24hiredmanthis you first time out with a lisp?
13:25hiredmanyour
13:25molliekinda sorta, other than hacking on my .emacs over the years
13:26hiredmanso the reader reads the text "(+ 1 2)" and outputs a list (+ 1 2)
13:26hiredmaneval treats the first element in a list as a function and applies it to the rest
13:27hiredmanalthough actually I think clojure's eval is a little more complicated
13:27mollieis the eval fn something in most lisps?
13:27hiredmanyeah
13:28danlarkinin all lisps
13:28hiredmaneval is central to the idea of code as data
13:28hiredmaneval takes data and treats it as a program
13:29technomancydanlarkin: you OK with licensing clojure-http under the same terms as clojure?
13:29dnolen___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:30danlarkintechnomancy: yes
13:30dnolen___John Mccarthy 1962
13:30hiredmanhah
13:30hiredmanwith m-expressions
13:30technomancydanlarkin: ok; will add that to the readme.
13:30molliei guess im used to javascript, where using eval is looked on as a sin of sorts
13:31hiredmanwell
13:31hiredmanit still sort of is
13:31hiredmanusing it is not encouraged
13:31hiredmanbut it is what is happening under the hood
13:31danlarkinyou generally do not need to use it
13:31cadschouser, iterated function systems are a joy, and that code really looks less scary than I thought gui code was going to look! thanks!
13:32Chousercads: oh, good.
13:32cadsI just need a pane to project my simulated particles upon :)
13:33hiredmanthe reads text and outputs a datastructure and then eval treats the datastructure as a program
13:33cadshiredman: whatever happened to m-expressions
13:33hiredmandunno, but thank god they never caught on
13:33hiredman,(read-str "(+ 1 2)")
13:33clojurebotjava.lang.Exception: Unable to resolve symbol: read-str in this context
13:34hiredman,(read (-> "(+ 1 2)" java.io.StringReader. java.io.PushbackReader.))
13:34clojurebot(+ 1 2)
13:34Chousukecads: implementing m-expressions would've been too much work in the early days of lisp
13:35cadsthey would have been a full syntax but at the same time easily parseable into sexps?
13:35danlarkinMcCarthy was told that eval could be written in terms of s-expressions and that started to change his mind, IIRC
13:36cadshmm
13:37hiredmanmollie: writing a lisp (basic) interpreter in javascript would not be too hard, and it would give you nice model
13:38cadsI 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:38hiredmanyeah
13:39hiredmanit is an idea that keeps coming up but never really goes anywhere
13:39hiredman"we'll start with lisp and add syntax later"
13:39cadsin the bitc community, or in lispy languages in general?
13:39molliethere'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:40hiredmanmollie: Chouser ported a lot of clojure to js
13:40hiredmanI am just saying to get a clear model of lisp you can write a little toy lisp interpreter
13:41molliegotcha
13:41hiredmancads: 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:42hiredmanand adding syntax gets just pushed farther and farther back and has less and less priority because all the code is written in lisp
13:43hiredmanI would count yours as something more then a toy since you actually are conforming to the scheme spec, right?
13:43Chousukea toy scheme? :)
13:43sddiew,(range 0 1 0.1)
13:43clojurebot(0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999)
13:44technomancyhiredman: sort of; I never did continuations or hygenic macros though.
13:44hiredmanmy lisp interpreter in php is around 390 lines or so
13:44sddiew,(+ 0.2 1/10)
13:44clojurebot0.30000000000000004
13:45hiredmanbut I added things (just cause) that you wouldn't really need if you where just trying to get a feel for lisp
13:46hiredmanI am still lost and confused about continuations
13:46sddiewhow do I force repl to trim precision to .nn?
13:46technomancyhiredman: 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:47technomancyread a bit about continuation-passing-style interpreters, which kind of made sense, but would have required a near-complete rewrite to implement
13:47cadshow much syntax can we add to lisp before we break it?
13:48technomancycads: anything up to CL's LOOP macro. =)
13:48hiredmanadding syntax breaks my heart, but it might not break the language
13:48technomancyhehe
13:48hiredmantechnomancy: doesn't cps get you tco for free?
13:49technomancyhiredman: yeah, that was the other cool thing about it
13:49technomancybut Ruby has TCO now, so ...
13:49hiredmanorly
13:49technomancy(FSVO "now")
13:49technomancyin trunk, I think
13:50cadsvery nice
13:50molliejruby is still in our boat though
13:50cadshmm
13:50technomancywe have a boat? sweet.
13:50hiredmanI 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:51hiredmandoes jruby use java's callstack?
13:52hiredmanI ended up implementing something like clojure's recur
13:53technomancydanlarkin: 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:53technomancysure you're still doing requests, but calling the "request" function to perform a POST is like using "funcall" to call a function.
13:54danlarkinhaha
13:54cadswould 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:55hiredmancads: I think someone wrote and infix macro for it
13:55technomancycads: they do that in the Little Schemer book IIRC
13:55danlarkintechnomancy: I see your point... I guess calling (http/get url) is neat... but it does prevent it from being used
13:56danlarkinlike.. clojure.core/use I mean
13:56technomancyyeah, I'm on the fence about that.
13:56hiredman,(pl inc $ inc $ inc $ 0)
13:56clojurebot3
13:57cadshiredman: 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:57hiredman,(pl (?map (replicate 3 (?apply vector $ (?map range $ 10 inc � inc � inc) call � ?* $ 10 � call � (?+ -2) map)) shuffle))
13:57clojurebot((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:57technomancycads: it's such a short book, how hard could it be? =)
13:58hiredmancads: I think the code was in the pastebin
14:01cadswould it have to be done as a macro that works at the time where code is being read from a string?
14:01hiredmanI am pretty sure macroexpansion happens after read time, not durring
14:02hiredman,(read-str "(pl inc $ inc $ 0)")
14:02clojurebotjava.lang.Exception: Unable to resolve symbol: read-str in this context
14:02stuartsierrayes, macroexpansion happens as the first step of compilation
14:02hiredman,(read (-> "(pl inc $ inc $ inc $ 0)" java.io.StringReader. java.io.PushbackReader.))
14:02clojurebot(pl inc $ inc $ inc $ 0)
14:03hiredman,(macroexpand '(pl inc $ inc $ inc $ 0))
14:03clojurebot(do (inc (inc (inc 0))))
14:04Lau_of_DKGood evening gents
14:04hiredmanhello
14:06cadshiredman: that's the Money operator from haskell!! That's pretty damn sweet.
14:06hiredmanyeah
14:07hiredman,(macroexpand '(pl (inc � inc)))
14:07clojurebot(do ((comp inc inc)))
14:07hiredman,(pl (inc � inc � inc 0))
14:07clojurebot3
14:08cads,(pl 12345^54321)
14:08clojurebotnil
14:08cads,(pl 2^0)
14:08clojurebotnil
14:08hiredmanthat wouldn't work
14:08cadsplap.
14:08hiredman^ is reader magic
14:08hiredman,^(with-meta [] {:foo 1})
14:08clojurebot{:foo 1}
14:08cadsaah, you're right
14:09cadsmaybe..
14:09cads,(pl 2**0)
14:09clojurebotInvalid number: 2**0
14:09cadsaah, well.
14:09hiredmanhmm
14:09cadswhat site did you say this code was pasted at?
14:09cads,(pl 2 ** 0)
14:09clojurebotjava.lang.Exception: Unable to resolve symbol: ** in this context
14:10hiredman~transform
14:10clojurebottransform is http://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj
14:10hiredmanpl lives there
14:10hiredmanpl doesn't have any infix math stuff
14:10hiredmanthe infix math stuff was someting else entirely
14:10hiredman~url
14:10clojurebotexcusez-moi
14:10hiredmanurl
14:11hiredmanlisppaste8: url
14:11lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
14:11hiredmanhttp://paste.lisp.org/display/75230
14:14technomancysddiew: did you find with-precision?
14:21sddiew,(with-precision 2 (+ 0.2 0.1))
14:21clojurebot0.30000000000000004
14:21Chousuke,(doc with-precision)
14:21clojurebot"([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:27danlarkinoh that's handy
14:28danlarkinand wrong? you'd think people would just use decimal math...
14:29gnuvince~s decim fraction
14:29clojurebotPardon?
14:29technomancysomething's funky with kevinoneill's github mirror
14:29gnuvincedamn
14:29technomancykeeps updating the release_1.0 tag every hour
14:29hiredman,(with-precision 2 (+ 0.2M 0.1M))
14:29clojurebot0.3M
14:29gnuvince(+ 1/5 1/10)
14:29gnuvince,(+ 1/5 1/10)
14:29clojurebot3/10
14:29hiredman,(prn 0.3M)
14:29clojurebot0.3M
14:31sddiew,(range 0 1 0.1M)
14:31clojurebot(0 0.1M 0.2M 0.3M 0.4M 0.5M 0.6M 0.7M 0.8M 0.9M)
14:31sddiewok, now how do I get rid of M
14:32stuartsierra,(str 0.1M)
14:32clojurebot"0.1"
14:32stuartsierra,(double 0.1M)
14:32clojurebot0.1
14:33sddiewok, float would do
14:33gnuvince,(time (reduce + 0M (range 0 10000 0.1M)))
14:33clojurebot499995000.0M
14:33clojurebot"Elapsed time: 1748.184 msecs"
14:33gnuvince,(time (reduce + 0.0 (range 0 10000 0.1)))
14:33clojurebot4.9999500000040805E8
14:33clojurebot"Elapsed time: 567.003 msecs"
14:33gnuvinceNot bad
14:34sddiewso 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:34stuartsierra,(map #(/ % 10) (range 1 10))
14:34clojurebot(1/10 1/5 3/10 2/5 1/2 3/5 7/10 4/5 9/10)
14:35stuartsierra,(map #(float (/ % 10)) (range 1 10))
14:35clojurebot(0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)
14:35sddiew,(map #(float %) (range 0 1 1/10))
14:35clojurebot(0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)
14:35sddiewok
14:37sddiewa bit faster
14:37stuartsierra,(map float (range 0 1 1/10))
14:37clojurebot(0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9)
14:37cads,(range 0 1 0.1)
14:37clojurebot(0 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999)
14:37cadsthat's a bit afflicted :)
14:38stuartsierraProbably just what you'd get from C or Java.
14:38abrooksIt is.
14:38cads(+ 0.1 0.1 0.1)
14:39cads,(+ 0.1 0.1 0.1)
14:39clojurebot0.30000000000000004
14:39sddiew,(+ 0.2 0.1)
14:39clojurebot0.30000000000000004
14:39sddiew,(+ 0.2 1/10)
14:39clojurebot0.30000000000000004
14:39Chousukefloating point arithmetic is tricky
14:39V-ille2Hi all, are there any plans to do a JSR-223 implementation for clojure? Or does such integration already exist?
14:39Chousukewhat's that?
14:39V-ille2javax.script
14:39abrooksPeople IEEE754 is counterintuitive because we think it decimal fractions but IEEE754 is binary.
14:39stuartsierraI've thought about implementing javax.script for Clojure, but haven't had a need.
14:40technomancystuartsierra: hey, have you looked at danlarkin's json lib at all?
14:41stuartsierrajust glanced
14:41abrooksActually, IIRC, IBM added decimal floating point a while back but they're the only ones who use it.
14:41abrooksMy memory's fuzzy here.
14:42AWizzArdstuartsierra: The patch for partition-by looks good. I commented on the issue, thanks :)
14:42sddiew,(+ 0.2 0.05 0.05)
14:42clojurebot0.3
14:43technomancystuartsierra: I was wondering what the reason for there being two json libs was.
14:43cadsstill, 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:43stuartsierratechnomancy: two people scratched two itches :)
14:44danlarkintechnomancy: replaca already probed yesterday
14:44technomancystuartsierra: right; of course. =) just thought you two should coordinate.
14:45abrookscads: Hang on and I'll try to find a good link that I've pointed people to before.
14:45stuartsierraAt some point I'm sure we will. Not a big priority for me right now. JSON is pretty easy, after all.
14:45hiredmanthere is no reasonable floating point representation, there is only IEEE754
14:46technomancydanlarkin: you had some edge cases the contrib lib couldn't handle?
14:48danlarkinwell 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:48stuartsierrado you remember where?
14:51cadsabrooks, 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:52danlarkintechnomancy: 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:52abrookscads: http://www.h-schmidt.net/FloatApplet/IEEE754.html
14:53danlarkinstuartsierra: 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:53abrookscads: I'm not finding my usual reference at the moment.
14:54stuartsierradanlarkin: Don't know. I didn't try to handle numbers very carefully, just used "pr".
14:54danlarkinstuartsierra: and also with replaca's test data set contrib.json was producing array elements that should have been strings but were not quoted
14:55abrookscads: Actually this one is better: http://babbage.cs.qc.edu/IEEE-754/Decimal.html
14:55stuartsierraYes, I know it didn't force JSON object keys to be strings. I'm adding that now.
14:56technomancystuartsierra: actually I kind of like keywords better
14:56technomancysince you can use them as functions
14:57technomancybut that's a breaking change...
14:57technomancywups; gotta take off; will be online later
14:57stuartsierraAnd JSON doesn't have keywords.
14:59molliewhen 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:02stuartsierraexactly
15:03hiredmanI think he meant when you read, turn the read string keys into keywords
15:03hiredmanand perform the opposite process when writing
15:04stuartsierrahiredman: I didn't want to do that b/c I don't know if the key is a valid keyword.
15:04stuartsierraInstead, I wrote c.c.walk/keywordize-keys for that purpose.
15:04hiredmanok
15:05bradfordI want to define a function that takes two functions, some arguments, and applies both functions to the arguments
15:06bradford,(defn both [p q [args]] ((p args) (q args)))
15:06clojurebotDENIED
15:06bradfordhow would I define such a function?
15:07stuhoodprobably exactly like that, but use the 'apply' function
15:07stuhood(defn both [p q [args]] ((apply p args) (apply q args)))
15:08hiredmanwell
15:08Chousuke,(let [both (fn [p q & args] [(apply p args) (apply q args)])] (both + - 1 2 3))
15:08clojurebot[6 -4]
15:22dnolenis it possible to go over anjava Enumeration in Clojure with a seq?
15:22stuartsierrayes: enumeration-seq
15:22dnolenclojure is awesome :)
15:23Chouseryes: awesome
16:49akingSo I've got Clojure working on the BeagleBoard.. any decent micro-benchmarks to see what kind of speed difference it is?
16:50akingDid a quick fib test - was surprised to see it at 0.7ms vs 0.073ms
16:50akingmuch faster than I was expecting
16:51hiredmanwhat jvm?
16:52akingCacao
16:52akingv0.99.4
16:52hiredmanbeagleboard, interesting
16:53mollieive never heard of it before, looks cool
16:53hiredmanthe building appliances is very interesting
16:53digash~seen rhickey
16:53clojurebotrhickey was last seen joining #clojure, 40 minutes ago
16:54akingMainly got the beagleboard for its support of OpenGLES 2.0 - should be fun contorling that from Clojure
16:54hiredmanaking: you should try the code from http://clojure.org/refs
16:54akinggood idea - trying some stuff now
16:55hiredmanor http://clojure.org/concurrent_programming
16:56hiredmanI was thinking I'd like to make some sort of dashboard for the office, with clojure of course
16:56digashi have a proposal for partition improvement http://gist.github.com/109002, how do i submit it?
16:56hiredmanmostly just to display the weather
16:57mollieim interested in hci, this looks promising
16:57hiredmandigash: submit a CA then send something to the google group
16:58digashhiredman: CA done. will submit to the googlegroup, thanks.
17:01hiredmanaking: what are you using the bb for?
17:02akinghiredman: for the ogl shaders - something to test some game code I writing
17:03hiredmanOh
17:03hiredmaninteresting
17:03hiredmanso graphics performance is ok?
17:03akinghiredman: It's also my day job - clojure is a nice break from the low level C stuff I have to write
17:04akinghiredman: not sure yet - been getting the environment setup for the last few days.
17:04mollieare there any decent java 3d engines?
17:04hiredman~sophia
17:04clojurebotTitim gan �ir� ort.
17:04hiredman~sopha
17:04clojurebotI don't understand.
17:04hiredmanbah
17:05hiredmanmollie: jmonkeyengine is one
17:05akingjmonkey is suppose to be good
17:12rhickeydigash: are you proposing changing the behavior of partition when last segment not aligned? or only wen padding supplied?
17:12rhickeywhen
17:13hiredman1.0 is out, break everything!
17:13stuhoodjump straight to 2.0!
17:13rhickeyanything break with 1366?
17:14digashonly when padding suplied
17:14digashrhickey: not a breaking change
17:15rhickeydigash: I see, that looks like a good way to handle it
17:15digashrhickey: i went through about ten versions, before i got to this one.
17:15stuhood~def partition
17:17hiredmannothing seems to be broken
17:18slashus2Is "use" going to be changed into a macro as well?
17:19technomancyit does seem to be a common source of confusion how different the ns macro's "use" is from regular use
17:20slashus2right
17:20Chouserns's :use just calls the 'use' function. How is it different?
17:20technomancyChouser: just the quoting
17:20Chouserah
17:20technomancyit's not a big deal, but people just starting out get confused
17:23akinghiredman: yup - all those ref tests seem to run fine. Though cacao seeems to get bogged down in gc for large loops
17:23akingbut it's jit seems fine with more normal use
17:23hiredmanhmmm
17:24hiredmanmust be higher then normal java object churn
17:24digashrhickey: just realized that when-let is not really needed so changed it to when http://gist.github.com/109002
17:25akingI'll also have to give it a try against jamvm as well - it might perform better.. dunno
17:25hiredmanhow much of a pain is it to set up?
17:27rhickeydigash: 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:27hiredmanlike 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:27akingIf 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:27hiredman:(
17:27akingyou can download it - I'll probably start putting my image up somewhere - I haven't seen any with java preinstalled
17:29hiredmanhmmm
17:31digashrhickey: i had a version like that, but the implementation was more complicated
17:33rhickeydigash: well, the implementation without the pad is already there, could just add your new code for new arity
17:33digashrhickey: sure, that is how I started and then collapsed the two using nil, since they were almost identical
17:33rhickeybut 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:34digashrhickey: let me dig out my other implementation.
17:34rhickeyok
17:35rhickeydigash: steve makes a good point too: http://groups.google.com/group/clojure/msg/a45f6f0bb1323f32
17:38digashrhickey: yep, makes sense
17:38ChouserI've used concat, which doesn't seem too bad when I've got a couple (or more) things to pad.
17:39Chouser(partition 3 (concat [1 2 3 4] [0 0]))
17:39Chouserwhere it starts to feel silly is when I've only got a single extra, and I just want nils
17:40Chouser(partition 2 (concat [1 2 3] [nil]))
17:41digashit work if you know how many are hanging at the end.
17:41rhickeyI think the repeat case is the strongest
17:41rhickeywill use only as much as needed to make last segment
17:42digashor cycle
17:42rhickeydigash: right
17:43Chouserit would seem a bit awkward to put a thing that gets appended before the thing it's appending to, wouldn't it?
17:43rhickeyMathematica has a mode that loops, I always found weird and not useful for me
17:44digashyes, I was inspired by mathematica but i thing with cycle and repeat most of them could be easily done.
17:45digashexcept {-1, 1} thing which I only used in cellular automata on the cycle background.
17:46V-ille2rhickey: any plans to support JSR-223 aka javax.script in clojure?
17:46rhickeyChouser: 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:47rhickeyV-ille2: I'm not opposed, but not something I'm personally going to take on
17:50rhickeydigash: when you are ready, remember I can't take a contribution from github - attach to issue
17:50rhickeybbl
17:52technomancyis clojure.core/stream? something that leaked in from the streams branch?
17:52digashrhickey: will clean it up with all the suggestions and attach to an issue.
17:53V-ille2rhickey: 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:58technomancydanlarkin: do you think it would make sense for http.client/request to accept an InputStream as a body?
17:59hiredmanyes
17:59technomancyand then just copy bytes from it to the connection's OutputStream
17:59danlarkintechnomancy: yeah
17:59danlarkinmaybe it should use contrib.duckstreams and just take anything that it can use
18:00technomancydanlarkin: how about this? http://p.hagelb.org/http-client-send-body.html
18:02danlarkinhaha, I love this: (spit out body)
18:03technomancy(repeatedly (chew body))
18:03hiredmanvaguely sinister
18:03technomancy;; nom.nom.nom
18:05danlarkintechnomancy: check out clojure.contrib.duck-streams/slurp*
18:06danlarkinand the reader definition for an InputStream
18:07technomancydanlarkin: I think I want to send it straight to the output rather than buffering it in a string builder though.
18:08danlarkinwhat for?
18:08technomancyso it works for bodies of any size without ballooning memory usage
18:11danlarkinmmmmhm
18:11danlarkinthat's valid
18:11technomancyseems duck-streams could do with a "copy between streams" function
18:12danlarkintechnomancy: agreed
18:12clojurebottechnomancy is to blame for all failures
18:12technomancyoh snap!
18:12danlarkinclojurebot: seconded!
18:12clojurebotNo entiendo
18:12hiredmanzing!
18:12hiredmanthats what you get for spacing out at the library
18:13technomancyI moved to a coffee shop, actually.
18:13hiredmanoh, alright then
18:21technomancydanlarkin: do you need to close the OutputStream before you can read from the InputStream?
18:22danlarkinI do not know
18:22hiredmanyes
18:22hiredman.flush might be enough, or you might need to .close it
18:23technomancythanks
18:23hiredmanbut I remember having all kinds of trouble with posting to twitter because of this
18:25gcvany clojure-swank experts here?
18:30technomancygcv: I think there's only one clojure-swank expert in existence: the guy who wrote it.
18:30technomancyand he... doesn't seem to be around any more
18:31technomancybut you can ask your question
18:33gcvI 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:33gcvit seems to work fine with clojure.jar or something else which embeds sources in a jar file, but not in a directory directly
18:34technomancyhmm... works for me with M-x slime-project
18:34technomancyhttp://p.hagelb.org/slime-project.html
18:35gcvtechnomancy: ah, that's promising
18:35gcvtechnomancy: thanks, I'll try to see if I can match my custom slime setup to what works here
18:35technomancygcv: that's assuming you use clojure-pom and mvn process-resources to unpack in target/dependency
18:36technomancywhich is a great way to go if you've got complicated dependencies, but may not be your cuppa for simple projects
18:40gcvtechnomancy: 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:40technomancygcv: 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:41technomancyusing clojure-pom pretty much takes the pain away though since you've only got to write 5 lines of XML or so.
18:41technomancyof course, writing three lines of clojure would be preferrable. =)
18:42gcvamen to that
18:53technomancydanlarkin: about to commit body stream support
18:53technomancyI added connection pooling/keepalive support to the TODO; anything else that belongs there?
18:55danlarkintechnomancy: sweet, I'm gonna use it later tonight :)
18:57technomancypush'd
19:17ataggartanyone know how I can stop a runaway recursion in the slime repl? other than waiting for the stack to blow
19:18bradfordanyone notice with-open behaving incorrectly?
19:18Carkataggart:kill the buffer
19:18ctdeanIn the top level thread? C-c C-c
19:18bradfordI am getting "No matching field found: close for class com.rabbitmq.client.impl.AMQConnection"
19:19Carkah slime, different beast ... using vanilla clojure-mode here
19:19bradfordseels like with-open is trying to call a field close rather than a method?
19:19danlarkintechnomancy: I have been writing a couchdb api, halfassedly so far
19:19ctdeanOtherwise, I think you're SOL. You'll need to find the Thread and kill it. easier just to exit slime. ,sayonarra
19:20ctdean* misspelled
19:20ataggartalas, I know how to do none of that. Though C-c C-c worked
19:20ataggart<-- emacs noob
19:20ctdeanlol, yep
19:21ctdeanYou can enter comma commands in slime. Do you know about those?
19:21technomancydanlarkin: I started playing around with that... Couch is so close to HTTP itself that very little is needed to wrap it.
19:22danlarkintechnomancy: indeed, makes it an easy target :)
19:22technomancywould be great to have as an example of how http.client works though.
19:22ataggart@ctdean: nope. I haven't yet figured out how to distinguish slime from emacs
19:24ctdeanIf you're at the beginning of a prompt in slime repl, you can type , There are shortcut commands availble.
19:25technomancyctdean: did not know that; thanks
19:26ctdeansure thing. ", quit" and ", in" are what I mostly use
19:26ataggartI 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:27technomancygrey out all the clojure internal lines
19:27ataggartwhich one is the "slime repl"?
19:27technomancyallow hyperlinking
19:27danlarkintechnomancy: yeah helps me find missing features :)
19:28ctdeanthe slime repl is the one showing the clojure repl
19:28ataggart(user=> , quit
19:28ataggart, quit
19:28clojurebotjava.lang.Exception: Unable to resolve symbol: quit in this context
19:28ataggartjava.lang.Exception: Unable to resolve symbol: quit in this context (NO_SOURCE_FILE:0)
19:29ataggartso typing ". quit" in the clojure repl didn't work
19:29ctdeanIf 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:29ataggartwhat's the right spot?
19:29technomancyataggart: are you in *inferior-lisp* then?
19:29ctdeanAh.
19:29ctdeanYes, the buffer is named *slime-repl XYZ*
19:30ctdeanwhere XYZ is probably "nil"
19:30ataggartThe top half of my screen shows the code, the bottom half shows the repl and allong the bottom it says "*inferior-lisp*"
19:30danlarkintechnomancy: 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:30technomancyataggart: your slime is probably not configured to use the repl module
19:31ataggartlovely
19:31technomancydanlarkin: yeah, that's odd
19:31ctdeanWow, didn't know that was possible.
19:31technomancyctdean: they moved the repl module into contrib; it's not loaded by default anymore. =\
19:31ataggartwell I cobbled this setup from about a dozen different, partially working "tutorials"
19:31ctdeanRight, I recall all that now.
19:32technomancyataggart: the easiest way to get going is to use M-x clojure-install from a recent clojure-mode.el
19:32technomancyall this rummaging around in outdated tutorials is not necessary
19:32ataggartI have no idea what most of that means
19:33technomancyataggart: 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:33technomancyonly like 2 lines of configuration required.
19:33ctdeanYou can also look at http://gist.github.com/109057 for what I do
19:33ataggart"if you have clojure-mode.el installed in your Emacs directory" I do'nt follow this
19:33ataggartI downloaded Aquamacs
19:33ataggartand then the slime thing
19:34technomancyhrm... I don't know how it works with aquamacs slime
19:34ataggartwhat I wouldn't give for a damn eclipse plugin
19:35ctdeanYes, the emacs learning curve is steep. and slime is not the easiest thing to start with
19:35technomancyctdean: slime is pretty straightforward actually
19:35technomancywith 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:36ataggartbut I like writing code with more UI than a commandline
19:36ctdeanMaybe just for clojure, I don't know about that. But using the base slime and even just one CL is a tricky
19:36technomancyctdean: true, that gets wacky
19:37ataggarthow anyone can write a lot of code quickly in a terminal window is beyond me.
19:37technomancyataggart: it helps if you quit using the mouse
19:37technomancybloody rodent just slows you down
19:37ataggartmaybe for those of you who can touch-type
19:37ctdeanatm, I'm supporting multiple users with 4 (count 'em 4!) different lisps
19:37technomancyunfortunately aquamacs encourages use of the mouse. =\
19:38ataggartnot really. I can't figure out what good this bloody UI is doing
19:38ataggartI can't drag the partitions around or anything
19:38ataggartI've been interested in clojure since last summer
19:38ataggartand I just can't get around to ever writing any
19:39ataggartI keep having to fight the tools
19:40ataggartoh well, maybe in another year
19:41emacsenI love Emacs, but if you had to choose a nice cross platform clj editor and repl tool, what would you choose?
19:41ctdeanI 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:42emacsenctdean: come on dude, I just said "I love emacs but..."
19:42emacsenThis is "I'm trying to show Clojure to others, and I don't want to impose emacs on them"
19:42technomancyctdean: what languages?
19:42Carkataggart : there is a netbean plugin also
19:43ctdeanLisps. Scheme mostly, but CL too.
19:45technomancyctdean: there's a reason they call scheme minimalist I guess. =)
19:46ctdeanmember:technomancy: yep. I spent many years in Scheme and I do miss the simplicity sometimes.
19:46ctdeanok, I'm an irc dummy :(
19:50emacsenctdean, what do you miss?
19:51ctdeanI 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:52technomancydesign-by-committee.
19:53emacsenctdean, right, I guess I'm asking what you miss in Scheme vs Clojure
19:53ctdeanRight. I get that and I like CL a whole bunch. It's just the reality of the project.
19:54emacsenscheme has a few things clj doesn't have but none of them are big deals IMHO
19:54ctdeanClojure seems super great, but I don't know enough to really compare Scheme vs. Clojure
19:54emacsencontinuations, hygenic macros, and something else... something more obscure
19:55ctdeanThe only things I do miss are necessary design constraints: named let (TCO) is a big one
19:55emacsenTCO, that's it :)
19:55emacsenbleh... I mean do recur gets you pretty close and it's actually explicit
19:56ctdeanI'll be a heretic: I actually like defmacro better
19:56emacsendoes the clj regex builtin have a substitution mechanism?
19:56ctdeanThere is one in contrib
19:58ctdean,(doc re-sub)
19:58clojurebotjava.lang.Exception: Unable to resolve var: re-sub in this context
19:58emacsenI don't see an easy way to search all the docs
19:58ctdeanit's in str-utils
19:59ctdeanand re-gsub
19:59emacsenthx
19:59ctdeanI find the docs difficult to navigate. not sure why.
19:59emacsenthere isn't a searching function is there
20:01technomancy~ find-doc
20:01clojurebotNo entiendo
20:01technomancy~find-doc
20:01clojurebotPardon?
20:01technomancy...
20:01ataggartclojurebot is a smartass
20:06ctdeanIs there something like *load-pathname* in clojure?
20:12emacsenis there a reference doc somewhere on the regex syntax clojure uses? eg "all digits" -> \d
20:12ctdeanIt's the Java one
20:12emacsenor does it just use the java one
20:12ctdeanSo the java docs
20:12emacsenah :)
20:30dreishSeems like circular (use)s should throw some of helpful error.
20:30dreishsome kind of
21:08danlarkindreish: agreed, it also would be nice if they didn't cause an error at all :)
21:21dreishWell, 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:29danlarkindreish: I mean I wish it worked
21:29dreishI'm not sure what would be the right thing to do, other than just throw an error.
21:29dreishIf A requires B, but B requires A, neither one can be compiled.
21:30danlarkinthere's gotta be something
21:31danlarkinit 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:31danlarkinI understand the reasons, I just think there's gotta be a way
21:31dreishI don't see how it would be valid if it were in one file.
21:32dreishOne half of the file has to come before the other half. They can't both come first.
21:32danlarkinbecause you can use things like (declare foo)
21:32dreishRight ...
21:32dreishSo maybe have a .h file, plus a .c file?
21:33dreishWait, wrong language.
21:33danlarkin:) Never say never
21:34danlarkinnot about header files I mean, but circular dependency detection /can/ be done
21:34dreishSure, that seems like it should be easy.
21:34dreishEasy 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:35danlarkinif it were easy it'd be done already
21:51emacsenso, anyone have a particular non-emacs Clojure IDE they like?
21:52dreishI don't think so. Everyone loves emacsen.
21:52emacsendreish, me too, but I dunno if I want to show clj in only emacs
21:52erohtaris there a way to redefine functions from core?
21:53danlarkinemacsen: there's a large vi contingent, but not sure that counts as an "IDE", but then again, maybe emacs doesn't either
21:53dreishWas 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:54dreisherohtar: In a pinch, you can always switch to the core ns, redefine your function, and get out.
21:54erohtardreish: thanks
21:54dreishI 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:55erohtarno, just redefining if enuff for my purposes
21:58danlarkinerohtar: you can also use binding
21:59erohtardanlarkin: true - i just tried it, and for some reason, i thought you couldn't redefine stuff from core
21:59erohtardanlarkin: are there any special restrictions on what u can do with stuff in core?
22:00danlarkinno
22:00danlarkinnot that I can think of
22:00erohtarok great
22:00erohtari didnt think there would be, but i guess i was tired when i tried this earlier
22:00danlarkinkeep in mind that if you rebind something like =, you'll mess up tons 'o stuff
22:00erohtaryes...
22:00dreishOr make it much more awesome!
22:01erohtari wanted to disable a couple of things inside the scope executing something
22:02erohtarspecifically, all clojure support for state
22:02erohtarso things like ref, etc.