#clojure log - Apr 26 2008

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

1:43 gomer-nyc: Hi there

15:08 gomer-nyc_: Hi

15:09 Is it possible to supply default values for optional function parameters?

19:12 leafw: question: is there any way to call super.someMethod from a proxied class? The docs say no calls to super. , but there may be other ways perhaps?

19:13 through reflection, the invoke() would end up invoking the overriden method I think, in any case.

19:25 another question ...

19:25 mapping functions to collections is obvious, but to array elements ?

19:25 I'd appreciate a hint here

19:34 but the channel is dead. Oh well.

19:48 no (seq (make-array (. java.lang.Byte TYPE) 100)) unfortunately ..

20:51 hi all

20:51 once more, searching for an answer

20:51 rhickey: what's the question/

20:51 ?

20:51 leafw: I'd appreciate info on whether it's possible at al to map a function to each element of a native array

20:51 such as a byte[] array

20:52 rhickey: in place? no

20:52 leafw: argh

20:52 how do you approach it then?

20:52 looping ?

20:53 rhickey: you could. or, since map produces a seq, you could turn that into another array.

20:54 leafw: I'm doing image processing. Duplicating arrays is undesirable (too largE)

20:54 rhickey: map-array would be a simple function to write

20:55 leafw: about looping ,b ythe way, I can't loop native arrays either - I am not getting the syntax right

20:56 rhickey: you can paste to: http://paste.lisp.org/new/clojure

20:56 leafw: thanks

20:56 lets try

21:00 I knowvery little lisp unfortunatley, starting ... so the API (loop [bindings & body]) doesn't get me too far at all

21:00 I would expect (loop [i 0 100] ...) where 0=start 100=end

21:05 lisppaste8: leafw pasted "byte array looping" at http://paste.lisp.org/display/59794

21:05 leafw: hum nice pastebin system

21:07 why the pasted code fails is beyond me. (aset pix 10 (byte 14)) works just fine.

21:20 rhickey: (dotimes i (count pix)

21:20 (aset pix i (byte 42)))

21:21 leafw: thanks

21:21 and why not aset-byte instaed?

21:22 (loop [i (- (alength pix) 1)] (aset-byte pix i (byte 14))) seems to work too

21:23 rhickey: loop without recur is not right

21:23 leafw: actually no ... no erro,r byt the pixels are not set.

21:24 I see, recur calls he loop agai nwith the iterator manually updated ... urghs

21:26 looks like loop is really a let with a recursion system tied in.

21:26 rhickey: yes, it's recursive looping, not iterative looping

21:27 leafw: a new kind for me.

21:27 thanks for helpingout with these basic questions.

21:27 rhickey: sure

21:30 leafw: I have built a clojure command line as a plugin inside ImageJ so that I can start learning lisp finally, within the context of my everyday lab problems.

21:31 the very first plugin was a modified version of the temp translator from the website, with propernumber format error checking and hint suggestion.

Logging service provided by n01se.net