#clojure log - Apr 13 2009

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

0:27 joha1: no updates of ClojureCLR in clojure-contrib since late February. Is the project dead, resting, or pining for the fjords? (or perhaps hosted somewhere else?)

0:36 kadaver: figured a really dead simple way to compile haskell to java (each function into a class) but it's basically interpretation.. not sure how to do better

0:37 does clojrue do that?

0:41 durka42: do which?

0:41 clojure source is compiled to bytecode

2:17 kadaver: durka42: ok but is there an intermediate step which turn clojrue code into java classes?

2:19 durka42: well, the bytecode encodes java classes

2:19 there is no intermediate step with java source code, if that's what you mean

2:20 kadaver: i dont mean .class files, i mean class FunctionFoo {...}

2:21 but ok

2:21 so any info on how? a namespace is what really, a static class with functions as methods?

2:22 Raynes: kadaver: You've earned first prize for most misspellings of 'Clojure'.

2:22 * Raynes tosses kadaver his metal.

2:23 hiredman: kadaver: no

2:24 ~def c.l.Compiler

2:24 functions are themselves objects

2:24 ,(class (fn [] ))

2:24 clojurebot: sandbox$eval__2839$fn__2841

2:31 DTrejo: Hey guys, I come from an eclipse and java background; what do you suggest I start learning clojure on? (what ide/setup?)

2:32 hiredman: whatever you are most comfortable with, that being said, there is a large emacs following

2:32 I personally use vim

2:32 durka42: does clojure-dev work?

2:32 hiredman: no idea

2:32 durka42: the eclipse plugin

2:32 http://code.google.com/p/clojure-dev/

2:33 DTrejo: I've installed it, played around a bit

2:33 kadaver: DTrejo: lisp+emacs works very well together, that said you can run a repl in eclispe too so if you are more comfortable with that...

2:33 hiredman: clojurebot: clojure-dev is the eclipse plugin http://code.google.com/p/clojure-dev/

2:33 clojurebot: Alles klar

2:33 kadaver: ah

2:34 durka42: ~eclipse

2:34 clojurebot: I don't understand.

2:34 DTrejo: has anyone tried out multiple configs/ides/editors? which is the most well developed?

2:34 err, best user experience

2:35 hiredman: well, vim, obviously :P

2:35 DTrejo: (:))

2:35 durka42: ;)

2:35 DTrejo: I'll look into it

2:35 the link is on the clojure site? for the vim config file or whatever

2:35 Raynes: DTrejo: I use Enclojure with NetBeans 6.5.

2:36 DTrejo: how is that raynes?

2:36 how do you like it

2:36 Raynes: I love it, it works fine for my needs. It's a bit buggy, but everything is being worked out. Clojure-dev would be okay if it weren't for the crappy indentation.

2:36 I hear that will be fixed soon as well.

2:36 DTrejo: mm

2:37 hiredman is the situation similar for cloj on vim?

2:38 Raynes: I'd have to say the best possible editor to use for Clojure is Emacs, but if you don't want to go through setting it up and stuff then use Enclojure or La Clojure. I for one, don't feel like setting up Emacs so I use Enclojure. I hear VimClojure is good as well.

2:38 hiredman: I don't think I am person to ask

2:38 I don't go in for much besides syntax highlighting

2:38 vimclojure's repl is nice, when I get it to work

2:38 DTrejo: k

2:39 hiredman: are you on windows?

2:39 DTrejo: yes, xp

2:39 hiredman: you might look at clojure in a box

2:39 DTrejo: I have the same emecs setup shyness

2:39 hiredman: which is something that installs clojure+emacs

2:39 DTrejo: nice

2:39 that looks so easy :)

2:40 have you tried it Raynes ?

2:40 Raynes: DTrejo: Nope.

2:41 I'm a NetBeans man. (:

2:41 Plus if I don't test for Eric he never seems to get Windows specific bug reports. I'm one of the few Vista users around these parts :\

2:42 DTrejo: mm

2:43 the guy who put together clojure box needs to host it on some faster server

2:43 err host it on some filehost

2:43 Raynes: ,(println "Welcome to the wonderful world of Clojure DTrejo :)")

2:43 clojurebot: Welcome to the wonderful world of Clojure DTrejo :)

