#clojure log - Feb 05 2011

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

1:14 irc_newbie: howdy

1:15 ieure: Hello.

1:24 mec_: is there a variant of (source) that will show all the methods of a multimethod?

1:26 amalloy: mec_: i don't think so, but see (.getMethodTable print-dup)

1:26 danlarkin: amalloy: clojure.core/methods

1:26 (doc methods)

1:26 clojurebot: "([multifn]); Given a multimethod, returns a map of dispatch values -> dispatch fns"

1:27 amalloy: danlarkin: ah. a nice sugar for the above

1:28 mec_: I tried that but just a bunch of "Source not found"

1:30 sritchie: amalloy: problem solved with cascading, btw -- there was indeed a way to serialize primitives without any special wrapper, it's just "off" by default

1:31 amalloy: mec_: i don't think defmethod attaches metadata to the methods

1:31 so you can't find the source

1:31 sritchie: amalloy: I'm using your method, of pushing to a DataOutputStream, I just don't have to pretend to be a byte array anymore

1:31 amalloy: sritchie: convenient

1:31 sritchie: amalloy: less shameful!

1:32 amalloy: buffers and channels are supposedly the "new thing", and definitely faster if you care about that

1:33 sritchie: Unfortunately I have to conform to this interface: http://hadoop.apache.org/common/docs/r0.20.0/api/org/apache/hadoop/io/serializer/Deserializer.html

1:34 amalloy: but I hear you

1:34 amalloy: sritchie: whoa, implementing serialization yourself. i wonder if thrift might be easier

1:34 danlarkin: interfaces are awesome because you can reify them

1:34 it's subclassing that sucks

1:35 amalloy: or avro i guess, for hadoop

1:35 danlarkin: i don't think anyone was complaining about interfaces

1:35 danlarkin: just commenting

1:35 sritchie: danlarkin: I was just pointing out that it forced me to use streams

1:36 amalloy: for anything other than these primitive arrays, I'll certainly check out thrift, or some other serialization framework

1:36 the next thing I'll have to stream will most likely be parallel colt matrices

4:13 fliebel: morning

4:14 Is anyone here capable of navigating the Java XML jungle? I found a SAX serializer, which is what I thought I needed, but it says it's deprecated, and lists 2 other options I can't find.

4:15 "This class was deprecated in Xerces 2.9.0. It is recommended that new applications use the DOM Level 3 LSSerializer or JAXP's Transformation API for XML (TrAX) for serializing XML. See the Xerces documentation for more information."

4:42 Java makes fliebel angry :(

4:46 Why! A DocumentBuilderFactory, that produces DocumentBuilders, that can make Documents. Just give me the document, all right?

4:48 jkrueger: fliebel: so you are a JavaAversionAccumulator ?

4:50 fliebel: jkrueger: Yes, and making a XmlDslFactoryGeneratorFactoryCreator

4:50 You know, like Hiccup, but for XML, with namespaces and all.

4:52 The problem is that I can't find a way to simple generate some XML with Java. When I was on the point where I thought I found it, I noticed it said 'deprecated'.

4:53 gregh: you can always just write text

4:53 jkrueger: at times one gets the feeling that some java APIs get deprecated before they ever get released

4:54 fliebel: gregh: Before I started, I was under the impression there was a wealth of great XML libraries for Java.

4:57 gregh: if by "great" you mean "Very big, large scale", I think you found them. :)

4:59 fliebel: gregh: The real problem is that that also seems to imply "business talk, complicated" and also "you *know* this stuff, right? so why explain?"

5:00 Anyway, I finally found some examples how to write a DOm Document to XML, so with a dozen lines of factory cruft, that will get me there I think.

5:05 I'll call my lib ArmageDOM, or WisDOM or SAXophone, or XMJ(eXtended Markup Jumble), or… any suggestions?

5:08 jkrueger: i like SAXophone

