#clojure log - Jun 16 2010

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

0:23 Licenser: a wonderful good morning my lispy friends

0:52 unfo-: what would be the best place for me to read about ^:static (in reference to : http://gist.github.com/440102 )

0:53 tomoj: perhaps http://clj-me.cgrand.net/2010/06/10/primitive-types-support-for-fns-coming-to-a-clojure-branch-near-you/

0:55 vIkSiT: hello all

0:55 is there a way to convert a string to a keyword?

0:55 unfo-: tomoj, did you just google that for me?-)

0:55 tomoj, well any way, thank you, good sir!

0:55 tomoj: I remembered that cgrand had blogged it

0:56 vIkSiT: for instance, i'm retrieving a string value from a map - and wuld like to use it as a key to access another map. so "field" should become :field

0:56 tomoj: ,(keyword "field")

0:56 clojurebot: :field

0:56 rbxbx: (doc keyword)

0:56 clojurebot: "([name] [ns name]); Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."

0:56 vIkSiT: argh :)

0:56 didn't think it would be that simple

0:56 thanks guys

0:56 rbxbx: np.

1:06 tomoj: wow. the slow (fib 38) is 15x slower on my computer than rich's

1:06 vIkSiT: hmm, is there a way to clear a variable definition from the REPL?

1:07 as in, if its defined in a particular namespace - can it be "removed" from that namespace?

1:07 rbxbx: ns-unmap

1:07 (ns-unmap symbol)

1:08 dnolen: nice 1.2 num branch can do 1 billion math ops in < 700ms, no type hints on my laptop.

1:10 tomoj: american "billion" or otherwise?

1:12 dnolen: tomoj: 10^9

1:12 tomoj: a math op in less than a nanosecond.. crazy

1:13 unfo-: woot?

1:14 dnolen: unfo-: yes, woot :D

1:38 aria42: k

1:40 rbxbx: vIkSiT: (ns-unmap *ns* 'symbol) rather.

1:40 vIkSiT: rbxbx, ah thanks!

1:40 rbxbx: np, pardon the initial error ;)

2:22 TheBusby: tomoj: is there an English speaking country that still uses the long scale for billion? (just curious)

2:25 tomoj: apparently not

3:23 vIkSiT: hmm is there a way to empty a map?

3:23 tomoj: ,{}

3:23 clojurebot: {}

3:23 tomoj: :)

3:24 vIkSiT: haha

3:24 I've been poring over methods using reset!, alter and dissoc

3:24 gah

3:25 tomoj: you have an atom?

3:26 reset! should be fine

3:26 vIkSiT: no, a ref.

3:26 (dosync (alter mymap {}))

3:26 tomoj: oh, refs don't have anything like reset! afaik

3:26 vIkSiT: yeah, not that I could find

3:26 tomoj: so you need (alter mymap (fn [_] {}))

3:27 vIkSiT: I thought {} was a function in this case..

3:27 its a persistent array map.. which should act as a fn anyway

3:27 tomoj: oh, wait

3:27 (doc ref-set)

3:27 clojurebot: "([ref val]); Must be called in a transaction. Sets the value of ref. Returns val."

3:28 vIkSiT: ah

3:28 tomoj: "(alter mymap {})" would just set the ref to nil

3:28 G0SUB: vIkSiT

3:28 vIkSiT: right

3:28 G0SUB

3:28 G0SUB: Need some help with Enlive...

3:29 amazing library, but quite complex too :)

3:29 the selector syntax is quite difficult to master

3:29 Chousuke: isn't it mostly just CSS selectors with : in front?

3:30 G0SUB: I have a bunch of tr nodes, and I want to extract the content of every td node in those tr nodes.

3:30 Chousuke, what's the best way to do the above?

3:31 vIkSiT: wwmorgan, test?

3:31 Chousuke: G0SUB: [:tr :td]? or something

3:32 vIkSiT: ,(empty {:a 1 :b 2})

3:32 clojurebot: {}

3:32 tomoj: oh, or that :)

3:32 vIkSiT: :)

3:32 Chousuke: that should select all td elements that are children of tr elements

3:32 vIkSiT: thanks to wwmorgan who for some reason is speechless :P