2:45 DTrejo: ,(+ 60 9)

2:45 clojurebot: 69

2:46 Raynes: DTrejo: clojurebot is hiredman's work. hiredman is my hero <3

2:46 DTrejo: I was thinking: wow hiredman knows how to use the bot

2:46 cool project

2:49 loving clojure box :)

2:49 thanks for the recommendation

2:58 ~eclipse

2:58 clojurebot: Huh?

3:01 Raynes: It seems even the people who /use/ Scala don't seem to like it very much.

3:02 DTrejo: http://code.google.com/p/clojure-dev/

3:04 DTrejo: Raynes yes I tried that. That's too bad about scala

3:04 I know a guy who likes it tho

3:05 Raynes: DTrejo: It's just odd, when I see the enthusiasm people have about Clojure, and then look at what the Scala community is saying, it's as dull as it gets.

3:05 DTrejo: Raynes ohh you're saying they aren't in love with clojure

3:05 I misunderstood

3:06 well, its cus they already have a substitute I'd say

3:06 it steals their thunder

3:06 Raynes: DTrejo: No, you understood. They aren't enthusiastic about Scala the way Clojure users are enthusiastic about Clojure

3:08 zakwilson: That's sad. I'm thinking maybe I should take that as a sign to not bother with Scala.

3:09 DTrejo: oh, ok

3:09 Raynes: zakwilson: I'm trying to learn Clojure, but when I hear stuff like that about it, it really takes away my motivation. :| Maybe I should just learn Smalltalk for object orientation. :\

3:09 DTrejo: glad you clarified

3:09 Raynes: Scala*

3:09 I can't type tonight. :|

3:09 DTrejo: now everythings all mixed up hehe :)

3:09 how is smalltalk? I don't hear much about it

3:10 I mean the community

3:10 zakwilson: I suppose it depends on why you want to learn OO, or what you want to learn about it.

3:10 Raynes: DTrejo: I dunno. Pretty dead as far as I can tell.

3:11 zakwilson: Though I had some exposure to C++ and such, the first object system I really *used* was CLOS.

3:11 DTrejo: too bad

3:11 Raynes: zakwilson: Because I'll never get very far without decent knowledge of object orientation. But I really... Really don't want to learn Java or C#.

3:11 DTrejo: zakwilson: I wish lisp had been my first language, like a buddy of mine - he took it for 4 years in HS

3:12 zakwilson: Raynes: Well, I'm not sure about not getting very far... the basic concepts are simple enough.

3:12 DTrejo: and had a hardass funciontional fanatic teacher

3:12 zakwilson: Lisp wasn't my first language, but it's the first language I did non-trivial OO in.

3:13 DTrejo: Ideally I want to know clojure, python, maybe R/ROR. (already decent in java)

3:14 Raynes: I could learn Python, it has some object orientation.

3:14 :|

3:14 DTrejo: mostly I just need to get out there and code, starting this summer when things open up

3:14 Raynes why that face?

3:14 zakwilson: Raynes: you may want to make an object system, or study one implemented in the language from which it is used.

3:15 I think somebody made one for Clojure

3:17 DTrejo: what languages do you know right now Raynes ?

3:17 Raynes: DTrejo: Clojure, some Haskell, and enough Java to know a little about object orientation.

3:18 DTrejo: I thought cloj had some OO

3:18 zakwilson: Wow... good choices!

3:18 It has some OO-like things, but they don't work in the traditional way.

3:18 Traditional being Smalltalk/Ruby/Python/Java-like

3:19 DTrejo: i think clof is more 100yr than arc

3:19 cloj*

3:20 opinions?

3:20 zakwilson: I think Arc has not been developed enough to tell.

3:20 DTrejo: mm

3:20 yes

3:20 Raynes: DTrejo: Arc could probably be good, but Paul Graham will end up dying of old age before he gets 0.0.4 out :\

3:20 zakwilson: Clojure feels like a great language for the next decade, and it probably has a lot of what a 100 year language will have.

3:21 Arc feels really unfinished. I'm sure revision 3 of Clojure did too.

3:22 DTrejo: I think clojure is going to do well just because it has a great pursuasive website. Really is open about the nature of itself

3:23 and the community of cours

3:23 Raynes I agree

