#clojure logs

2009-04-13

00:27joha1no updates of ClojureCLR in clojure-contrib since late February. Is the project dead, resting, or pining for the fjords? (or perhaps hosted somewhere else?)
00:36kadaver 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
00:37kadaverdoes clojrue do that?
00:41durka42do which?
00:41durka42clojure source is compiled to bytecode
02:17kadaverdurka42: ok but is there an intermediate step which turn clojrue code into java classes?
02:19durka42well, the bytecode encodes java classes
02:19durka42there is no intermediate step with java source code, if that's what you mean
02:20kadaveri dont mean .class files, i mean class FunctionFoo {...}
02:21kadaverbut ok
02:21kadaverso any info on how? a namespace is what really, a static class with functions as methods?
02:22Rayneskadaver: You've earned first prize for most misspellings of 'Clojure'.
02:23hiredmankadaver: no
02:24hiredman~def c.l.Compiler
02:24hiredmanfunctions are themselves objects
02:24hiredman,(class (fn [] ))
02:24clojurebotsandbox$eval__2839$fn__2841
02:31DTrejoHey guys, I come from an eclipse and java background; what do you suggest I start learning clojure on? (what ide/setup?)
02:32hiredmanwhatever you are most comfortable with, that being said, there is a large emacs following
02:32hiredmanI personally use vim
02:32durka42does clojure-dev work?
02:32hiredmanno idea
02:32durka42the eclipse plugin
02:32durka42http://code.google.com/p/clojure-dev/
02:33DTrejoI've installed it, played around a bit
02:33kadaverDTrejo: lisp+emacs works very well together, that said you can run a repl in eclispe too so if you are more comfortable with that...
02:33hiredmanclojurebot: clojure-dev is the eclipse plugin http://code.google.com/p/clojure-dev/
02:33clojurebotAlles klar
02:33kadaverah
02:34durka42~eclipse
02:34clojurebotI don't understand.
02:34DTrejohas anyone tried out multiple configs/ides/editors? which is the most well developed?
02:34DTrejoerr, best user experience
02:35hiredmanwell, vim, obviously :P
02:35DTrejo(:))
02:35durka42;)
02:35DTrejoI'll look into it
02:35DTrejothe link is on the clojure site? for the vim config file or whatever
02:35RaynesDTrejo: I use Enclojure with NetBeans 6.5.
02:36DTrejohow is that raynes?
02:36DTrejohow do you like it
02:36RaynesI 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.
02:36RaynesI hear that will be fixed soon as well.
02:36DTrejomm
02:37DTrejohiredman is the situation similar for cloj on vim?
02:38RaynesI'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.
02:38hiredmanI don't think I am person to ask
02:38hiredmanI don't go in for much besides syntax highlighting
02:38hiredmanvimclojure's repl is nice, when I get it to work
02:38DTrejok
02:39hiredmanare you on windows?
02:39DTrejoyes, xp
02:39hiredmanyou might look at clojure in a box
02:39DTrejoI have the same emecs setup shyness
02:39hiredmanwhich is something that installs clojure+emacs
02:39DTrejonice
02:39DTrejothat looks so easy :)
02:40DTrejohave you tried it Raynes ?
02:40RaynesDTrejo: Nope.
02:41RaynesI'm a NetBeans man. (:
02:41RaynesPlus 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 :\
02:42DTrejomm
02:43DTrejothe guy who put together clojure box needs to host it on some faster server
02:43DTrejoerr host it on some filehost
02:43Raynes,(println "Welcome to the wonderful world of Clojure DTrejo :)")
02:43clojurebotWelcome to the wonderful world of Clojure DTrejo :)
02:45DTrejo,(+ 60 9)
02:45clojurebot69
02:46RaynesDTrejo: clojurebot is hiredman's work. hiredman is my hero <3
02:46DTrejoI was thinking: wow hiredman knows how to use the bot
02:46DTrejocool project
02:49DTrejoloving clojure box :)
02:49DTrejothanks for the recommendation
02:58DTrejo~eclipse
02:58clojurebotHuh?
03:01RaynesIt seems even the people who /use/ Scala don't seem to like it very much.
03:02RaynesDTrejo: http://code.google.com/p/clojure-dev/
03:04DTrejoRaynes yes I tried that. That's too bad about scala
03:04DTrejoI know a guy who likes it tho
03:05RaynesDTrejo: 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.
03:05DTrejoRaynes ohh you're saying they aren't in love with clojure
03:05DTrejoI misunderstood
03:06DTrejowell, its cus they already have a substitute I'd say
03:06DTrejoit steals their thunder
03:06RaynesDTrejo: No, you understood. They aren't enthusiastic about Scala the way Clojure users are enthusiastic about Clojure
03:08zakwilsonThat's sad. I'm thinking maybe I should take that as a sign to not bother with Scala.
03:09DTrejooh, ok
03:09Rayneszakwilson: 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. :\
03:09DTrejoglad you clarified
03:09RaynesScala*
03:09RaynesI can't type tonight. :|
03:09DTrejonow everythings all mixed up hehe :)
03:09DTrejohow is smalltalk? I don't hear much about it
03:10DTrejoI mean the community
03:10zakwilsonI suppose it depends on why you want to learn OO, or what you want to learn about it.
03:10RaynesDTrejo: I dunno. Pretty dead as far as I can tell.
03:11zakwilsonThough I had some exposure to C++ and such, the first object system I really *used* was CLOS.
03:11DTrejotoo bad
03:11Rayneszakwilson: 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#.
03:11DTrejozakwilson: I wish lisp had been my first language, like a buddy of mine - he took it for 4 years in HS
03:12zakwilsonRaynes: Well, I'm not sure about not getting very far... the basic concepts are simple enough.
03:12DTrejoand had a hardass funciontional fanatic teacher
03:12zakwilsonLisp wasn't my first language, but it's the first language I did non-trivial OO in.
03:13DTrejoIdeally I want to know clojure, python, maybe R/ROR. (already decent in java)
03:14RaynesI could learn Python, it has some object orientation.
03:14Raynes:|
03:14DTrejomostly I just need to get out there and code, starting this summer when things open up
03:14DTrejoRaynes why that face?
03:14zakwilsonRaynes: you may want to make an object system, or study one implemented in the language from which it is used.
03:15zakwilsonI think somebody made one for Clojure
03:17DTrejowhat languages do you know right now Raynes ?
03:17RaynesDTrejo: Clojure, some Haskell, and enough Java to know a little about object orientation.
03:18DTrejoI thought cloj had some OO
03:18zakwilsonWow... good choices!
03:18zakwilsonIt has some OO-like things, but they don't work in the traditional way.
03:18zakwilsonTraditional being Smalltalk/Ruby/Python/Java-like
03:19DTrejoi think clof is more 100yr than arc
03:19DTrejocloj*
03:20DTrejoopinions?
03:20zakwilsonI think Arc has not been developed enough to tell.
03:20DTrejomm
03:20DTrejoyes
03:20RaynesDTrejo: Arc could probably be good, but Paul Graham will end up dying of old age before he gets 0.0.4 out :\
03:20zakwilsonClojure feels like a great language for the next decade, and it probably has a lot of what a 100 year language will have.
03:21zakwilsonArc feels really unfinished. I'm sure revision 3 of Clojure did too.
03:22DTrejoI think clojure is going to do well just because it has a great pursuasive website. Really is open about the nature of itself
03:23DTrejoand the community of cours
03:23DTrejoRaynes I agree
03:23zakwilsonIt convinced me to use the JVM. That's impressive pursuasion right there.
03:23DTrejo:)
03:24Rayneshttp://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it Get your thoughts in before it's closed.
03:25DTrejo(I don't have anything to say)
03:25leafws/pursuasive/persuasive
03:25leafw(hurts my eyes :)
03:26DTrejoI don't understand the slashes, what does that mean?
03:26DTrejo[sic] ?
03:27zakwilsonMy only attempt at using stack overflow didn't impress me.
03:27RaynesDTrejo: It's a regex s/replacethis/withthis/
03:28zakwilsonhttp://stackoverflow.com/questions/513523/what-language-features-can-you-live-without-closed
03:31leafwDTrejo: in vi editor, it means "substitute first expr. by second expr."
03:31DTrejoah
03:31DTrejonow I know more
03:31leafwDTrejo: in skype, it fixes typos in previous lines as well.
03:34DTrejooh dang
03:34DTrejos/dang/dangg
03:34DTrejoaw it doesn't work here
03:34leafwno, IRC is a different beast.
03:38RaynesDTrejo: Though it doesn't work in IRC, users use it as symbolism to correct their previous messages.
03:40zakwilsonI have not seen any signs of that actually altering a conversation in skype.
03:40Rayneshttp://xkcd.com/528/
03:49leafwzakwilson: AFAIK only works in macosx skype.
03:49zakwilsonleafw: that would explain it.
03:50DTrejoso it updates other people's screens too?
03:52leafwI think so.
03:52leafwvery orwellian.
03:54DTrejomm, another reason for me to get a mac
03:54DTrejohaha
04:01Rayneshttp://stackoverflow.com/questions/743256/why-does-scala-have-very-little-enthusiasm-about-it/743285#743285
04:01RaynesThe man has a point.
04:05leafwyes: clojure is the first JVM language that attracted people per se, not by the need of avoiding the horror of writing java code.
04:08zakwilsonleafw: agree - I might never have used the JVM without Clojure.
04:16leafwwith 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
04:17leafw( http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting )
06:00joha1I'm translating Java code with the "instanceof" operator. How can I express this in Clojure? (.instanceOf ...) didn't work
06:02joha1nor (.instanceof ...)
06:07antifuchs(isa? (class object) TheDesiredClass) ; wfm
06:07joha1aha, (instance? <class> <obj>) seems to work
06:08antifuchsoh, heh. looks like I should rewrite some of my code, then (:
06:08antifuchsthanks, joha1 (:
06:08joha1np
06:15Raynesjoha1: There is also instance?
06:15Raynes,(instance? Integer 3)
06:15clojurebottrue
06:16joha1yes, I just found instance? in the API doc
06:17RaynesAnd class?
06:17RaynesWhich is less useful, but still. :)
07:32yasonHow to extract the local name out of a fully qualified symbol?
07:36leafw,(doc name)
07:36clojurebot"([x]); Returns the name String of a symbol or keyword."
07:36leafwyason: I guess that answers it.
07:40mihandhey guys. do next and rest differ only in how they handle empty seqs?
07:41leafwmihand: no.
07:41mihandin core they seem to have runtime support
07:41leafwmihand: rest is eager, I think.
07:43mihanddid rest change recently? because i have the feeling that in the screencasts it returned nil
07:43durka42yes
07:44durka42rest changed with the introduction of lazy sequences
07:44durka42you should now use next instead, unless you are writing a lazy seq
07:45leafwmihand: it changes about 2 months ago or so
07:45mihandthanks
08:47powr-tocHey... I was wondering, is there an idiomatic clojure way to wrap an object into a seq-able abstraction?
08:48powr-tocassuming I have a java object that's similar to an Iterator
08:50powr-tocI've seen there is iterator-seq... the problem is I don't have an iterator
08:50powr-tocor rather, the object doesn't implement Iterator directly
08:55powr-tocOk, 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...
08:59yasonleafw: yes, thanks! exactly what I was looking for
10:54StartsWithKfyuryu: hi, your the author of cloak?
12:22fyuryuStartsWithK: hi, yes
12:23StartsWithKhi again :)
12:23StartsWithKwhats the state of cloak?
12:23StartsWithKi looked at it, last update was 2 months ago
12:24StartsWithKit 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:25StartsWithKis this kind of thing you had in mind for cloak?
12:25fyuryuStartsWithK: needs an update, some of the code that I've written for it is now in contrib
12:25StartsWithKcan it be usead as library?
12:25gnuvince_What's cloak?
12:26hiredman"simple automation tool inspired by rake, written in Clojure"
12:26fyuryuStartsWithK: are you familiar with rake?
12:26StartsWithKany plans for, lets say that rm could be more sensitive to content, like if do rm in svn project, it uses svn remove
12:26StartsWithKfyuryu: to some extent, i used buildr
12:26StartsWithKand rake is just a thing i would like to use, light, simple..
12:27StartsWithKor things like (cp ["%s/text.file" root-dir] ["%s/dest.file" dest-dir])
12:27fyuryuStartsWithK: the idea was to automate calling external commands
12:28fyuryuand have some Clojure/Java specific bonuses (eq. compiling)
12:28StartsWithKso you have a CA signed?
12:29fyuryuStartsWithK: yes, I sent one, but don't know if Rich got it
12:30fyuryuStartsWithK: it is also possible to use cloak with Lancet - that gives you access to all the ant tasks
12:30fyuryuand there are a lot of them
12:31StartsWithKwell my build is ant, i would like to use just cloack, looked at lancet and skipped it
12:31StartsWithKcloak*
12:32fyuryuone thing that Lancet doesn't have is resolving circular dependencies
12:32StartsWithKalso, i see for now only one problem
12:32StartsWithKit has no build system
12:32StartsWithKin ant
12:33DrakesonDo 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:33StartsWithKi would need something like that so i cn bootstrap my build
12:33StartsWithKwould you accept such a patch?
12:33fyuryuStartsWithK: you mean an build.xml to compile cloak?
12:33StartsWithKyes
12:33lisppaste8lethe pasted "xml-zip filtering" at http://paste.lisp.org/display/78492
12:34letheWhy does xml1-> in ^ seem to return a function and not the location?
12:35fyuryuStartsWithK: yeah, I was supposed to write that, but since I hava a special script with CLASSPATH for cloak set, I forgot about it
12:35fyuryuStartsWithK: but sure, a patch would be nice :-)
12:36StartsWithKfyuryu: ok, i'll find you in couple of days when i sort cloak intergation with my build
12:36StartsWithKthanks for replays
12:36fyuryuStartsWithK: will you be doing any Clojure code compilation from cloak?
12:37StartsWithKfyuryu: only calling of ant thro shell
12:37StartsWithKsome jar manipulations and svn git hg checkouts
12:38fyuryuStartsWithK: ah, ok. Just wanted to be sure you are aware abt. the standard CLASSPATH pains
12:38StartsWithKwill it run ok if i call multiple cloak files (separate processes) from inside ant <parallel> task?
12:40powr-tocIs there a reason why (seq? []) returns false?
12:40fyuryuStartsWithK: it should, unless you're going to try to access the same resources from different processes
12:40powr-tocI thought vectors were sequences
12:40fyuryuStartsWithK: etc
12:40dakrone_hb,(seq? [])
12:40clojurebotfalse
12:40powr-toc,(seq? ())
12:40clojurebottrue
12:41StartsWithKfyuryu: thanks
12:41gnuvince_powr-toc: it implementes the sequence interface
12:41hiredmanvectors are not seqs
12:41gnuvince_,(iseq? [])
12:41clojurebotjava.lang.Exception: Unable to resolve symbol: iseq? in this context
12:41fyuryuStartsWithK: you're welcome
12:41hiredman,(seq? (seq []))
12:41clojurebotfalse
12:41hiredmanwell
12:41hiredman,(seq? (seq [1]))
12:41clojurebottrue
12:41dakrone_hb,(list? [])
12:41clojurebotfalse
12:42hiredmana seq is a view over a collection
12:42dakrone_hb,(set? [])
12:42clojurebotfalse
12:42dakrone_hb,(vector? [])
12:42clojurebottrue
12:42powr-tochiredman: Then is there a common (testable) abstraction across vectors, lists and hashmaps?
12:43hiredmanyeah
12:43hiredman,(ancestors (class []))
12:43clojurebot#{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:44hiredman,(ancestors (class {}))
12:44clojurebot#{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:44hiredmanactully
12:44hiredmanI think you should just use coll?
12:44dakrone_hb,(seqable? [])
12:44clojurebotjava.lang.Exception: Unable to resolve symbol: seqable? in this context
12:44hiredman,(coll? [])
12:44clojurebottrue
12:45hiredman,(coll? (java.util.ArrayList.))
12:45clojurebotfalse
12:45hiredmanerm
12:45hiredman,(doc coll?)
12:45clojurebot"([x]); Returns true if x implements IPersistentCollection"
12:45hiredmanI see
12:45powr-tochiredman: cheers... that's exactly what I'm after
12:46hiredman(instance? java.util.Collection [])
12:46hiredman,(instance? java.util.Collection [])
12:46clojurebottrue
12:46hiredmaneven more general
12:46hiredmanand seq works on most (all?) Collections
12:46hiredman,(seq (java.util.ArrayList. [1 2]))
12:46clojurebot(1 2)
12:47hiredmanI kind of assumed coll? was a test for java.util.Collections
12:49hiredman,(seq (java.util.HashMap. {:a 1}))
12:49clojurebot(#<Entry :a=1>)
12:49hiredman,(first (first (seq (java.util.HashMap. {:a 1}))))
12:49clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry
12:50hiredman,(seq (first (seq (java.util.HashMap. {:a 1}))))
12:50clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: Entry
12:50hiredmaninteresting
12:52marklarHow do you type hint the Math.abs function? java.lang.Math/abs is showing a reflection warning
12:52Chousermarklar: it wants to know the type of the arg
12:53marklarChouser: Ah, thanks
13:32twansithmm.. can someone show me a example of using the 'update-in' function?
13:34twansitdisregard ... got it.
13:35hiredmanhttp://log.damog.net/2009/04/rubx-twitters-ruby-shell/
13:35hiredmanoooo
13:37leafw"her"
13:37leafwclever way to gather publicity.
13:38hiredmanI guess I'd better write a real twitter interface to start
13:43cp2heh
14:22hiredmanI 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:24technomancyhiredman: running into API limits?
14:25technomancyI'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:25technomancyany ideas?
14:26technomancysorry, the absolute file name of the file containing the caller
14:26hiredmanthe caller of a function?
14:26technomancyyes
14:27hiredmanhmmm
14:27technomancythis is what I've got that gives me the base name: (defn caller-file [] (.getFileName (second (.getStackTrace (Throwable.)))))
14:27technomancybut StackTraceElement doesn't seem to have any other methods that deal with filenames
14:28hiredmanr1349
14:29hiredmanthat might help, if that information is then propagated in the stacktrace
14:29technomancyinteresting; thanks
14:30technomancyI 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:30Chouserbut vars and fns are very different things
14:33Chousertechnomancy: it's entirely possible the information you want is simply not stored anywhere that you can get to
14:34Chousertechnomancy: you can't redefine the problem at all? use a macro call instead of a function call, for example?
14:40technomancyoh, if I used a macro I would have access to *file*; is that right?
14:40Chouser*source-path* yeah
14:41technomancythanks
14:42technomancyhrm; *source-path* is a relative filename as well.
14:43Chouseryeah, just noticed that.
14:43Chouserwhat are you using to load the file? 'require', 'load-file'?
14:43technomancyit'd be load-file since it's not on the classpath
14:44Chouseryou were right: *file*
14:57hiredmangoogle code is dead
15:02leafwhiredman: http://code.google.com/ ?
15:03hiredmanleafw: requests for project pages like http://code.google.com/p/java-twitter/ are timing out
15:08hiredmanI really wish I could figure this twitter thing out
15:09hiredmanshelling 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:12hiredmanI wonder if it is a user-agent thing
15:15pjstadigwhat's up with code.google.com lately?
15:18hiredmanweird
15:19hiredmanwhen I change my username I get two requests in the logs
15:48hiredmanjava.io.IOException: Not enough storage is available to process this command
15:48hiredmanbah
17:40technomancysets are unordered by default, right?
17:40technomancyso conj'ing on to them could add the new value at any position?
17:41gnuvince_technomancy: hash-sets, yes.
17:41technomancyif *inventory* is a ref to a regular set, this seems to work: (str-join "\n " (conj @*inventory* "You are carrying:"))
17:42technomancybut in this case it's working by coincidence, right?
17:42technomancythere's no guarantee
17:51Chousertechnomancy: but use (seq @*inventory*) instead to get consistent results
17:59technomancyoh sure; that works. I think it's cleaner to put the message outside the str-join though.
18:25Chousersure
18:29powr-tocIs there a clojure equivalent of Ruby's String#succ http://www.ruby-doc.org/core/classes/String.html#M000794
18:29powr-tocthat'd turn a string of "abcd" into "abce"
18:34Carkpowr-toc : have a look in tge java luibrary, i wouldn't bet on it though
18:35powr-tocCark: it's nto
18:35powr-tocnot
18:36Carki wonder what's the use case =)
18:37powr-tocbeing able to generate sequential names
18:42technomancy`what's a good way to generate a filename that's based on a URL?
18:43technomancy`was thinking of either replacing all illegal-in-filename chars or just hashing it.
18:44powr-toctechnomancy`: hashing it is probably the easiest way... but if you want them to be human readable then you have to replace chars
18:44technomancy`yeah, I don't think human-readability is important here
18:47technomancy`hrm; looks like to calculate SHA1 with Java you need to do it a byte at a time?
18:49technomancy`never mind
18:50powr-toctechnomancy`: Yeah, I think so... Checkout Integer.toHexString though
18:51lisppaste8dnolen pasted "md5" at http://paste.lisp.org/display/78517
18:52dnolenperhaps someone might find this useful, I converted it from an example I found somewhere on the Internet, short and sweet.
18:52technomancy`thanks
18:52powr-tocdnolen: nice...
18:53technomancy`short for Java anyway. =)
18:54dnolen;)
18:55aperottehello everyone
19:11technomancy`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:12technomancy`some kind of variation on this I guess? (while (not (eof? *in*)) (print (read-line)))
19:20st3fanis there a concept like Python's yield in Clojure?
19:28Carkstefan : we do loops from the outside with constructs like map and reduce
19:30technomancy`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:31Carkisn't there an allocate static function on char buffers ?
19:31technomancy`ah, I didn't realize that's what it was for; thanks
19:33technomancy`oh... but writers don't work with CharBuffers.
19:35technomancy`silly me for assuming that readers and writers worked the same way.
19:35Carkbut they should work with bytebuffers
19:35Carkso just wrap a bytebuffer around your charbuffer (i guess)
19:36technomancy`nope, the reader won't work with a byte buffer
19:37technomancy`there's got to be a better way to write the contents of a URL to disk
19:37Carkwhat are the classes of your writer and reader ?
19:37technomancy`I'm using duck-streams
19:38technomancy`maybe that's a mistake
19:38Carkwhy do you need a charbuffer then ?
19:39technomancy`because that's what my reader's .read method accepts
19:39technomancy`and I'm assuming read-line and println won't work with binary data
19:40Carkah that's a binary file ?
19:40technomancy`well it could be
19:40Carkthen you surely don't need a charbuffer =)
19:40Carkthat's some kind of a file copy function ?
19:40technomancy`at this point I'm tempted to shell out to curl
19:40technomancy`because this should not be ten lines. =\
19:41Carkyou need to use errr ...one second
19:42Carkfileinputstream and fileoutputstream for possibly binary data
19:42technomancy`thanks
19:42technomancy`java.net.URL could construct the input stream for me, right?
19:43Carkhum try passing that to the stream constructor
19:44Carkis that doesn't work, there might be some way to convert to a File object
19:48technomancy`(.openStream (java.net.URL. "http://technomancy.us&quot;))
19:48Carkah nice =)
19:49technomancy`so when I call read on that, how do I know when it's done?
19:50technomancy`I'd expect it to throw an exception if I keep reading from it, but it just keeps going forever.
19:50technomancy`does it do something silly like return -1?
19:51technomancy`hah; it does. wow.
19:51Carkdon't you loce java programming ?
19:51Carklove
19:52powr-tochow do you perform a primitive cast in clojure? I want to cast an int as a char
19:52dnolen,(char 10)
19:52dnolenoops clojurebot is dead
19:53dnolenbut that should work
19:53powr-toccool
20:16hiredman~how much do you know?
20:17clojurebotI know 280 things
20:17hiredmanI guess that'll do
20:21Chouser:-)
20:52powr-tochow do I flatten a sequence?
20:53powr-tocI can't seem to find a function for it
20:53hiredmanI think there is a flatten in seq-utils in contrib
20:53hiredmanthere is also apply concat
20:54gnuvince_,(filter (complement seq?) (tree-seq [1 [2 3 [4 5] 6 7] 8 [9]]))
20:54clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$tree-seq
20:54hiredman,(apply concat [[1 2 3] [4 5 6]])
20:54clojurebot(1 2 3 4 5 6)
20:54gnuvince_,(doc tree-seq)
20:54clojurebot"([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:56hiredman,(tree-seq vector? seq [1 [2 3 [4 5] 6 7] 8 [9]]))
20:56clojurebot([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:58hiredman,(re-seq #"\w+" "foo bar baz")
20:58clojurebot("foo" "bar" "baz")
20:59powr-tocI think apply concat'll do... but I wish flatten was in the core libs
20:59powr-tocit seems like a common thing to want to do
20:59hiredman,(reduce vector (re-seq #"\w+" "foo bar baz"))
20:59clojurebot[["foo" "bar"] "baz"]
20:59rhickeyIs the person responsible for incanter (http://github.com/liebke/incanter/tree/master) ever here?
21:00hiredman,(reduce vector (re-seq #"\w+" [] "foo bar baz"))
21:00clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$re-seq
21:00hiredman~seen liebke
21:00clojurebotno, I have not seen liebke
21:01hiredman2009:Apr:13:06:24:59-!- dliebke [n=dliebke@134.192.133.202] has joined #clojure
21:02rhickey~seen dliebke
21:02clojurebotno, I have not seen dliebke
21:02hiredmanthe seen information doesn't persist
21:16rhickeyhttp://lotrepls.appspot.com/
21:20Chouserhuh
21:20hiredmanwow
21:20hiredmancute
21:24dliebkerhickey: Hi, do you have a question about incanter?
21:24Chouserall those langages hooked up, and he wrote it in java.
21:24hiredman:P
21:25rhickeydliebke: Hi - incanter looks neat. I was wondering what you were doing with Colt, and whether you had tried Parallel Colt?
21:26dliebkethanks, 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:27rhickeyare you happy with Colt?
21:28dliebkeyes, nice scope, good performance -- better than anything else I've used written in Java
21:29dliebkeI've extended the colt matrix class and implemented the ISeq interface, which has been really powerful
21:29rhickeyI've thought about providing direct support for (some of) Colt in Clojure
21:30dliebkethat would be fantastic!
21:31rhickeysome sort of DSL for defining/combining Colt Functions
21:34djkthxis it possible to have an array of bytes or bits in clojure, instead of just an int-array?
21:34gnuvince_djkthx: yes
21:35hiredman,(byte \a)
21:35clojurebotjava.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
21:35hiredman,(byte (int \a))
21:35clojurebot97
21:35gnuvince_,(make-array Byte/TYPE 10)
21:35clojurebot#<byte[] [B@15d601f>
21:36djkthxah, nice
21:37djkthxdidn't realize /TYPE would make it a primitive
21:38djkthxthanks
21:40dliebkerhicky, I'd like to hear more about your ideas on colt as you flesh them out :)
21:40djkthxcolt?
21:43rhickeydliebke: 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:44cp2rhickey: i dont quite understand
21:44dliebkedjkthx, colt is a numeric library written in Java
21:44cp2oh
21:44cp2i see
21:44dnolenthis will be super cool
21:44dliebkethat would have made it much easier to write incanter :)
21:46rhickeythere you go
21:48djkthxnifty
21:48rhickeyhttp://piotr.wendykier.googlepages.com/parallelcolt
21:49gnuvince_When they say "high performance numeric library", do they mean for complex numeric types or even for simple ints?
21:49cp220:37 ::: netjoin/#clojure rhickey (n=rhickey@ool-457e4394.dyn.optonline.net)
21:49cp2er
21:49cp2JCublas provides Java bindings for the NVIDIA CUDA BLAS implementation, thus making the parallel processing power of modern graphics hardware available for Java programs.
21:49cp2awesome
21:53dliebkegnuvince_: all my work with colt has been with doubles, I don't think it supports complex numbers or ints.
21:55gnuvince_ok
21:57arohnerrhickey: I've seen a few people mention the idea of gradual typing recently. What is your opinion on gradual typing in clojure?
22:44toplay22Hey, I'm having problems with the interactions between clojure and slime.
22:45toplay22I'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:45toplay22I get this error:
22:46toplay22Polling "/tmp/slime.29096".. (Abort with `M-x slime-abort-connection'.) [644 times]
22:47toplay22But it eventually connects.
22:47toplay22I don't have any trouble using another lisp, like sbcl or cmucl.
22:48gnuvince_toplay22: how long is a really long time?
22:50toplay22About 10 minutes.
22:52gnuvince_Are all your versions up to date? Clojure, slime, clojure-swank?
22:56toplay22yes
22:59toplay22Do you know of any way I can get more information about why it is just repeatedly polling and not connecting?
23:03toplay22Oh, and this is why happens in the buffer that is starting the *inferior-lisp*:
23:03toplay22http://pastebin.com/m21ca2c11
23:04toplay22*why happens -> what happens