5:08 but would have expected that to be a library name already

5:09 fliebel: jkrueger: Me to, but I am not technically using SAX. I was on the SAX trail, but I can;t find a decent serializer/writer

5:12 jkrueger: DOM minion

5:12 fliebel: DOMino :)

5:12 gregh: DOMmage

5:13 fliebel: gregh: ?

5:14 gregh: from the french expression "quel dommage" : "what a shame"

5:15 fliebel: http://en.wiktionary.org/wiki/dommage

5:16 entropie: DOMINATION!

5:23 fliebel: What I need is an implementation of org.xml.sax.ContentHandler that writes the tags somewhere.

5:48 Huh? I try (.newInstance DocumentBuilderFactory) on http://download.oracle.com/javase/1.5.0/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance() and get java.lang.IllegalAccessException: Class user$eval373 can not access a member of class javax.xml.parsers.DocumentBuilderFactory with modifiers "protected"

5:50 That constructor is protected, so you have to use newINstance, and then get the protected error...

5:51 this works: (. DocumentBuilderFactory (newInstance))

5:52 Why?

5:52 clojurebot: why not?

8:13 raek: fliebel: sometimes the reflector finds a private or protected method to be a better match type-wise

8:14 fliebel: if the method or constructor is overloaded, and some of the overloaded variants are not public, you can use type hints to force the reflector to pick the right one

8:15 fliebel: raek: But why does that mean that

8:15 raek: this is common when you have an instance of a private private class that implements a public interface

8:15 fliebel: (.newInstance DocumentBuilderFactory) does not work while (. DocumentBuilderFactory (newInstance)) does?

8:18 I thought one was sortof a macro for the other.

8:20 raek: fliebel: I think (.method object) is only for instance methods

8:20 fliebel: ah

8:20 raek: try (DocumentBuilderFactory/newInstance)

8:21 fliebel: *facepalm*