3:23 zakwilson: It convinced me to use the JVM. That's impressive pursuasion right there.

3:23 DTrejo: :)

3:24 Raynes: http://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it Get your thoughts in before it's closed.

3:25 DTrejo: (I don't have anything to say)

3:25 leafw: s/pursuasive/persuasive

3:25 (hurts my eyes :)

3:26 DTrejo: I don't understand the slashes, what does that mean?

3:26 [sic] ?

3:27 zakwilson: My only attempt at using stack overflow didn't impress me.

3:27 Raynes: DTrejo: It's a regex s/replacethis/withthis/

3:28 zakwilson: http://stackoverflow.com/questions/513523/what-language-features-can-you-live-without-closed

3:31 leafw: DTrejo: in vi editor, it means "substitute first expr. by second expr."

3:31 DTrejo: ah

3:31 now I know more

3:31 leafw: DTrejo: in skype, it fixes typos in previous lines as well.

3:34 DTrejo: oh dang

3:34 s/dang/dangg

3:34 aw it doesn't work here

3:34 leafw: no, IRC is a different beast.

3:38 Raynes: DTrejo: Though it doesn't work in IRC, users use it as symbolism to correct their previous messages.

3:40 zakwilson: I have not seen any signs of that actually altering a conversation in skype.

3:40 Raynes: http://xkcd.com/528/

3:49 leafw: zakwilson: AFAIK only works in macosx skype.

3:49 zakwilson: leafw: that would explain it.

3:50 DTrejo: so it updates other people's screens too?

3:52 leafw: I think so.

3:52 very orwellian.

3:54 DTrejo: mm, another reason for me to get a mac

3:54 haha

4:01 Raynes: http://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it/743285#743285

4:01 The man has a point.

4:05 leafw: yes: clojure is the first JVM language that attracted people per se, not by the need of avoiding the horror of writing java code.

4:08 zakwilson: leafw: agree - I might never have used the JVM without Clojure.

4:16 leafw: with our fiji setup, one isn't even aware of the JVM at all ... I can launch clojure with all jars in classpath just with ./fiji --clojure

4:17 ( http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting )

6:00 joha1: I'm translating Java code with the "instanceof" operator. How can I express this in Clojure? (.instanceOf ...) didn't work

6:02 nor (.instanceof ...)

6:07 antifuchs: (isa? (class object) TheDesiredClass) ; wfm

6:07 joha1: aha, (instance? <class> <obj>) seems to work

6:08 antifuchs: oh, heh. looks like I should rewrite some of my code, then (:

6:08 thanks, joha1 (:

6:08 joha1: np

6:15 Raynes: joha1: There is also instance?

6:15 ,(instance? Integer 3)

6:15 clojurebot: true

6:16 joha1: yes, I just found instance? in the API doc

6:17 Raynes: And class?

6:17 Which is less useful, but still. :)

7:32 yason: How to extract the local name out of a fully qualified symbol?

7:36 leafw: ,(doc name)

7:36 clojurebot: "([x]); Returns the name String of a symbol or keyword."

7:36 leafw: yason: I guess that answers it.

7:40 mihand: hey guys. do next and rest differ only in how they handle empty seqs?

7:41 leafw: mihand: no.

7:41 mihand: in core they seem to have runtime support

7:41 leafw: mihand: rest is eager, I think.

7:43 mihand: did rest change recently? because i have the feeling that in the screencasts it returned nil

7:43 durka42: yes

7:44 rest changed with the introduction of lazy sequences

7:44 you should now use next instead, unless you are writing a lazy seq

7:45 leafw: mihand: it changes about 2 months ago or so

7:45 mihand: thanks

7:51 * Raynes hugs durka42

7:51 * durka42 appreciates it but needs his arms free to type this paper

8:47 powr-toc: Hey... I was wondering, is there an idiomatic clojure way to wrap an object into a seq-able abstraction?

8:48 assuming I have a java object that's similar to an Iterator

8:50 I've seen there is iterator-seq... the problem is I don't have an iterator

8:50 or rather, the object doesn't implement Iterator directly

8:55 Ok, just looking at re-seq's implementation... looks like the pattern is to use lazy-seq to build a sequence out of consing iterations together...

8:59 yason: leafw: yes, thanks! exactly what I was looking for

10:54 StartsWithK: fyuryu: hi, your the author of cloak?

12:22 fyuryu: StartsWithK: hi, yes

12:23 StartsWithK: hi again :)

12:23 whats the state of cloak?

12:23 i looked at it, last update was 2 months ago

12:24 it looks good, i would like to use it to replace someting like 40-60 ant builds, they are all small script and call external programs like jar or ant, svn..

12:25 is this kind of thing you had in mind for cloak?

12:25 fyuryu: StartsWithK: needs an update, some of the code that I've written for it is now in contrib

12:25 StartsWithK: can it be usead as library?

12:25 gnuvince_: What's cloak?

12:26 hiredman: "simple automation tool inspired by rake, written in Clojure"

12:26 fyuryu: StartsWithK: are you familiar with rake?

12:26 StartsWithK: any plans for, lets say that rm could be more sensitive to content, like if do rm in svn project, it uses svn remove

12:26 fyuryu: to some extent, i used buildr

12:26 and rake is just a thing i would like to use, light, simple..

12:27 or things like (cp ["%s/text.file" root-dir] ["%s/dest.file" dest-dir])

12:27 fyuryu: StartsWithK: the idea was to automate calling external commands

12:28 and have some Clojure/Java specific bonuses (eq. compiling)

12:28 StartsWithK: so you have a CA signed?

12:29 fyuryu: StartsWithK: yes, I sent one, but don't know if Rich got it

12:30 StartsWithK: it is also possible to use cloak with Lancet - that gives you access to all the ant tasks

12:30 and there are a lot of them

12:31 StartsWithK: well my build is ant, i would like to use just cloack, looked at lancet and skipped it

12:31 cloak*

12:32 fyuryu: one thing that Lancet doesn't have is resolving circular dependencies

12:32 StartsWithK: also, i see for now only one problem

12:32 it has no build system

12:32 in ant

12:33 Drakeson: Do you have a snippet to put in user.clj that `use's all utilities in contrib, as their name? conceptually: (doseq [x *clojure-contrib-libraries*] (use '[clojure.contrib.x as x]))

12:33 StartsWithK: i would need something like that so i cn bootstrap my build

12:33 would you accept such a patch?

12:33 fyuryu: StartsWithK: you mean an build.xml to compile cloak?

12:33 StartsWithK: yes

12:33 lisppaste8: lethe pasted "xml-zip filtering" at http://paste.lisp.org/display/78492

12:34 lethe: Why does xml1-> in ^ seem to return a function and not the location?

12:35 fyuryu: StartsWithK: yeah, I was supposed to write that, but since I hava a special script with CLASSPATH for cloak set, I forgot about it

12:35 StartsWithK: but sure, a patch would be nice :-)

12:36 StartsWithK: fyuryu: ok, i'll find you in couple of days when i sort cloak intergation with my build

12:36 thanks for replays

12:36 fyuryu: StartsWithK: will you be doing any Clojure code compilation from cloak?

12:37 StartsWithK: fyuryu: only calling of ant thro shell

12:37 some jar manipulations and svn git hg checkouts

12:38 fyuryu: StartsWithK: ah, ok. Just wanted to be sure you are aware abt. the standard CLASSPATH pains

12:38 StartsWithK: will it run ok if i call multiple cloak files (separate processes) from inside ant <parallel> task?

12:40 powr-toc: Is there a reason why (seq? []) returns false?

12:40 fyuryu: StartsWithK: it should, unless you're going to try to access the same resources from different processes

12:40 powr-toc: I thought vectors were sequences

12:40 fyuryu: StartsWithK: etc

12:40 dakrone_hb: ,(seq? [])

12:40 clojurebot: false

12:40 powr-toc: ,(seq? ())

12:40 clojurebot: true

12:41 StartsWithK: fyuryu: thanks

12:41 gnuvince_: powr-toc: it implementes the sequence interface

12:41 hiredman: vectors are not seqs

12:41 gnuvince_: ,(iseq? [])

12:41 clojurebot: java.lang.Exception: Unable to resolve symbol: iseq? in this context

12:41 fyuryu: StartsWithK: you're welcome

12:41 hiredman: ,(seq? (seq []))

12:41 clojurebot: false

12:41 hiredman: well

12:41 ,(seq? (seq [1]))

12:41 clojurebot: true

12:41 dakrone_hb: ,(list? [])

12:41 clojurebot: false

12:42 hiredman: a seq is a view over a collection

12:42 dakrone_hb: ,(set? [])

12:42 clojurebot: false

12:42 dakrone_hb: ,(vector? [])

12:42 clojurebot: true

12:42 powr-toc: hiredman: Then is there a common (testable) abstraction across vectors, lists and hashmaps?

12:43 hiredman: yeah

12:43 ,(ancestors (class []))

12:43 clojurebot: #{clojure.lang.IPersistentStack clojure.lang.Seqable java.util.RandomAccess clojure.lang.Counted clojure.lang.Sequential java.util.List clojure.lang.IPersistentVector clojure.lang.IFn clojure.lang.Associative java.lang.Runnable clojure.lang.IObj java.util.Collection java.io.Serializable clojure.lang.IPersistentCollection clojure.lang.Reversible clojure.lang.IMeta java.util.concurrent.Callable clojure.lang.Streamable java.

12:44 hiredman: ,(ancestors (class {}))

12:44 clojurebot: #{clojure.lang.Seqable clojure.lang.Counted java.util.Map clojure.lang.IFn clojure.lang.Associative java.lang.Runnable clojure.lang.IObj java.io.Serializable clojure.lang.IPersistentCollection clojure.lang.IMeta java.util.concurrent.Callable java.lang.Iterable clojure.lang.IPersistentMap java.lang.Object clojure.lang.Obj clojure.lang.APersistentMap clojure.lang.AFn}

12:44 hiredman: actully

12:44 I think you should just use coll?

12:44 dakrone_hb: ,(seqable? [])

12:44 clojurebot: java.lang.Exception: Unable to resolve symbol: seqable? in this context

12:44 hiredman: ,(coll? [])

12:44 clojurebot: true

12:45 hiredman: ,(coll? (java.util.ArrayList.))

12:45 clojurebot: false

12:45 hiredman: erm

12:45 ,(doc coll?)

12:45 clojurebot: "([x]); Returns true if x implements IPersistentCollection"

12:45 hiredman: I see

12:45 powr-toc: hiredman: cheers... that's exactly what I'm after

12:46 hiredman: (instance? java.util.Collection [])

12:46 ,(instance? java.util.Collection [])

12:46 clojurebot: true

12:46 hiredman: even more general

12:46 and seq works on most (all?) Collections

12:46 ,(seq (java.util.ArrayList. [1 2]))

12:46 clojurebot: (1 2)

12:47 hiredman: I kind of assumed coll? was a test for java.util.Collections

12:49 ,(seq (java.util.HashMap. {:a 1}))

12:49 clojurebot: (#<Entry :a=1>)

12:49 hiredman: ,(first (first (seq (java.util.HashMap. {:a 1}))))

12:49 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry

12:50 hiredman: ,(seq (first (seq (java.util.HashMap. {:a 1}))))

12:50 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry

12:50 hiredman: interesting

12:52 marklar: How do you type hint the Math.abs function? java.lang.Math/abs is showing a reflection warning

12:52 Chouser: marklar: it wants to know the type of the arg

12:53 marklar: Chouser: Ah, thanks

13:32 twansit: hmm.. can someone show me a example of using the 'update-in' function?

13:34 disregard ... got it.

13:35 hiredman: http://log.damog.net/2009/04/rubx-twitters-ruby-shell/

13:35 oooo

13:37 leafw: "her"

13:37 clever way to gather publicity.

13:37 * hiredman smells a new clojurebot feature

13:38 hiredman: I guess I'd better write a real twitter interface to start

13:43 cp2: heh

14:22 hiredman: I do feel slightly unmaned by the fact that every attempt (of mine) at translating a java twitter poster to clojure seems to result in 401's

14:24 technomancy: hiredman: running into API limits?

14:25 I'm trying to write a function to return the absolute filename of the caller. I tried using .getStackTrace on a new Throwable, but that doesn't give the full path, just the base name.

14:25 any ideas?

14:26 sorry, the absolute file name of the file containing the caller

14:26 hiredman: the caller of a function?

14:26 technomancy: yes

14:27 hiredman: hmmm

14:27 technomancy: this is what I've got that gives me the base name: (defn caller-file [] (.getFileName (second (.getStackTrace (Throwable.)))))

14:27 but StackTraceElement doesn't seem to have any other methods that deal with filenames

14:28 hiredman: r1349

14:29 that might help, if that information is then propagated in the stacktrace

14:29 technomancy: interesting; thanks

14:30 I get the feeling like it's trying to protect me from thinking about whether a file is source on disk or compiled in a jar or something, but in this case it's getting in the way.

14:30 Chouser: but vars and fns are very different things

14:33 technomancy: it's entirely possible the information you want is simply not stored anywhere that you can get to

14:34 technomancy: you can't redefine the problem at all? use a macro call instead of a function call, for example?

14:40 technomancy: oh, if I used a macro I would have access to *file*; is that right?

14:40 Chouser: *source-path* yeah

14:41 technomancy: thanks

14:42 hrm; *source-path* is a relative filename as well.

14:43 Chouser: yeah, just noticed that.

14:43 what are you using to load the file? 'require', 'load-file'?

14:43 technomancy: it'd be load-file since it's not on the classpath

14:44 Chouser: you were right: *file*

14:57 hiredman: google code is dead

15:02 leafw: hiredman: http://code.google.com/ ?

15:03 hiredman: leafw: requests for project pages like http://code.google.com/p/java-twitter/ are timing out

15:08 I really wish I could figure this twitter thing out

15:09 shelling out to curl is lame, and the code seems simple enough, every example I have seen is so similar that I can code it from memory

15:12 I wonder if it is a user-agent thing

15:15 pjstadig: what's up with code.google.com lately?

15:18 hiredman: weird

15:19 when I change my username I get two requests in the logs

15:48 java.io.IOException: Not enough storage is available to process this command

15:48 bah

17:40 technomancy: sets are unordered by default, right?

17:40 so conj'ing on to them could add the new value at any position?

17:41 gnuvince_: technomancy: hash-sets, yes.

17:41 technomancy: if *inventory* is a ref to a regular set, this seems to work: (str-join "\n " (conj @*inventory* "You are carrying:"))

17:42 but in this case it's working by coincidence, right?

17:42 there's no guarantee

17:44 * technomancy confirms in the repl

17:51 Chouser: technomancy: but use (seq @*inventory*) instead to get consistent results

17:59 technomancy: oh sure; that works. I think it's cleaner to put the message outside the str-join though.

18:25 Chouser: sure

18:29 powr-toc: Is there a clojure equivalent of Ruby's String#succ http://www.ruby-doc.org/core/classes/String.html#M000794

18:29 that'd turn a string of "abcd" into "abce"

18:34 Cark: powr-toc : have a look in tge java luibrary, i wouldn't bet on it though

18:35 powr-toc: Cark: it's nto

18:35 not

18:36 Cark: i wonder what's the use case =)

18:37 powr-toc: being able to generate sequential names

18:42 technomancy`: what's a good way to generate a filename that's based on a URL?

18:43 was thinking of either replacing all illegal-in-filename chars or just hashing it.

18:44 powr-toc: technomancy`: hashing it is probably the easiest way... but if you want them to be human readable then you have to replace chars

18:44 technomancy`: yeah, I don't think human-readability is important here

18:47 hrm; looks like to calculate SHA1 with Java you need to do it a byte at a time?

18:49 never mind

18:50 powr-toc: technomancy`: Yeah, I think so... Checkout Integer.toHexString though

18:51 lisppaste8: dnolen pasted "md5" at http://paste.lisp.org/display/78517

18:52 dnolen: perhaps someone might find this useful, I converted it from an example I found somewhere on the Internet, short and sweet.

18:52 technomancy`: thanks

18:52 powr-toc: dnolen: nice...

18:53 technomancy`: short for Java anyway. =)

18:54 dnolen: ;)

18:55 aperotte: hello everyone

19:11 technomancy`: I'm a little shaky on Java IO; how would you finish this snippet to write the contents of a URL to disk? (with-open [*in* (reader url) *out* (writer filename)] [...])

19:12 some kind of variation on this I guess? (while (not (eof? *in*)) (print (read-line)))

19:20 st3fan: is there a concept like Python's yield in Clojure?

19:28 Cark: stefan : we do loops from the outside with constructs like map and reduce

19:30 technomancy`: I'm trying to instantiate a CharBuffer for writing data to disk... what's wrong with this? (java.nio.CharBuffer. (make-array Character 1000))

19:31 Cark: isn't there an allocate static function on char buffers ?

19:31 technomancy`: ah, I didn't realize that's what it was for; thanks

19:33 oh... but writers don't work with CharBuffers.

19:35 silly me for assuming that readers and writers worked the same way.

19:35 Cark: but they should work with bytebuffers

19:35 so just wrap a bytebuffer around your charbuffer (i guess)

19:36 technomancy`: nope, the reader won't work with a byte buffer

19:37 there's got to be a better way to write the contents of a URL to disk

19:37 Cark: what are the classes of your writer and reader ?

19:37 technomancy`: I'm using duck-streams

19:38 maybe that's a mistake

19:38 Cark: why do you need a charbuffer then ?

19:39 technomancy`: because that's what my reader's .read method accepts

19:39 and I'm assuming read-line and println won't work with binary data

19:40 Cark: ah that's a binary file ?

19:40 technomancy`: well it could be

19:40 Cark: then you surely don't need a charbuffer =)

19:40 that's some kind of a file copy function ?

19:40 technomancy`: at this point I'm tempted to shell out to curl

19:40 because this should not be ten lines. =\

19:41 Cark: you need to use errr ...one second

19:42 fileinputstream and fileoutputstream for possibly binary data

19:42 technomancy`: thanks

19:42 java.net.URL could construct the input stream for me, right?

19:43 Cark: hum try passing that to the stream constructor

19:44 is that doesn't work, there might be some way to convert to a File object

19:48 technomancy`: (.openStream (java.net.URL. "http://technomancy.us"))

19:48 Cark: ah nice =)

19:49 technomancy`: so when I call read on that, how do I know when it's done?

19:50 I'd expect it to throw an exception if I keep reading from it, but it just keeps going forever.

19:50 does it do something silly like return -1?

19:51 hah; it does. wow.

19:51 Cark: don't you loce java programming ?

19:51 love

19:52 powr-toc: how do you perform a primitive cast in clojure? I want to cast an int as a char

19:52 dnolen: ,(char 10)

19:52 oops clojurebot is dead

19:53 but that should work

19:53 powr-toc: cool

20:16 hiredman: ~how much do you know?

20:17 clojurebot: I know 280 things

20:17 hiredman: I guess that'll do

20:21 Chouser: :-)