3:33 G0SUB: Chousuke, hehe :) I want it like this ((row1td1 row1td2 row1td3) (row2td1 row2td2 row2td3))

3:33 Chousuke, I need the TDs to be grouped by their TRs

3:33 Chousuke: G0SUB: I suppose you'll need to select all trs first then and map a selector over those?

3:33 G0SUB: Chousuke, right. I am doing that now.

3:34 Chousuke, I am getting the TD nodes, but I need to extract the contents too.

3:37 Chousuke: G0SUB: the elements should be just maps with :content but I suppose there is a selector for that too

3:38 G0SUB: Chousuke, I am looking for a way to avoid multiple map operations

3:39 wwmorgan: vikSiT: test. Everything works now :-)

3:39 vIkSiT: wwmorgan, aha :) what was the problem?

3:39 bsteuber: is it possible to extend a protocol to a single instance?

3:39 Chousuke: G0SUB: why? map is lazy.

3:39 bsteuber: no.

3:39 G0SUB: Chousuke, I agree. Just looking for a more a compact syntax

3:39 wwmorgan: needed to register with NickServ

3:39 bsteuber: Chousuke: thx, I thought so

3:40 Chousuke: G0SUB: maybe you can use comp :P

3:40 G0SUB: Chousuke, hehe

3:41 vIkSiT: wwmorgan, aah

3:42 hmm, so whats the best method to serialize a clojure data structure for disk-storage?

3:42 (lets say I have a protocol/record combo that needs to be read)

3:44 Chousuke: the best method depends on what your actual needs are. You can use a real database if you have a lot of data and need speed, or you can just convert the data to a map and print it out if that's enough.

3:44 you're going to need custom logic for reading/printing in any case

3:47 vIkSiT: Chousuke, well, I'm actually _building_ a database :) so I have to use file storage of some form. For instance, I have a tree representation that I'd like to serialize for a table into a file..

3:47 Chousuke: well, hm

3:48 records are not serialisable or readable so you'll have to convert them to something

3:48 vIkSiT: right

3:48 Chousuke: a map might be enough, but of course it's not very efficient.

3:49 for a speedy database, you'd have to come up with your own binary encoding.

3:49 vIkSiT: btw, when you mean "readable - you mean something like binding *print-dup*?

3:49 Chousuke: I mean you can't use read to read the output of pr on a record.

3:49 though that limitation might go away eventually

3:50 vIkSiT: ah I see

3:51 so in order to convert a data structure to a binary format - what would you recommend reading?

3:51 (as in, what clojure functionality could I use best?)

3:51 Chousuke: I'd recommend using some library but hm :P

3:52 I suppose that kind of stuff goes to java land; you'll need to use the IO facilities.

3:52 vIkSiT: hehe yeah I guess I'd better use that

3:52 Chousuke: if you're using 1.2 don't forget clojure.java.io

3:54 vIkSiT: ooh good point

4:00 TheBusby: cd

4:01 whoops, sorry, wrong winow

4:01 window

4:29 LauJensen: Morning team

4:30 TheBusby: morning

4:31 fyuryu: aloha

4:48 naeu: good morning :-)

5:08 tomoj: I can't get overtone working :/

5:09 naeu: tomoj: join #overtone and I'll see if I can help you...

5:19 G0SUB: Can Clojure get a CL-ish conditions/restarts facility in the future?

5:21 hoeck: G0SUB: there is something similar already in contrib, I believe

5:22 G0SUB: hoeck, error-kit? It doesn't (and can't) have restarts, unfortunately

5:22 hoeck: right, error-kit

5:24 Chousuke: G0SUB: I suspect such features would depend on JVM support

5:24 hoeck: G0SUB: the other one was clojure.contrib.condition

5:25 Chousuke: G0SUB: unless you want to emulate them with exceptions and other trickery

5:25 G0SUB: Chousuke, I agree. I was wondering if C in C might help.

5:26 hoeck: couldn't you emulate restarts with dynamic variables, which are bound down the stack and called immediately when a function raises an exception?

5:26 instead of actually throwing that exception?

5:26 G0SUB: hoeck, In theory, yes :)