8:30 * david` sighs

9:55 fliebel: There must be a better way that doing mutual trampoline recursion…

11:02 phew, it's working. https://github.com/pepijndevos/ArmageDOM

11:06 In only need to figure out a way to make it recursive in a good way.

11:09 LauJensen: How do I open a regular cake/clojure project in Eclipse?

11:09 fliebel: I am currently in a situation where I have recursive mutual recursion. (I don't know a better wording for it)

11:14 ejackson: LauJensen: WHAT ? You must have had one too many Fishshots last night my man... I can't believe I'm seeing you using something outside emacs :P

11:14 LauJensen: ejackson: Im trying to help out a customer :)

11:14 * ejackson ducks

11:14 * fliebel thinks Clojure needs more ducks.

11:15 fliebel: LauJensen: Is Eclipse one of those IDEs that only let you open eclipse project files?

11:15 LauJensen: Yes

11:15 I know lein has a plugin somewhere which creates such a file

11:16 fliebel: LauJensen: Well, what Cake feature do you need that prevents you from using Leiningen to generate that file?

11:18 LauJensen: My projects are usually quite firmly married to Cake, but I think I would be able to run the plugin even still

11:18 Just not build the project

11:37 defn: LauJensen: when you say firmly married, do you use a lot of cake plugins or have custom tasks or something?

11:37 do you mean you use*

11:42 LauJensen: defn: custom tasks primarily

11:59 robonobo: yo

12:10 fliebel: robonobo: yo

12:26 cinch: &(meta '(a))

12:26 sexpbot: ⟹ {:line 1}

12:26 cinch: &(meta '[a])

12:26 sexpbot: ⟹ nil

12:27 cinch: why is line added on a list?

12:31 fliebel: cinch: I think for debugging.

12:31 Since most of the time lists are used for code, it is good to know where they are when one raises an exception.

12:31 cinch: makes sense, was wondering why it's not on a vector

12:36 fliebel: What operations do and don't retain the meta of an object?

13:07 amalloy: fliebel: i'd tend to assume (wrongly, i'm sure), that no operations retain the meta, to avoid problems

13:12 also, fliebel, findfn is fixed:

13:12 $findfn + [1 2 3] 6

13:12 sexpbot: [clojure.core/reduce clojure.core/apply]

13:15 cinch: fliebel: " In general, collection functions (conj, assoc, dissoc, and so on) are supposed to preserve metadata,

13:15 while sequence functions (cons, take, drop, etc.) are not. But there are exceptions. In Clojure 1.0, conj on

13:16 (from practical clojure)

13:29 fliebel: amalloy: Great, great :)

13:30 cinch: Thanks, I shoudl look what Joy of Clojrue hast to say on the issue.

13:37 amac: Is there a form which allows something similar to loop/recur (tracking intermediate state while iterating over a series of elements) but with multiple recur points in the loop?

13:37 ...hard to phase that question

13:37 amalloy: amac: i think the best you can do is multiple loop forms

13:37 but iterate or reduce may be able to do what you want in a different way

13:39 amac: my problem is that in some cases I need to do extra passes over the elements, so they get temporarily skipped but processed later

13:40 amalloy: amac: and you can't condense that into a single pass of multiple-step processing?

13:42 amac: I can't think of a way to do it that won't fail in some edge cases

13:43 basically its a graph traversal, but if the graph contained disjoint subsets (groups of elements with no relation to other groups) it would break on a single pass

13:46 ...going to hack away at this some more, thank for the input

13:47 amalloy: amac: maybe it's hammock time :)

13:50 amac: amalloy: gotta watch that talk again :)

13:52 fliebel: amac: What does this disjoint subset graph look like? I can't really imagine what you're talking about.

13:57 amalloy: fliebel: a graph with points ABCDE: DE are connected, ABC are all interconnected, but no links between the groups

13:57 amac: say you have a graph of 6 elements, 1 2 3 are connected and 4 5 6 are connected

14:00 the issue is that if you have a 7th element that connects 3 and 4 then they're no longer disjoint and need to be processed again

14:03 fliebel: amac: So it's a seq of connections? And what do you do with them? I understand what disjoined sets look like, but the representation and iteration is where I run into trouble.

14:03 clojurebot: c'est bon!

14:07 amalloy: clojurebot: your tendency to treat any sentence containing the word is as a definition is frequently misguided

14:07 clojurebot: In Ordnung

14:09 amac: fliebel: yeah, its a seq of elements. I do a pass over the elements separating them into two sets based on their relationship, but if I hit an element without a relationship to one already processed its either disjoint (needs to be processed as its own graph) or needs to be processed when another element has been processed which has a relation to it

14:12 fliebel: I think reduce works. As I understand it, you could have the initial value as an empty seq of subgraphs, and then, for every element, either start a new subgraph, add it to one, or if it connects 2, concat them.

14:13 amalloy: fliebel: seconded

14:15 amac: that would get you the set of disjoint graphs in one pass, and then you can work on each of them individually

14:15 fliebel: Remotely related: You could make a zipper for a graph, and have it walk in circles :D

14:16 amalloy: although, fliebel, i suspect you could speed things up by having the reduce/accumulator value be a map of nodes to the subgraph they're in, so that you can do fast lookup of the two endpoints of a node to see what graph they're in

14:16 rather than a seq

14:18 fliebel: amalloy: I would agree with you, if I had any understanding of graphs.

14:20 amalloy: anyway, i'm off. ta-ta

14:21 fliebel: bye

14:21 amac: man, you're right that would simplify life considerably... most of the headaches were from pickning out the disjoint elements.

14:22 fliebel: amac: When you're done, I'd love to see it. I'm curious to the graph stuff.

14:24 amac: fliebel: sure

14:45 fliebel: oooh, now even node and redis have hosted services. waiting for clojure...

14:48 sritchie: hey all -- what's the best way to split a string in half? I have "003002", and want two strings "003", "002" -- I can do a clojure.contrib.string/partition by a regex matching a 3 digit number, but that feels clunky

14:51 ,(map (partial apply str) (partition 3 (drop 2 "12003002")))

14:51 clojurebot: ("003" "002")

14:52 sritchie: actually, this is the end goal:

14:52 ,(map #(Integer/parseInt %) (map (partial apply str) (partition 3 (drop 2 "12003002"))))

14:52 clojurebot: (3 2)

14:56 fliebel: &(let [s "1234567890"] (map (partial apply str) (split-at (/ (count s) 2) s)))

14:56 sexpbot: ⟹ ("12345" "67890")

14:57 fliebel: You use of partition and drop seems to suggest you don;t just want to split it.

14:58 sritchie: ^

14:59 sritchie: fliebel: sure, I should describe what I'm doing -- I've got a string of the form "DDXXXYYY", where XXX and YYY are representations of integers (x and y coordinates of a NASA MODIS tile)

14:59 fliebel: I don't care about d -- I just want those two substrings, represented as integers

14:59 s/d/DD

14:59 sexpbot: <sritchie> fliebel: I DDon't care about DD -- I just want those two substrings, representeDD as integers

15:02 fliebel: &((juxt #(subs % 2 5) #(subs % 5 8)) "DDXXXYYY")

15:02 sexpbot: ⟹ ["XXX" "YYY"]

15:04 fliebel: sritchie: In that case, this is the best I can do.

15:05 It even doe structural sharing with the original string :)

15:05 sritchie: fliebel: haha, more efficient than mine!

15:06 it'd be nice if clojure.contrib.string had a partition method that took a number n, like core's

15:06 rather than just a regex

15:06 anthony__: I'm stuck on something that I think is trivial. I want

15:07 to have a separate thread print "Hi", and (future (println "Hi")) works for that.

15:07 But (repeatedly 5 (future (println "Hi"))) doesn't work (to do 5 threads). What am I doing wrong?

15:07 fliebel: sritchie: There is clojure.string now ;)

15:07 anthony__: repeatedly takes a function.

15:08 anthony__: *sigh* Thanks...I knew that, too.

15:08 fliebel: But you want pmap or pcalls I think.

15:08 anthony__: Ah! I tried pmap first, but it didn't quite work. Never heard of pcalls, and it looks perfect.

15:09 fliebel: or pvals if you don;t want to make functions ;)

15:09 markskilbeck: Hi, all. Regarding convention, when does one use naming such as *symbol*?

15:10 fliebel: markskilbeck: For vars that can be dynamically changed, via binding.

15:10 sritchie: markskilbeck: earmuffs! from the clojure assembla:

15:10 Use *earmuffs* only for things intended for rebinding. Don't use a special notation for constants; everything is assumed a constant unless specified otherwise.

15:10 http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards

15:10 markskilbeck: fliebel, sritchie: Thank you very much.

15:10 anthony__: fliebel: I'm having trouble finding documentation for pvals. Is that in a separate library? (doc pvals) doesn't work in my REPL

15:11 fliebel: oh maybe it's pvalues or whatever.

15:11 markskilbeck: ,(doc pvalues)

15:11 clojurebot: "([& exprs]); Returns a lazy sequence of the values of the exprs, which are evaluated in parallel"

15:11 anthony__: fliebel: markskilbeck: Thanks. Sorry for the trivial questions.

15:13 sritchie: ,(map (partial subs "11222333") [2 5] [5 8])

15:13 clojurebot: ("222" "333")

15:13 sritchie: works, but is misleading!

15:15 fliebel: &(map (partial apply subs "11222333") [[2 5] [5 8]])

15:15 sexpbot: ⟹ ("222" "333")

15:17 sritchie: fliebel: not misleading anymore

15:17 fliebel: &(map (partial apply subs "11222333") (partition 2 1 (range 2 9 3))) ; evil

15:17 sexpbot: ⟹ ("222" "333")

15:18 fliebel: &(map (partial subs "11222333") (range 2 6 3)(range 5 9 3))

15:18 sexpbot: ⟹ ("222" "333")

15:19 fliebel: okay, the [[2 5] [5 8]] was the best

15:19 sritchie: on monday, I'm going to get the other two guys on my team switched over from python to clojure --

15:20 I'll include all of these as anonymous functions with documentation, to give them some samples of

15:20 the many ways to slay a fn

15:20 fliebel: sritchie: What kind of stuff are you working on?

15:21 sritchie: fliebel: a hadoop project, using nathanmarz's cascalog, to predict deforestation rates in tropical areas

15:21 we're using NASA's MODIS tile data, with a few other sources

15:21 MODIS tiles supply their TileID in that "AAXXXYYY" format... I just needed a quick parser to get the x and y coordinates of a tile

15:22 fliebel: sritchie: So you're actually changing from Python to Clojure mid-project?

15:22 sritchie: fliebel: they've finished a first version of the project, that works with EC2, but it's quite fragile

15:22 http://www.cgdev.org/section/initiatives/_active/forestmonitoringforactionforma

15:23 fliebel: it's working with 1000m data -- nasa provides 500m and 250m, which will be far better, but the current system doesn't scale

15:23 I'm redoing it in clojure, with hadoop -- it's probably going to clock in at 10% of the code, something like that

15:23 what with shedding the file IO, etc

15:26 fliebel: sritchie: Very good work!

15:27 sritchie: fliebel: it's been really fun

15:30 arohner: is there a "drop-nth" function anywhere, or do I need to write it? i.e. returns a seq with the nth item missing

15:30 fliebel: sritchie: Do you also monitor forest *growth*? It would be interesting to compare.

15:30 sritchie: that's really interesting, I'm sure it would be

15:30 fliebel: (mapcat (partition 4))

15:30 sritchie: we don't do that now

15:31 but with clojure, everything becomes far more composable

15:31 so we can play with different methods of analyses, or pull in new datasets with little effort

15:31 doubleagent: What is wrong here? https://gist.github.com/812758

15:32 markskilbeck: I'm trying to generate a vector, x * y in length, of random numbers, though I don't know much (if any) Clojure. Any hints? Preferably *not* code.

15:33 doubleagent: oops

15:33 fliebel: sritchie: Great! Saying "Xkm^2 of deforestation" is not very meaningful without knowing how much new forest there is. ;)

15:33 markskilbeck: doubleagent: at a glance, I'd say its existence, or lack thereof, is the issue.

15:33 ;)

15:33 sritchie: we're tracking the percent probability that a given square kilometer of forest has been deforested, and projecting that forward in time

15:34 Chousuke: markskilbeck: into, rand-int, take and repeatedly :P

15:34 sritchie: fliebel: but you're right!

15:34 markskilbeck: Chousuke: thank you, sir!

15:35 doubleagent: markskilbeck, lol. specifying the context should provide it. Just wanted to know if this is a Cake bug or what?

15:35 fliebel: Chousuke: into?

15:36 Chousuke: fliebel: for the vector.

15:36 fliebel: but I guess vec works too

15:36 fliebel: right

15:37 Chousuke: Another thing to consider is, if he does not know Clojure very well, does he really want a vector.

15:37 markskilbeck: I'm right here, guys.

15:37 fliebel: markskilbeck: How is it going?

15:38 markskilbeck: fliebel: uno momento.

15:42 ,(repeatedly 16 #(rand-int 10))

15:42 clojurebot: (8 6 6 8 8 4 6 7 3 4 ...)

15:42 markskilbeck: Is that along the right lines?

15:42 Chousuke: yes.

15:42 markskilbeck: Badassery.

15:42 Chousuke: actually I forgot repeatedly takes a count argument too :)

15:42 markskilbeck: It being a vector isn't important, I don't think.

15:42 doubleagent: sorry about that - here's the issue: https://gist.github.com/812768

15:43 markskilbeck: When should one user a vector, when should one use a list, etc.?

15:43 Chousuke: use seqs whenever you can

15:43 if you need random access, use vectors

15:44 vectors are also good for literals wherever you need a seq

15:44 markskilbeck: Chousuke: could you elaborate on that last statement?

15:45 Chousuke: most functions that want a seq actually call the seq function on the argument

15:45 so you can pass a vector instead and it works

15:46 markskilbeck: Ah, I see.

15:46 Chousuke: ie. you can just call (foo [1 2 3]) instead of (foo (list 1 2 3)) or something.

15:46 markskilbeck: Jolly good.

15:47 LauJensen: hiredman: Looks like you got caught with your hand in the cookie jar :(( http://www.youtube.com/watch?v=oJagxe-Gvpw

15:49 danlarkin: that's not very nice Lau

15:49 LauJensen: danlarkin: I didnt record it, its some security guy who put up honeypots

15:49 (promise)

15:49 doubleagent: solved it - it wasn't pulled into the namespace

15:50 danlarkin: oh, honeypotting is fine, but insulting hiredman is rude

15:50 LauJensen: danlarkin: hehe, thats funny you should say so

15:50 fliebel: ghe, is hiredman a haxor who runs perl all the time on windows SP3?

15:50 doubleagent: ninjudd, there's an error in your documentation

15:52 fliebel: LauJensen: Why is that funny?

15:53 LauJensen: fliebel: I think its fairly common knowledge that hiredman is one of the most rude and insulting personalities in the land of clojure, so objecting to having some fun with him is at best funny, at worst hypocritical

15:55 fliebel: … I never noticed that.

15:55 markskilbeck: Man I love the song on that video.

15:56 LauJensen: markskilbeck: yea its great

15:59 fliebel: http://xkcd.com/481/

16:01 markskilbeck: Thankfully no one is around to hear me singing falsetto ^-^

16:01 LauJensen: fliebel: haha, that would be great

16:01 markskilbeck: haha

16:01 fliebel: http://freetts.sourceforge.net/docs/index.php + sexpbot :)

16:03 jaskirat: fliebel: that would be fun! :)

16:04 fliebel: jaskirat: One would need to couple it with an upload service… but it's an interesting idea...

16:04 * fliebel imagines the servers at amazon starting to talk

16:06 jaskirat: fliebel: hmm, soundcloud.com?

16:08 fliebel: jaskirat: http://code.google.com/p/soundcloudapi-java/

16:11 I'm all for it! $speak nickname -> soundcloud link of last message :D

16:13 jaskirat: fliebel: soundcloud + emms

16:13 fliebel: http://www.emacswiki.org/cgi-bin/wiki/EMMS

16:13 fliebel: never used emms though.. hmm

16:15 fliebel: time to go

16:15 bye

16:25 shortlord: how can I evaluate a form in a macro? I am passing 2 forms, the first should be evaluated to decide whether to execute the second form or not

16:26 Chousuke: why not just generate an if expression? :/

16:29 if you want a conditional expansion you can use eval but be aware that it's limited

16:29 shortlord: Chousuke: doh, of course! thx a lot, it works now

16:29 sritchie: hey all -- if i have something like this --

16:29 ,((juxt #(* 2 %) #(vector 2 %)) 3)

16:29 clojurebot: [6 [2 3]]

16:29 sritchie: ie, one function that returns a number, one that returns a collection,

16:29 shortlord: Chousuke: I still have quite a few problems to think of macros purely in terms of code transformation

16:29 jassi: shortlord: some thing like (defmacro x [f1 f2] `(if (f1)(f2)))