20:52 powr-toc: how do I flatten a sequence?

20:53 I can't seem to find a function for it

20:53 hiredman: I think there is a flatten in seq-utils in contrib

20:53 there is also apply concat

20:54 gnuvince_: ,(filter (complement seq?) (tree-seq [1 [2 3 [4 5] 6 7] 8 [9]]))

20:54 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$tree-seq

20:54 hiredman: ,(apply concat [[1 2 3] [4 5 6]])

20:54 clojurebot: (1 2 3 4 5 6)

20:54 gnuvince_: ,(doc tree-seq)

20:54 clojurebot: "([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."

20:56 hiredman: ,(tree-seq vector? seq [1 [2 3 [4 5] 6 7] 8 [9]]))

20:56 clojurebot: ([1 [2 3 [4 5] 6 7] 8 [9]] 1 [2 3 [4 5] 6 7] 2 3 [4 5] 4 5 6 7 8 [9] 9)

20:58 hiredman: ,(re-seq #"\w+" "foo bar baz")

20:58 clojurebot: ("foo" "bar" "baz")

20:59 powr-toc: I think apply concat'll do... but I wish flatten was in the core libs

20:59 it seems like a common thing to want to do

20:59 hiredman: ,(reduce vector (re-seq #"\w+" "foo bar baz"))

20:59 clojurebot: [["foo" "bar"] "baz"]

20:59 rhickey: Is the person responsible for incanter (http://github.com/liebke/incanter/tree/master) ever here?

21:00 hiredman: ,(reduce vector (re-seq #"\w+" [] "foo bar baz"))

21:00 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$re-seq

21:00 hiredman: ~seen liebke

21:00 clojurebot: no, I have not seen liebke

21:01 hiredman: 2009:Apr:13:06:24:59-!- dliebke [n=dliebke@134.192.133.202] has joined #clojure

21:02 rhickey: ~seen dliebke

21:02 clojurebot: no, I have not seen dliebke

21:02 hiredman: the seen information doesn't persist

21:16 rhickey: http://lotrepls.appspot.com/

21:20 Chouser: huh

21:20 hiredman: wow

21:20 cute

21:24 dliebke: rhickey: Hi, do you have a question about incanter?

21:24 Chouser: all those langages hooked up, and he wrote it in java.

21:24 hiredman: :P

21:25 rhickey: dliebke: Hi - incanter looks neat. I was wondering what you were doing with Colt, and whether you had tried Parallel Colt?

21:26 dliebke: thanks, I've looked at parallel colt in the past, but I'm not using it at this point -- although it might be a good idea

21:27 rhickey: are you happy with Colt?

21:28 dliebke: yes, nice scope, good performance -- better than anything else I've used written in Java

21:29 I've extended the colt matrix class and implemented the ISeq interface, which has been really powerful

21:29 rhickey: I've thought about providing direct support for (some of) Colt in Clojure

21:30 dliebke: that would be fantastic!

21:31 rhickey: some sort of DSL for defining/combining Colt Functions

21:34 djkthx: is it possible to have an array of bytes or bits in clojure, instead of just an int-array?

21:34 gnuvince_: djkthx: yes

21:35 hiredman: ,(byte \a)

21:35 clojurebot: java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number

21:35 hiredman: ,(byte (int \a))

21:35 clojurebot: 97

21:35 gnuvince_: ,(make-array Byte/TYPE 10)

21:35 clojurebot: #<byte[] [B@15d601f>

21:36 djkthx: ah, nice

21:37 didn't realize /TYPE would make it a primitive

21:38 thanks

21:40 dliebke: rhicky, I'd like to hear more about your ideas on colt as you flesh them out :)

21:40 djkthx: colt?

21:43 rhickey: dliebke: nothing too radical, just something to let you write functions and chains using normal */+- syntax, plus something to wrap assign to make it functional

21:44 cp2: rhickey: i dont quite understand

21:44 dliebke: djkthx, colt is a numeric library written in Java

21:44 cp2: oh

21:44 i see

21:44 dnolen: this will be super cool

21:44 dliebke: that would have made it much easier to write incanter :)

21:46 rhickey: there you go

21:48 djkthx: nifty

21:48 rhickey: http://piotr.wendykier.googlepages.com/parallelcolt

21:49 gnuvince_: When they say "high performance numeric library", do they mean for complex numeric types or even for simple ints?

21:49 cp2: 20:37 ::: netjoin/#clojure rhickey (n=rhickey@ool-457e4394.dyn.optonline.net)

21:49 er

21:49 JCublas provides Java bindings for the NVIDIA CUDA BLAS implementation, thus making the parallel processing power of modern graphics hardware available for Java programs.

21:49 awesome

21:53 dliebke: gnuvince_: all my work with colt has been with doubles, I don't think it supports complex numbers or ints.

21:55 gnuvince_: ok

21:57 arohner: rhickey: I've seen a few people mention the idea of gradual typing recently. What is your opinion on gradual typing in clojure?

22:44 toplay22: Hey, I'm having problems with the interactions between clojure and slime.

22:45 I'm using clojure-mode (which uses slime and swank-clojure), but in Emacs when I do a "M-x slime", it takes a REALLY long time to finally connect.

22:45 I get this error:

22:46 Polling "/tmp/slime.29096".. (Abort with `M-x slime-abort-connection'.) [644 times]

22:47 But it eventually connects.

22:47 I don't have any trouble using another lisp, like sbcl or cmucl.

22:48 gnuvince_: toplay22: how long is a really long time?

22:50 toplay22: About 10 minutes.

22:52 gnuvince_: Are all your versions up to date? Clojure, slime, clojure-swank?

22:56 toplay22: yes

22:59 Do you know of any way I can get more information about why it is just repeatedly polling and not connecting?

23:03 Oh, and this is why happens in the buffer that is starting the *inferior-lisp*:

23:03 http://pastebin.com/m21ca2c11

23:04 *why happens -> what happens

Logging service provided by n01se.net