5:27 hoeck: and in practice, is that to slow? I thought this is done by either c.c.error-kit or c.c.condition

5:27 *too slow

5:27 Chousuke: JVM exceptions can be pretty fast if they're preallocated

5:29 IIRC John Rose mentioned in his blog that the most time is spent creating the stacktrace when an exception is allocated

5:29 and if an exception is preallocated the JVM can in some cases compile a throw into a simple goto

5:30 G0SUB: Chousuke, the problem is that with restarts, you can't unwind the stack.

5:33 Chousuke: I suppose technically the JVM could support continuations and restarts, they just don't-

5:35 G0SUB: Chousuke, may be some day :)

5:38 Chousuke: http://blogs.sun.com/jrose/entry/continuations_in_the_vm

5:39 It seems unlikely to happen though.

6:52 defn: the idea of tries, applied to all other sorts of disciplines like evolutionary psychology has far reaching consequences for the validity of their sciences

6:53 silveen: when ordering the Joy of Clojure book with MEAP, the ebook is drm free I hope?

6:53 defn: namely, that it enhances it. it seems a systematic methodology for subdividing groupings of events

6:54 silveen: it is i believe -- it may have your name on it

6:54 like "This PDF Generated for: silveen"

6:54 but that's it

6:54 silveen: okey defn

6:55 I just cba with alot of "do view this, please visit this website, follow 300 steps, download, fail, call customer support, pay $100 in phone fees, follow 50 more instructions, reinstall OS, do everything again, read once and then "thanks for shopping at yahoo"

6:55 clojurebot: :negative/num-1 + :positive/num-1 = :zero/zero

7:36 bartj: hi, compiling clojure-contrib fails because of a test failure in the clojure.contrib.test-jmx

7:43 hugod: a

7:43 clojurebot: a is b

7:44 serp_: b

7:45 rhickey: so, has anyone tried the num branch?

7:45 http://github.com/richhickey/clojure/commit/6ab3e4cd672092823a04c944210a23c29142785d

8:06 dnolen: rhickey: did you see my comment about areduce and amap in the num branch?

8:06 rhickey: dnolen: no

8:06 dnolen: rhickey: they still use unchecked-inc

8:06 rhickey: dnolen: ah

8:06 so much for test coverage :(

8:13 dnolen: fixed, thanks

8:13 serp_: context: server for computer game. problem: I have store a bunch of info about a game character in a ref. I use add-watch to catch when a modification is done to a character, and then check compare the old and new value of every attribute of the character to see what changed and sends messages to all client about the update. this feels very clumsy as there are a lot of compares. might it be a better design choice to have each attribute as a ref?

8:15 AWizzArd: serp_: can't you signal something at the place where you change the specific field?

8:16 Some code currently is handling the attribut update...

8:16 +e

8:17 serp_: I don't want to require the behaviour code to understand how the network updates work

8:17 dnolen: rhickey: num branch is impressive!

8:17 rhickey: does aset need fixing as well?

8:17 serp_: I want (set-pos player1 14 15) to both update the server state AND, as a side effect, send this update to all clients

8:18 AWizzArd: serp_: the behaviour code could trigger an action... :strength-updated

8:18 tomoj: ref proliferation seems dangerous to me

8:18 rhickey: dnolen: how so?

8:20 dnolen: rhickey: lemme check, putting together an example of what I'm seeing

8:24 rhickey: sorry. no everything seems to be working. was calling rand-int and missing a cast to long when inserting with aset.

8:24 rhickey: why did you need cast?

8:26 dnolen: rhickey: aset for an array of longs

8:27 rhickey: dnolen: still, why, what was happening? couldn't resolve? there should be little need for casts in num

8:27 dnolen: rhickey: http://gist.github.com/440593

8:28 rhickey: what exception

8:29 dnolen: rhickey: no matching method foudn

8:30 gist updated

8:40 rhickey: hmm, it seems like I'm seeing perf regression again on (doall (map inc (range 1000000))) in num branch.

8:42 serp_: AWizzArd: I guess... but that would be the same as having a bunch of refs and add-watches, only not automagical

8:43 rhickey: dnolen: not here, make sure you do: (dotimes [_ 10] (time (count (doall (map inc (range 1000000))))))

8:46 dnolen: rhickey: you're right, issue seems to be around the use of into? http://gist.github.com/440617

8:46 AWizzArd: rhickey: I sometimes do the same, using count to enforce map to fully traverse its input list. But why do you use doall here? Count should be enough, shouldn't it?

8:47 rhickey: AWizzArd: I just wrapped what dnolen already had

8:49 dnolen: rhickey: erg, disregard last gist, that's the same perf as pre-num, sorry.

8:49 rhickey: dnolen: and your vector one times doing it 10x, not once

8:50 dnolen: should be: (dotimes [_ 10] (time (count (doall (map inc bigv))))) for apples to apples vs the range

8:54 dnolen: rhickey: yup

9:12 AWizzArd: ,(clojure.lang.MapEntry/create [1 2])

9:12 clojurebot: java.lang.IllegalArgumentException: No matching method: create

9:12 AWizzArd: Is that already fixed in recent versions?

9:13 ,(binding [*print-dup* true] (println (first {1 2})))

9:13 clojurebot: #=(clojure.lang.MapEntry/create [1 2])

9:33 rhickey: nice: http://www.infoq.com/news/2010/06/azul_ori

9:35 silveen: Does anyone know if Mannings ebook server being down is a known issue or if it just hates me?

9:39 fogus: silveen: I was just able to download the latest copy of the award-wining MEAP, "The Joy of Clojure"

9:40 Chousuke: :P

9:40 Raynes: fogus: No vested interests there. ;)