16:29 Chousuke: shortlord: yeah, macros don't really "execute" code.

16:30 sritchie: what's the best way to end up with a list of all of the numbers, merged?

16:30 Chousuke: shortlord: they just generate it and the result is what gets run at runtime.

16:30 sritchie: to cons or merge them all, and end up with a list one deep

16:30 shortlord: sritchie: what do you mean, 'merged'? you can use 'flatten' to put all the elements into one big list

16:30 jassi: shortlord: oops that should be ~f1 & ~f2

16:31 sritchie: shortlord: flatten sounds right

16:32 shortlord: Chousuke: yeah, macros definitely are a fascinating topic. I really need to get a bit more practice with them

16:33 Chousuke: shortlord: honestly the trickiest thing about macros is knowing when to use them :)

16:35 shortlord: Chousuke: that's what I am still figuring out. So far I have been using them as little as possible, preferring functions wherever possible and just using them in cases like this where the arguments must not be evaluated

16:38 Chousuke: shortlord: that's a good rule of thumb :P

16:38 shortlord: hah, nice :D

16:39 jaskirat`: whats the best way to look up documentation for clojure functions while inside the repl? i thought the :doc would be the best way but doesnt seem to work. like python has help() or __doc__, something like that?

16:40 kjeldahl: ,(doc vec)

16:40 clojurebot: "([coll]); Creates a new vector containing the contents of coll."

16:40 shortlord: jaskirat`: doc should work, simply do (doc some-name)

