4:30 arbscht: is there anything like CL's return-from in clojure?
4:31 hoeck: i guess no
4:32 but i wondered if one really needs it
4:33 arbscht: I'm writing a function that uses reduce, and I want to terminate and return the accumulated value upon encountering some condition
4:34 without looping, I can't think of another way to do it
4:35 hoeck: you could throw an exception, but i don't know wether that is `good' style
4:36 arbscht: eurk, that would require encoding the value in a Throwable
4:36 hoeck: yeah, thats pretty ugly
4:37 and what about filtering the sequence before reducing?
4:38 arbscht: order matters, I'm parsing a list of symbols and some are terminators
4:40 well I suppose I could do a search and slice for this particular case
4:40 not sure if that's general enough or as elegant
4:45 hoeck: mhh
4:50 the problem is that `loop' blocks are not named
4:51 so there is no way to `jump' out of (fn [] ..) :(
4:57 arbscht: with loop I can choose not to recur
4:57 not possible to jump out of reduce
5:11 oh lovely
5:11 take* works
5:11 even better than jumping out of reduce
5:12 kids, this is why you don't try to port code across languages line by line
5:14 hoeck: what means better?
5:14 shorter, clearer, simpler ?
5:14 arbscht: yep
5:15 1 vs 11 loc
5:15 it looks fine inline, no need to roll a function
5:20 hoeck: thats a lot of reduction
5:21 arbscht: this is really typical of porting CL code to clojure I find
5:21 maybe not a factor of 11 but say 4 or 5 at least
5:21 hoeck: but then it was bad cl code !?
5:21 arbscht: not necessarily
5:22 maybe not the best but it's not convoluted or anything
5:22 it's easily readable etc
5:24 for example, in swank they have an interface/implementation pattern that doesn't use generic functions
5:24 instead they clobber symbol-plists to overload
5:24 lots of yak shaving there
5:25 I rewrote that with clojure multimethods in less than half the space
5:26 hoeck: i like them too
5:27 but the feature i'm using most is destructuring in let and fn
5:28 arbscht: I haven't had to use it yet!
5:28 mainly because I'm rewriting cl stuff
5:28 hoeck: it's nice of you work with vectors and maps
5:28 arbscht: well, I haven't used destructuring in let, but a little in fn
5:29 right
5:30 hoeck: or functions that return multiple values, i always felt bad when i wrote those nested let/destructuring-bind/multiple-value-bind statements
5:31 now everything is a single let :)
5:32 arbscht: yeah it seems d-b and m-v-b are not all that popular in cl code because of that
5:34 hoeck: so you're hacking a slime-backend for clojure?
5:34 arbscht: yeah
5:35 I got a bogged down having to learn java.nio
5:35 bsd sockets are so much easier :?
5:35 :/
5:39 hoeck: mhh, i've never done any network stuff
5:42 but i prefer java libs to ffi bindings
5:42 have you sth. working yet?
5:45 arbscht: partial
5:45 main loop starts but I need to figure out managing threads
5:45 first time doing concurrency in java also
6:00 hoeck: yeah, it's pretty easy to start threads, start threads, start threads .... but i have no way of controlling them
6:01 i played a bit with java.lang.management
6:04 and decided that i need som clojure code like list-threads and kill-threads
7:45 arbscht: can someone give me a simple example of using set in a transaction with a ref
7:56 hoeck: thats called `ref-set' now
7:56 arbscht: oh
7:56 hoeck: set constructs a set from a seq
7:57 arbscht: that explains a lot
7:57 doc's behind the times
7:57 thanks
7:57 hoeck: yeah
10:00 cgrand: rhickey: you're right. Despite http://
10:00 rhickey: thanks
10:01 Chouser: what's "take*"?
10:02 arbscht: Chouser: the various take functions
10:02 Chouser: ah. (doc take*) wasn't getting me anywhere.
10:03 :-)
10:03 arbscht: heh
10:03 rhickey: distinct now lazy
10:07 Chouser: ":as"!?
10:08 soi does [f & r :as xs] give you first, rest, and the whole thing?
10:08 rhickey: yup
10:08 Chouser: very cool.
10:08 rhickey: also in map destructuring
10:17 Chouser: is that new?
10:17 rhickey: no, always been in destructuring
10:17 hoeck: any suggestions on profiling clojure?
10:18 Chouser: ok
10:18 rhickey: hoeck: Netbeans has free profiler, but is not happy with non-Java source
10:22 hoeck: aha
10:22 and the time macro? or is that too inaccurate??ERC>
10:23 rhickey: time uses nanoTime()
10:27 added if-let, when-let and replace
10:29 hoeck: how is if-let used?
10:30 rhickey: (if-let name test then else) => (let [name test] (if name then else))
10:30 it's used in replace for an example
10:33 sane alternative to anaphora
10:33 hoeck: nice
10:38 rhickey: on that note, nested #()s now disallowed
10:38 Chouser: heh. yeah, probably wise.
10:42 rhickey: hoeck: also note that for 'manual' profiling, all defns are stored in vars...
10:43 therefore they can be dynamically rebound to counting versions, without changing code that uses them
10:46 hoeck: i see, but i'm afraid of the overhead that my 'manual' profiling imposes, so i thought to first look for a native java profiler
10:48 but modifying (time ) seems easier right now :)
10:49 rhickey: I don't mean to sway you from trying a native profiler - Clojure emits the correct SourceDebugExtensions that should aid debugging/profiling