9:40 silveen: yeah I bought that a few hours ago

9:40 * fogus misspelling intentional

9:40 silveen: (more money to you)

9:40 but I can't download it, server dw.mannings.com blah blah doesn't respond

9:41 fogus: hmmm. did you follow the link in the email?

9:41 silveen: no I just took a random url from thin air

9:41 ofc I follows the instructions in the email

9:41 followed*

9:42 Raynes: Well, no need to be mean. :\

9:43 fogus: ok then

9:43 silveen: sorry if it was taken as an offensive statement :(

9:43 Raynes: It's not his fault Manning borked their URL. :p

9:44 fogus: the MEAP update that I downloaded came from a different source than dw.mannings.com. So perhaps that server is indeed down.

9:44 support@manning.com

9:44 silveen: dw.manningpublications.com even

9:45 yeah I guess I'll throw them a mail

9:46 AWizzArd: rhickey: indeed, interesting link, thx

9:46 rhickey: so, who's ready for (= 1/2 0.5) => false, (== 1/2 0.5) => true

9:47 AWizzArd: why not the other way around?

9:48 chouser: whew. I don't think that would cause problems with any real code I have.

9:48 AWizzArd: Until now = was similar to equalp, and now you want it to be more like eql?

9:48 rhickey: = becomes type aware, == is equivalent values, = would be used in collection logic as well

9:48 chouser: whew. I don't think that would cause problems with any real code I have.

9:48 rhickey: AWizzArd: I don't want to draw connections to the CL stuff

9:48 AWizzArd: So, == will be the new equalp while = will be the new eql, and identical? stays eq

9:49 rhickey: AWizzArd: contrast with CL will not help with this

9:49 AWizzArd: Anyway, it is a semantic change.

9:49 rhickey: AWizzArd: yes, num branch has semantic changes

9:49 AWizzArd: I also don't think that my code specifically would have problems with that thought.

9:50 chouser: == is currently just for numbers. does that change?

9:50 rhickey: chouser: nope, still for numbers

9:50 AWizzArd: I would vote for == taking all objects, and do a deep comparison of those.

9:51 rhickey: AWizzArd: having a variety of equality logic really complicates things.

9:51 G0SUB: rhickey, Is a CL-like conditions/restarts system possible in Clojure in the future?

9:51 AWizzArd: So, (= [0.5] [1/2]) ==> true or false?

9:51 rhickey: G0SUB: no

9:51 AWizzArd: false

9:51 AWizzArd: And (== [0.5] [1/2]) ==> IllegalArgumentException?

9:52 rhickey: AWizzArd: who is really doing things like that? I only find it in test code

9:52 AWizzArd: exception, yes

9:52 AWizzArd: Don't know, I only speculate that it may sneek in somehow *shrugs*

9:52 chouser: no, == is for numbers, you wouldn't use it on collections like that.

9:53 rhickey: chouser: but people may ask for it if = no longer did numeric equivalence

9:54 chouser: it feels to me like in num the number types are more separated. less automatic conversion between types, etc.

9:54 rhickey: chouser: not really, there are in fact many more automatic conversions

9:54 chouser: oh.

9:55 rhickey: ints now match long params, and vice versa (with check)

9:55 float match doubles

9:55 chouser: ah, I see.

9:55 rhickey: all numeric inits of locals are coerced to wither long or double

9:55 either

9:55 chouser: I should keep my mouth shut until I read the commits more carefully.

9:56 rhickey: It is quite a substantial change, and yet compatible with contrib and argos, with the exception of one long-integer test in Incanter

10:08 AWizzArd: chouser: are your 2-3 Fingertrees mostly completed?

10:11 chouser: they work, but I have performance and api changes that need to be made before they're generally useful.

10:12 and I need to compare/contrast with the Functional Java version of finger trees as well.

10:17 AWizzArd: chouser: are the FJ Fingertrees fully persistent?

10:17 Or only partially?

10:18 chouser: I assume so. the paper that defines the term 2-3 finger tree presents a fully persistent implementation

10:19 mcav: do any of you know where to find (and disable) the setting that turns "fn" into "ƒ" in emacs?

10:20 Chousuke: mcav: that's not a default, so check your init scripts?

10:20 mcav: ok, will do

10:23 ah, found it. It was in the "emacs starter kit" default settings. thanks.

10:43 AWizzArd: cgrand: ping

10:44 cemerick: G0SUB: check out error-kit in clojure.contrib

10:44 (= 1/2 0.5) => is going to flip some people out

10:45 * cemerick just caught up

10:45 cemerick: especially around map lookups

10:46 chouser: I think that's where this will make more sense.

10:46 map lookups currently use equality that is neither = nor ==

10:46 AWizzArd: ,(get {1/2 0} 0.5)

10:46 clojurebot: nil

10:46 AWizzArd: ,(get {0.5M 0} 0.5)

10:46 clojurebot: nil

10:47 AWizzArd: ,(= 0.5 1/2 0.5M)

10:47 clojurebot: false

10:47 AWizzArd: uh

10:47 that last one surprises me

10:47 ,(= 0.5M 0.5 1/2)

10:47 chouser: ,(= 1/2 0.5)

10:47 clojurebot: true

10:47 true

10:47 chouser: ,(= 0.5 1/2)

10:47 clojurebot: true

10:47 chouser: heh

10:47 AWizzArd: ,[(= 0.5M 0.5 1/2) (= 0.5 1/2 0.5M)]

10:47 clojurebot: [true false]

10:48 chouser: whee!

10:48 AWizzArd: I must be blind, I don't see where I have the typo...

10:49 cemerick: AWizzArd: no typo -- semantics of = depend on the callee

10:49 chouser: ,(= 0.5 1/2)

10:49 clojurebot: true

10:49 chouser: ,(= 0.5 1/2 0.5M)

10:49 clojurebot: false

10:49 cemerick: or, I should say, semantics of .equals depends on the callee, and = uses .equals

10:50 AWizzArd: ,[(= 0.5 0.5M) (= 0.5M 0.5) (= 1/2 0.5) (= 0.5 1/2) (= 1/2 0.5M) (= 0.5M 1/2)]

10:50 clojurebot: [true true true true false false]

10:51 serp_: what is M suffix?

10:51 chouser: ,(type 0.5M)

10:51 clojurebot: java.math.BigDecimal

10:52 AWizzArd: ,5.3278569832756932875623985638562357

10:52 clojurebot: 5.3278569832756935

10:52 AWizzArd: ,5.3278569832756932875623985638562357M

10:52 clojurebot: 5.3278569832756932875623985638562357M

10:52 serp_: ,(type (0.5M + 4))

10:52 clojurebot: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to clojure.lang.IFn

10:52 serp_: ,(type (+ 0.5M 4))

10:52 clojurebot: java.math.BigDecimal

11:03 tridd3ll: Does anyone have a current MEAP discount code for Clojure in Action? I can't find one in any email from Manning that I still have.

11:06 fogus: infoq35 was working as of a few days ago

11:07 vu3rdd: ,quit

11:07 clojurebot: java.lang.Exception: Unable to resolve symbol: quit in this context

11:07 vu3rdd: oops.. too much of swank usage. :-(

11:09 tridd3ll: fogus: thanks, I already bought your book and I'm just trying to fill out my library... I'll try that code

11:12 fogus: still works, thanks!

11:12 fogus: yay

11:17 arkh: unlike agents sending off agents, is there anything blocking futures from firing off other futures?

11:17 (outside of something trying to realize a future's value)

11:18 AWizzArd: wb rhickey

11:18 rhickey: sorry, I lost the internets here

11:18 AWizzArd: yes

11:18 something interesting about =

11:18 ,[(= 0.5M 0.5 1/2) (= 0.5 1/2 0.5M)]

11:18 clojurebot: [true false]

11:18 AWizzArd: ,[(= 0.5 0.5M) (= 0.5M 0.5), (= 1/2 0.5) (= 0.5 1/2), (= 1/2 0.5M) (= 0.5M 1/2)]

11:18 clojurebot: [true true true true false false]

11:19 AWizzArd: In NUM I guess they all eval to false.

11:36 rsh: can you specify many to many relationships with clj-record?

11:42 * cemerick just violated all that's good and holy to get around not being able to recur out of a catch

11:43 AWizzArd: (goto 30)

11:51 danlarkin: cemerick: tisk tisk tisk

11:52 cemerick: heh, that's just the way it goes sometimes :-)

11:52 at least it's locked away neatly in a macro

11:53 danlarkin: I "had" to do it once

11:54 I had to refactor a whole bunch of code to not need it anymore

11:54 but I was happier

11:54 chouser: check the return value of the try to see if the recur must be done?

11:55 cemerick: chouser: yup, with an (Object.) sentinel to request a recur.

11:56 danlarkin: in this case, I want to rapidly beat a long series of attachment PUTs into a couchdb document, without restarting three levels out.

12:02 danlarkin: dang

12:03 tricky

12:03 cgrand: AWizzArd: pong

12:12 AWizzArd: cgrand: Hi. Do you remember how transients work?

12:12 internally I mean

12:25 jkkramer: rhickey: (time (dotimes [_ 1e5])) takes over second on the num branch. modifying dotimes to cast its second arg as long fixes it, though i don't know if that's the proper fix

12:27 oh, he's not here

12:29 cgrand: AWizzArd: yeah, sure why?

12:30 AWizzArd: cgrand: while (find {:a 1, :b 20, :c 300} :b) ==> [:b 20]

12:30 with transients I get: (find (transient {:a 1, :b 20, :c 300}) :b) ==> clojure.lang.PersistentArrayMap$TransientArrayMap cannot be cast to java.util.Map

12:31 Is there a good reason why find should not work on transients?

12:34 cgrand: AWizzArd: no good reason, and in the same vein transient vectors don't support peek

12:39 chouser: are the map entries in transient themselves mutable?

12:45 cgrand: chouser: entries are created on the fly

12:48 claj: I try to lein deps in a fresh compojure project according to compojure.orgs getting started, but it says it can't download compojure-0.40-RC3.pom, what to do?

12:51 or, why can't lein reach any of the repositories?

12:54 charliekilo: claj: just to make sure, my lein project references [compojure "0.4.0-RC3"]. i.e. any chance you forgot the '.'?

13:02 nickik: hallo

14:14 yacin: if i have a function defined later on in a file, is there anyway to use it before it's defined?

14:14 i have some globals that require the use of a function

14:14 and it makes more sense for the global to be at the beginning of the file

14:14 rather than at the end where the function is defined

14:15 chouser: (doc declare)

14:15 clojurebot: "([& names]); defs the supplied var names with no bindings, useful for making forward declarations."

14:15 yacin: thanks!

15:50 chouser: cemerick: your twitter link failed for me

15:50 cemerick: really?

15:51 chouser: you mean http://bit.ly/cj89uz ?

15:51 chouser: http://muckandbrass.com/web/display/~cemerick/2010/06/16/The+beauty+of+letterpress+and+craft+and+old+arts+faithfully+renewed reports The proxy server could not handle the request Apache/2.2.12 (Ubuntu) Server at muckandbrass.com Port 80

15:51 cemerick: hrm -- keeps loading OK here :-/

15:53 * cemerick simply wants glassfish to wilt and die

15:53 chouser: nice post though. works fine at http://muckandbrass.com/

15:54 cemerick: thanks -- I'm bouncing the sorry thing

15:57 OK, it shouldn't have problems until, oh, 20 minutes from now.

15:57 serp_: I want to write a tcp server for many (> 10) simultaneous long session clients. Any tips for a noob on how to manage the sockets in a way fit for clojure?

15:58 chouser: serp_: I've read recently that one thread per socket is not a bad way to go. Depending on your application it is often the simplest implementation too.

15:58 * nDuff wouldn't call >10 "many" (or, really, enough to require unconventional techniques)

15:58 chouser: or perhaps two threads -- one for reading and one for writing?

15:59 serp_: nDuff: what are conventional techniques for handling sockets in clojure?

16:01 nDuff: serp_, clojure.contrib.server-socket's create-server is probably conventional enough -- one thread per socket

16:02 serp_: I'll have a look. thanks!

16:05 sclv: anybody got a minute to help walk me through a basic setup of a dev environment (using swank-clojure)?

16:11 alpheus: I just learned it myself, so I'll be glad to help if I can.

16:11 tridd3ll: sclv: no time now, but I documented my last setup here: http://riddell.us/ClojureSwankLeiningenWithEmacsOnArch.html

16:12 sclv: might only be relevant for linux though

16:14 sclv: thanks -- that link looks sufficient to get me going

16:36 briancarper: It looks like numbers behave more sanely as hash keys in the num branch. This is good.

16:38 ,{(int 1) :int (long 1) :long (bigint 1) :bigint}

16:38 clojurebot: {1 :int, 1 :long, 1 :bigint}

16:38 briancarper: No more of that to worry about.

16:45 qbg: Hmm, on the num branch (bit-shift-left 1 333) returns 8192

16:46 Since math now throws on overflow, shouldn't that also throw?

17:15 arohner: has anyone had success using eclipse + CCW to debug a clojure project?

17:15 I can remote attach, pause and see a stacktrace, but it seems to be ignoring my breakpoints set in clojure code

17:38 serp_: I'd like to allocate an array of 5 bytes. how do I do this? (let [buffer (new ???

17:38 qbg: ,(make-array Byte/TYPE 5)

17:38 clojurebot: #<byte[] [B@1333295>

17:38 serp_: what is /TYPE about?

17:39 qbg: To get the class object of the primitive type byte

17:39 serp_: ah

17:40 does / retrieve static members?

17:40 qbg: Yes

17:40 serp_: ok. thanks

17:48 mmarczyk: morning (ugt)

17:49 serp_: what could be the reason that makes my clj find clojure.contrib.server-socket but not clojure.contrib.json ?

17:50 qbg: How new is the contribs version you are using?

17:50 mmarczyk: serp_: what do you mean by "find"?

17:50 nDuff: serp_, what version of clojure-contrib are you running?

17:51 serp_: mmarczyk: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/contrib/json__init.class or clojure/contrib/json.clj on classpath <-

17:51 I'll check what version, sec

17:51 I use 1.1.0 clojure + clojure-contrib

17:52 mmarczyk: ah, I think there were two json-related namespaces back then, let me check...

17:52 yup, json.read & json.write

17:52 no json namespace

17:53 serp_: hm you're right

17:53 aha there is a separate api reference for 1.1.x

17:53 mmarczyk: right :-)

19:17 eslick_: Anyone here familiar with clockwise?

19:18 And dealing with the conflation of eclipse java and lein-based clojure projects?

19:20 eslick: I should say counterclockwise...

23:56 technomancy: did we ever get a way to AOT-compile a single namespace without having the namespaces it requires get AOT'd?

Logging service provided by n01se.net