16:40 jaskirat`: thanks guys

16:40 i was trying (:doc blah)

16:41 amac: you can also use (source some-name) if you need more information

16:41 will show you the implementation

16:42 jaskirat`: amac: hmm, that should be usefull sometimes

16:43 amac: jaskirat`: if you wanted to learn more about macros, source some macros for inspiration :)

16:44 jaskirat`: amac: :)

20:52 hiredman: https://github.com/ztellman/lamina/blob/master/src/lamina/core/fn.clj#L17 well that looks familiar

21:36 sritchie: hey all -- is it possible to define an array of unsigned integers in java?

21:37 brehaut: sritchie: if there are unsigned integer primatives (i dont think there are) then yes, otherwise no?

21:37 sritchie: brehaut: I didn't think there were unsigned int primitives, just wanted to check if anyone had had to deal with that issue

21:38 brehaut: people must have dealt with it in javaland at least

21:38 sritchie: the goal is to get out of javaland as fast as possible!

21:39 brehaut: in any case, problem avoided, the REPL tells me this method will read into a java primitive byte array

21:39 progress!

21:52 when did clojure start supporting doc strings on def?

21:53 I'm using leiningen, with 1.2, and still getting "Too many arguments to def"

22:04 mreynolds: sritchie: You may be interested to know that Java bytes are also signed http://www.jguru.com/faq/view.jsp?EID=13647

22:04 I think it's a bytecode thing. Anyway, if you have something that works, awesome.

22:06 sritchie: mreynolds: no, that's helpful. I'm interacting with a java object, a dataset, that needs to take an array and read into it -- it takes an optional parameter for datatype, and I know that the source data is either an unsigned byte, signed int (16 bits) or unsigned int

22:07 the default, with that parameter left out, is an array of 32 bit ints

22:07 which makes sense, given that we're talking about a java API

22:08 mreynolds: sritchie: I have strong memories of Java only having signed types, primarily because of the simplicity of dealing with fewer types at the bytecode level, but don't hold me to that. Are you just passing the data through, or are you trying to deal with it in clojure/java?

22:09 sritchie: the ReadRaster method on this object takes that int array and a few other things, and fills it with ints -- then I'm creating a lazy seq with (indexed (partition chunk-size array))

22:09 which serializes the data back out into hadoop-land

22:53 has anyone had trouble with a docstring on def?

22:53 defn works great, of course, but def won't accept one -- i get a "too many arguments to def" error

Logging service provided by n01se.net