#clojure log - Oct 31 2010

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

0:20 rata_: Raynes: so users of a library must remember which functions are in each of its (sub-)namespaces?

0:25 somnium: rata_: you could take a look at the way Aleph is organized, it goes to some length to make a convenient front end for library users

0:26 Raynes: rata_: The idea is to make it so that where things come from are generally documented. Requiring namespaces and explicitly taking only what you need from a namespace via use with :only fulfills that.

0:28 rata_: Raynes: I understand that... what I want is to put some functions from here and there into one namespace for easily accessing the library most-used functions

0:29 somnium: thanks :) I'll check it

0:29 somnium: http://github.com/ztellman/potemkin

0:29 ^^ actually its just this I think, which looks rather similar to immigrate

0:29 clojurebot: No entiendo

0:29 somnium: clojurebot: botsmack

0:29 clojurebot: clojurebot evades successfully!

0:31 Raynes: $botsnack

0:31 sexpbot: Raynes: Thanks! Om nom nom!!

0:31 Raynes: ,botsnack

0:31 clojurebot: java.lang.Exception: Unable to resolve symbol: botsnack in this context

0:31 Raynes: ~botsnack

0:31 clojurebot: thanks; that was delicious. (nom nom nom)

1:08 _danb_: is it possible to run swank-clojure without using a project with a project.clj? I've got it working with lein but I'd like to be able to just fire it up like in inferior lisp mode

1:15 technomancy: _danb_: lein install swank-clojure 1.3.0-SNAPSHOT && ~/.lein/bin/swank-clojure

1:15 or use cljr

1:19 _danb_: ah great, thanks technomancy

1:52 quizme: (defmethod print-method org.neo4j.kernel.impl.core.NodeProxy (fn [node writer] (.write writer "NODE" 0 2)))

1:52 java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (NO_SOURCE_FILE:43)

1:54 nm

2:09 rdsr1: quizme, try (defmethod print-method org.neo4j.kernel.impl.core.NodeProxy

2:09 [node writer]

2:09 (.write writer "NODE" 0 2))

2:09 quizme: rdsrl yeah got it thanks

2:38 rata_: is it guaranteed that (zipmap (keys m) (vals m)) = m?

2:55 rdsr: rata_ the map m passed to zip map may be a sorted map, in which case I wouldn't consider the result of zipmap to be the same as the input map

2:57 rata_: rdsr: but (= (zipmap (keys m) (vals m)) m) would be always true?

3:00 rdsr: rata_: hmmm, that is correct though...

3:00 rata_: rdsr: ok, thanks :)

3:07 and is it guaranteed that (= (first #{1 2}) 1)?

4:07 is it guaranteed that (= (first #{1 2}) 1)?

4:23 tpAIA: Hello, any experts on gen-interface/gen-class?

6:28 bmh: given a sorted map, can I efficiently get the index of a key?

6:32 Chousuke: index?

6:47 _ulises: morning folk

6:52 bmh: Chousuke: Suppose we have a sorted map {a 5 b 6}, the index of a is 0, the index of b is 1

6:53 the more important question is: can you do upper and lower bound queries on a sorted-map

6:55 Chousuke: I don't think so.

6:55 not very efficiently, anyway

6:56 The datastructure *probably* allows it, but there's no interface for it that I know of.

6:57 bmh: hurumph. That's a serious design flaw if it's the case.

6:57 Chousuke: more like it's just not implemented :P

6:58 bmh: sounds like something to do before lunch.

7:01 Chousuke: There might be some complications because the data structure is persistent, but I'm not sure.

7:02 oh wait

7:02 (doc subseq)

7:02 clojurebot: "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparat...

7:02 Chousuke: that exists

7:02 but it gives you a seq only

7:03 I've never seen that in code so I forgot its existence :P

7:04 bmh: oh duh

7:04 I implemented linear time median/selection in terms of subseq!

7:05 speaking of which, that code should probably be in contrib

7:40 _ulises: is there any way to find out, within a (dosync ...) which number of retry the transaction is going through?

7:47 * angerman really loves his -< and >- macros

7:47 angerman: though >- had to be changed a little...

7:47 esj: angerman made an angersmiley ?

7:48 angerman: (-> 1 (+ 1) (+ 1) (-< [(* 2) (* 2) (* 2)] [(* 8)]) (>- +))

7:48 so what are we doing?

7:49 we thread 1 into +1 twice

7:49 e.g. 3

7:49 now we thread 3 through some forms (2 here)

7:49 e.g. (-> 3 (* 2) (* 2) (* 2)) and (-> 3 (* 8))

7:50 so we get 24 twice

7:50 and now we apply + to them, thus the result is 48

7:50 esj: nice.... a scatter/collect

7:51 angerman: and now guess what: (-> 1 (+ 1) (+ 1) (-< [(* 2) (* 2) (* 2)] [(* 8)] [( * 2) neg]) (>- +)) gives :)

7:51 i call it thread-splicing :D

7:51 esj: 32 ?

7:52 (although I'm wicked hung over, so all bets are off)

7:52 angerman: well you are off by 10

7:52 esj: does it dispatch each form to a thread ?

7:53 as in a thread pool arrangement

7:54 angerman: no it doesn't

7:54 http://gist.github.com/655742

7:54 though It potentially could

7:55 I guess if you define them as futures or so

7:55 the collector would wait for those that are needed in the computation due to clojure semantics

7:56 esj: very nice

10:00 angerman: how do I tell lein to give my swank instance more memory?

10:19 raek: angerman: I think there is a :jvm-opts key for the project.clj file. check out the leiningen docs and example project

10:19 angerman: raek: thanks

10:21 raek: _ulises: you can do something like this: (let [tries (atom 0)] (dosync (swap! tries inc) ...))

10:22 _ulises: phew, I was about to ask the question again just in case new people would be able to answer it :)

10:22 thanks

10:27 hum, wait, won't the swap! not be committed if the dosync is retried?

10:28 I know atoms don't participate in the coord updates, but still, just wondering?

10:28 raek: no, that's why it has an exclamation mark in its name

10:28 _ulises: right

10:28 raek: only changes to refs and sends to agents are affected by transactions

10:29 the rest will happen as many times as the transaction body is executed

10:30 _ulises: right

10:30 thanks

10:30 raek: you're welcome :)

10:38 LauJensen: raek: dosync for atoms?

10:39 $(let [r (ref 0)] (dosync (alter r inc)))

10:40 ,(let [r (atom 0)] (swap! r inc))

10:40 clojurebot: 1

10:40 _ulises: LauJensen: I'm trying to keep track of how many times a (dosync ...) has re-tried to do its body

10:41 so I guess that having a (let [tries (atom 0)] (dosync (swap! tries inc) ...)) would do it

10:42 in essence, I'm just trying to double check that they are being retried :)

10:42 LauJensen: aha

10:43 _ulises: hum, this is not working out that great :/

10:43 dnolen: _ulises: for some transactions that probably won't work ... I think.

10:44 _ulises: I have two threads trying to do some alter, one sleeps for 2500ms and one for 3000ms, yet they aren't interrupting each other :/

10:44 and the alters do get in the way of each other by using a last-message-id which is inc'ed as the last operation in the dosync

10:45 dnolen: _ulises: do they sleep inside the transaction?

10:45 _ulises: no, outside

10:45 ah crap

10:45 :D

10:45 thanks :)

10:49 excellent, now it works

11:18 LauJensen: resultset-seq in core has a restriction which requires all column ids to be unique, any particular reason for this?

11:33 hmm, just looks like somebody didn't want to work around hashmaps only having unique keys

12:21 duck1123: is there any sort of "should receive" library for testing in clojure? (esp lazytest) Basically something where a function is replaced with a version that maintains a counter of how many times it's been called so that you can assert if it gets called

12:24 raek: http://clojure.github.com/clojure-contrib/mock-api.html <-- I looked at this once, but I never used it

12:29 duck1123: raek, thanks

12:29 kjeldahl: duck1123 The book "Joy of Clojure" also shows how such test stuff can be made.

12:31 raek: there is a new mocking library too, but I can't remember its name

13:00 noidi: duck1123, the new mocking library that raek mentioned is probably midje

13:01 raek: yes. that was the one! thank you

13:03 noidi: I just wrote something like this: (doseq [[a b] (map vector seq-of-as seq-of-bs)] ...) Is there a better way to do this?

13:04 I mean, is there something like doseq that would work like the above: (something-like-doseq [a seq-of-as, b seq-of-bs] ...)

13:05 doseq generates all combinations of the input sequences, but I want to iterate several seqs at the same time

13:06 MayDaniel: noidi: (doall (map do-something as bs)) ?

13:07 raek: the only alternate solution I can think is (dorun (map (fn [a b] ...) seq-of-as seq-of-bs)))

13:07 MayDaniel: Ah, dorun.

13:07 noidi: thanks!

13:09 itistoday: is there a way to browse and lookup clojure documentation in emacs?

13:10 dysinger: itistoday: (find-doc "blah") & (doc blah)

13:10 noidi: itistoday, if you're using slime, you can use `C-c C-d a` to search the documentation

13:10 dysinger: even better

13:11 noidi: you are looking for 'for' I believe

13:11 noidi: and when you have the cursor on a symbol, you can use `C-c C-d d` to look up that symbol's docs

13:11 itistoday: thanks dysinger, noidi! :-)

13:12 noidi: dysinger, for works like doseq, but it generates a lazy seq

13:12 dysinger: then doall around it ?

13:12 I'm probably not understanding your need

13:13 raek: for/doseq does not have the "take elements from multiple seqs in lockstep" feature of 'map'

13:13 dysinger: ah

13:13 noidi: raek, yes! thanks, I couldn't find the words for what I need :)

13:14 raek: it wouldn't be too hard to make a (domap [a as, b bs, c cs] ...body...) macro

13:15 dysinger: ,(split-at 2 (interleave [1 2 3] '[a b c]))

13:15 clojurebot: [(1 a) (2 b 3 c)]

13:15 noidi: yup. I think I'll go with my initial solution for now, and write that macro if I'll write something similar a couple of times more

13:30 angerman: wheee. extra primitive bayesian net shows some good results.

14:17 rata_: good morning (UGT)

14:27 LauJensen: (doc defalias)

14:27 clojurebot: Pardon?

14:27 LauJensen: ,(doc defalias)

14:27 clojurebot: Huh?

14:33 seancorfield: ,(doc clojure.contrib.def/defalias)

14:33 clojurebot: "([name orig] [name orig doc]); Defines an alias for a var: a new var with the same root binding (if any) and similar metadata. The metadata of the alias is its initial metadata (as provided by def) ...

14:44 jjido: Will there be a race condition if two tasks update an atom at the same time?

14:44 LauJensen: jjido: no, the atom updates its value atomically. All ref types protect against race conds

14:47 drewr: jjido: depends

14:48 remember that atoms are not transactional, so you can't read and then update

14:49 (except within the update function)

14:49 best to show some code

14:51 jjido: drewr: I would like transactional

14:52 drewr: but for now I can do without

15:01 drewr: jjido: in that case, you would use a Ref

15:25 jjido: A Ref is what I need for transactional memory?

15:26 drewr: yes, that's what you want for coordinated changes between multiple values

15:29 LauJensen: jjido: on clojure.org you have a page about refs, atoms, agents etc. I would recommend you to read them, they are quite clear about the semantics and use-cases for each ref-type

15:30 jjido: LauJensen: I think I read all of the pages on clojure.org. Looks like I need to refer to it (again)

15:31 LauJensen: jjido: http://clojure.org/refs, http://clojure.org/refs, http://clojure.org/agents

15:31 oops, http://clojure.org/atoms

16:29 dysinger: technomancy: http://gist.github.com/657091

16:30 wsimpson: it's amazing how much you can learn just by sitting in here. :)

16:34 hiredman: dysinger: have you pulled recently? there was a commit to infer about an hour ago changing the version of the lein javac plugin

16:37 dysinger: ah

16:42 technomancy: is it not a problem?

16:43 I can't tell what's going on there

17:12 vibrant: hmm.. i have a java object world returning Body from getBodyLis, and Body has a getNext

17:12 how do I convert that to a seq?

17:14 raek: vibrant: if it implements the java collections interfaces, you can call seq on it

17:14 vibrant: don't think so.

17:14 tonyl: hello

17:14 raek: is it an itierator?

17:14 *iterator

17:16 vibrant: raek; it's simply an object that has a getNext method and returns the next element of the list or null if it's the last.

17:16 a class

17:16 raek: what library is this?

17:17 vibrant: jbox2d

17:18 LauJensen: vibrant: I think this might work. (let [obj your-object] (fn myseq [] (when-let [elem (.getNext obj)] (cons elem (lazy-seq (myseq))))))

17:19 ymasory: clojurebot: (doc sort-by)

17:19 clojurebot: defmulti doc is (defmulti #^{:doc "docs for foo"} foo class)

17:20 ymasory: what happens if you provide both keyfn and comp for sort-by?

17:20 vibrant: LauJensen; but obj never chnages there?

17:21 LauJensen: $(sort-by :id > [{:id 1 :x 5} {:id 2 :x 10} {:id 3 :x 15}])

17:21 &(sort-by :id > [{:id 1 :x 5} {:id 2 :x 10} {:id 3 :x 15}])

17:21 sexpbot: ⟹ ({:x 15, :id 3} {:x 10, :id 2} {:x 5, :id 1})

17:21 ymasory: oh i get it. the function is for *extracting* they keys

17:21 LauJensen: vibrant: obj gets a number of calls to getNext, thats all

17:21 vibrant: lazy-seq does that?

17:22 LauJensen: &(doc lazy-seq)

17:22 sexpbot: ⟹ "Macro ([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls."

17:23 raek: I googled that method and I think that it actually returns a new thing, rather than change itself

17:25 vibrant: (defn body-seq [body] (lazy-seq (when body (cons body (body-seq (.getNext body))))))

17:25 vibrant: LauJensen; but I should call the next getNext on the object that I get from getNExt and not on the original obj.

17:26 raek: strange library...

17:26 LauJensen: vibrant: you've got the pieces to put it together now

17:26 vibrant: yea i'm puzzled, something simple in python takes 20 minutse here

17:26 hehe

17:26 raek: every "Body" seems to have fields, so that it can participate in one doubly linked list

17:26 vibrant: yea

17:26 retarded

17:54 _seanc_: Is there a function for adding to a map without creating a new map?

17:55 tonyl: if the map is not persistent, you can, but all data structures in clojure are immutable. maybe a transient structure?

17:56 or maybe using refs

17:56 _seanc_: so if you had (def a-map {}), how would you keep that variable but assign it new values?

17:56 would it be (let a-map (merge a-map {:id 5})) ?

17:56 tonyl: using assoc or merge

17:57 yeah

17:57 that would return a new map though

17:57 _seanc_: right, but if that's how it's done then I'll do it

17:58 tonyl: yeah

17:58 _seanc_: I'm still fuzzy on the topic of atoms, refs, and vars

17:58 so I'm not sure if either is suited for this

17:58 tonyl: if you really need to mutate it, use those

17:58 yeah me too :P

17:58 STM I am just learning that

17:59 _seanc_: I'm creating a simple "cache" for my compojure app. I want to "cache" a few variables. I'm under the impression an atom is the ideal choice

18:00 tonyl: oh for that I would say an atom is fine

18:01 _seanc_: I found a nifty stackoverflow link: http://cl.ly/8770ad217c86af57399e

18:03 itistoday: is there a "comment mode" whereby when i'm in a doc comment, when i hit return, it continues the single-line comment? i.e.: http://paste.pocoo.org/show/284087/

18:04 tonyl: _seanc_: thanks for sharing, i'll take a look at it.

18:04 _seanc_: you're very welcome

18:10 rata_: how can I create exceptions in clojure?

18:12 _seanc_: rata_: Have you looked at 'throw' ?

18:12 http://clojuredocs.org/clojure_core/clojure.core/throw

18:13 rata_: _seanc_: I want to create a Exception, not throw one

18:13 I want it to catch that particular exception

18:14 say, I create a exception called MyOwnException and then can catch it without catching other exceptions

18:14 _seanc_: So you want to extend the Exception class?

18:16 Hmm, I'd be interested in knowing the answer to that. Though I imagine it's something you have to do in Java since at least in my reading on Clojure you don't directly create objects or extend them

18:16 angerman: what does gen-class do?

18:17 rata_: _seanc_: in Java terms, yes, I want to extend the Exception class, but not really add anything to it, just give it a particular name

18:17 _seanc_: wow, lots of info on gen-class: http://clojuredocs.org/clojure_core/clojure.core/gen-class

18:18 angerman: my google foo was probably strong enough

18:18 http://groups.google.com/group/clojure/msg/006579290248352c

18:18 tonyl: rata_: what about reify? or extending a protocol?

18:19 * angerman thinks the clojure goup message is worth a read anyway.

18:19 rata_: tonyl: is Exception a protocol?

18:20 angerman: rata_: forgot to write you directly, the link was ment for you.

18:21 rata_: angerman: thanks

18:22 raek: I think the general theme is that Clojure does most things without types

18:23 it_is_today: k, i think someone responded to me, but i've broken my emacs return key... and can't switch buffers :-p

18:23 raek: clojure.contrib.error-kit and clojure.contrib.condition are worth to check out

18:23 _seanc_: So you wouldn't be able to catch say MyException vs Exception?

18:23 tonyl: rata_ no my bad, you have to extend the class, and I think reify lets you extend your types based on protocols or classes

18:23 raek: it is indeed possible to create your own subclasses of Exception in Clojure

18:24 angerman: (try form (catch ExceptionClass ex form-with-e)) ?

18:24 rata_: raek: how?

18:25 angerman: Though Exception handling is parially done with monads in haskell iirc.

18:25 raek: gen-class, proxy, reify, deftype, defrecord

18:25 angerman: otherwise I've never really needed exceptionhandling except where interfacing with java

18:25 clojurebot: hmm… sounds like your out of heap space

18:25 tonyl: rata_:http://clojure.org/java_interop#Java Interop-Implementing Interfaces and Extending Classes

18:25 rata_: http://clojure.org/java_interop#Java Interop-Implementing Interfaces and Extending Classes

18:25 raek: but gen-class requires AOT compilation

18:25 kotarak: angerman: scratch reify, deftype and defrecord

18:27 raek: ah, yeah. those do not do subclassing. only implementation of interfaces

18:27 angerman: kotarak: I planed to do so... just haven't had the time yet :(

18:27 _seanc_: raek: why are type hints discouraged? (reading your link)

18:27 kotarak: angerman: I mean was raek said about subclassing

18:28 raek: my link?

18:28 _seanc_: sorry, it was tonyl's

18:28 angerman: kotarak: ahh ok. Well I ment to read up on those anyway :D

18:29 kotarak: angerman: definitively encouraged! :)

18:29 _seanc_: "Normally, one should avoid the use of type hints until there is a known performance bottleneck." I'm just curious why that is. Wouldn't it always be an improvement?

18:30 angerman: ha, got to hold a talk about clojure on wednesday at my faculty. I definitely should be up to date on them by then.

18:30 kotarak: angerman: and if the official info on gen-class or proxy is not enough: http://bit.ly/ckHpzG and http://bit.ly/cS8AjJ

18:30 _seanc_: you look yourself into a specific type.

18:31 _seanc_: say you hint on String and then want to plug in a CharSequence.

18:31 angerman: kotarak: thanks. got them bookmarked :D

18:31 _seanc_: kotarak: Sure, there are cases such as that. However, if you know you only intend to use String, why not type hint?

18:32 * itistoday tests

18:34 rata_: _seanc_: I think because it makes your code uglier

18:38 angerman: I didn't understand what Tom Faulhaber said he did for carrying custom info

18:40 angerman: rata_: why you usually want to extend an exception is to carry out information from the cause where you throw it.

18:41 rata_: yes, but I didn't understand the alternative he uses

18:42 angerman: I guess it's basically as if you just attach meta-data to the generic/default exception.

18:43 and then handle the catch based on the meta information.

18:43 tonyl: _seanc_ you lose the power that comes with dynamic typing, which clojure has a form of

18:44 angerman: It's not clear from the message weather he has created _one_ custom Exception that he generates with his error function, feeding it the needed information or if he created an Exception that can be augmented with (meta )

18:47 rata_: I understood that he doesn't use exceptions... but no idea what he uses

18:47 * technomancy senses someone doesn't know about clojure.contrib.condition

18:48 * angerman raises hand ... :)

18:48 technomancy: it's an exception type that has a map attached

18:49 angerman: so basically an exception with meta support

18:49 technomancy: right

18:50 rata_: technomancy: I haven't read about it yet... will check it now

18:50 technomancy: nobody's read about it. it's like a secret library.

18:51 I told everyone I could at the Conj about it, but I'm only one man.

18:51 angerman: I wasn't there :p not my fault not to know... oooops.

18:52 :D

18:52 technomancy: maybe that'll be my next blog post

18:52 angerman: hehe. sure.

18:53 technomancy: I think I bugged you about >- and -< yesterday. And you referred me to the flow conduit library.

18:54 technomancy: I think that would have been hiredman

18:55 angerman: the refer ... yes. I think you are right. Well anyway I think I'll stick with -< and >- for the lightweight stuff. To me it's way easier to read.

18:55 mrBliss: itistoday: I just read your question about RET in "comment mode" (an hour ago). Try M-j

19:06 itistoday: mrBliss: thanks, yeah I tried that and it did work, i ended up binding it to something a little more natural (Apple-Return)

19:07 unfortunately i can't bind it to just return, if i do that then return doesn't send commands.. i.e. when i hit return to send this message from erc, or in the minibuffer

19:11 mrBliss: itistoday: it's logical since M-j is bound to another function than RET is. You'd need another function that detects if it's on a comment line or not and will behave accordingly.

19:13 itistoday: mrBliss: yeah... my emacs lisp ain't so good.. i need practice

19:13 more than lisp, it's just knowing what functions exist, etc.

19:14 mrBliss: itistoday: I have exactly the same problem!

19:50 rata_: what's the emacs lisp function that controls how different forms are indented?

20:18 I found it... it's define-clojure-indent

20:18 but it's part of clojure-mode and it seems I'm not using it

20:18 how do I set the same using swank-clojure(-extra)?

20:37 ping

20:45 why if I import a class from one file and then import the same class from another I get different classes? (instance? c obj) returns false for the objects produced from the first file

20:49 tonyl: what is an example?

20:49 rata_: let me make a gist

21:57 tonyl: ping?

21:57 clojurebot: PONG!

22:21 tonyl: are sets created in runtime, like expanding the dispatch macro? or are they a fully data structure?

22:39 rata_: tonyl: I think they are full data structures, but I don't really know

22:42 tonyl: yeah, i keep reading they are, but I have this itch about it.

22:42 rata_: why?

22:42 clojurebot: http://clojure.org/rationale

22:42 tonyl: i guess there is no other way to find out than looking at the source code for macro evaluation

22:43 because they start with #

22:43 clojurebot: Pardon?

22:43 tonyl: the dispatch macro

22:43 sets don't have a creation fn

22:43 like maps have hash-map or sorted-map

22:43 or lists have list, or vectors have vec or vector

22:44 haha why did clojurebot say pardon?

22:44 rata_: sets have one, set

22:45 Raynes: &(coll? #{})

22:45 sexpbot: ⟹ true

22:45 rata_: &(set [1 2])

22:45 sexpbot: ⟹ #{1 2}

22:45 tonyl: mm true

22:45 ok one mystery solve

22:45 i guess they are

22:45 clojurebot: excusez-moi

22:45 Raynes: clojurebot: botsmack

22:45 clojurebot: Owww!

22:45 tonyl: so #{} is just synthetic sugar

22:46 haha clojurebot is going crazy

22:46 rata_: yes, #{} is a reader macro

22:46 not a macro

22:46 tonyl: yeah ok

22:47 I still going to look into the source code, to see how synthetic sugar is made

22:47 thanks guys

22:48 rata_: you're welcome :)

22:48 Raynes: syntactic sugar

22:50 tonyl: Raynes: :P I guess I was going all chemist

22:50 Raynes: :p

22:50 tonyl: ok so what is the difference in usage between a set and a vector

22:51 Raynes: & #{1 2 3 3 4 1 2 3 5}

22:51 sexpbot: java.lang.IllegalArgumentException: Duplicate key: 3

22:51 Raynes: You can't have duplicates in sets.

22:51 &(#{1 2 3 4} 3)

22:51 sexpbot: ⟹ 3

22:51 tonyl: oh right, like a mathematical set

22:51 Raynes: &(#{1 2 3 4} 5)

22:51 sexpbot: ⟹ nil

22:52 Raynes: Sets are also functions that look up items within themselves, and return the item or nil if it doesn't exist in the set.

22:52 Vectors are the typical sequential collection in Clojure.

22:53 tonyl: it makes sense now. I have to re-read some more about all this

22:53 Raynes: Of course, there are also lists: &| '(1 2 3) |&

22:53 sexpbot: ⟹ (1 2 3)

22:53 amalloy: Heh. Enjoying the new toys, Raynes?

22:54 Raynes: amalloy: Indeed.

22:54 amalloy: Also, I just remembered that I have an embedded plugin in sexpbot. When you go to add the regex stuff to the normal command prefixes, you can just modify that plugin.

22:54 tonyl: what does &| do to sexpbot? evaluates too?

22:54 Raynes: tonyl: The thing in between those is evaluated as code.

22:55 amalloy: Hm okay, I'll check it out

22:55 tonyl: hehe interesting

22:55 Raynes: It can &|(println "appear!")| & anywhere in a message.

22:55 Well, if I type it right. ;)

22:56 tonyl: haha

22:56 amalloy: I was thinking $(this) would be a neat syntax, but tricky to implement

22:56 Raynes: amalloy: It's actually impossible to implement consistently and without any chance of error.

22:57 It's easy to differentiate between a normal command and a parenthesis wrapped expression, but not everything that can be evaluated is wrapped in parentheses.

22:58 There is no way to differentiate between "execute command x" and "evaluate x"

22:58 amalloy: Raynes: yeah, I suppose so

22:59 You could use it only for one of the two, right?

22:59 Eg, what is the $(fcst here)?

23:06 rata_: I'm back... there was a blackout here

23:08 (do you say blackout in english when the electricity vanishes?)

23:08 tonyl: yeah

23:08 here is usually because of a storm

23:09 rata_: here is usually because the power grid is so shitty

23:10 (no kidding)

23:10 tonyl: that sucks

23:11 rata_: yea

23:12 here's a gist of what I was asking before: http://gist.github.com/657536 I hope is a good minimal code to demonstrate the problem of importing a class twice

23:16 I think the problem is that every time it reads (:import [x A]) it creates a new A with the same name but different identity

23:17 tonyl: it might be that, but that defeats the point of importing protocols, let me test it

23:18 I thought import was only for java interop

23:21 rata_: no, everything that compiles to a class must be imported (I think)

23:27 tonyl: yeah

23:30 i am guessing is throwing the exception with the use of A in the z namespace

23:30 i don't know why

23:32 nurvnurv: hey

23:32 rata_: which exception? does it throw an exception?

23:33 nurvnurv: does anyone knows why i can't evaluate an sexp on slime?

23:33 it simply goes into infinite loop

23:33 and stops works

23:33 working

23:33 tonyl: rata_: it does to me, i assume that was your problem

23:33 rata_: tonyl: my problem is that (instance? A obj) returns false

23:34 tonyl: rata_: I replicated your problem and it threw an exception ClassNotFoundException: x

23:35 until I took off the (:import x A) from the z namespace, then it all works fine

23:36 I don't have the latest version of clojure though

23:36 rata_: sorry... update the gist

23:37 that (:import x A) is supposed to be a (:import [x A])

23:39 tonyl: rata_: ok tested your new gist and it works fine with me

23:39 it returns true

23:39 and i tested it on both y an z namespaces

23:40 rata_: mmmm... it's difficult to write a minimal code for this

23:40 tonyl: i understand the situation

23:41 my guess would be if there is other code conflicting with the boolean result

23:41 stripe the code of to test it if it returns true, the add piece little by little to see what is causing the false result

23:47 well, good night

23:51 rata_: the annoying thing is that I've had this problem before and putting :reload-all in :use have solved it before... but this time I can't put :reload-all in :import

23:55 replaca: what's the leiningen magic for grabbing contrib in master again?

23:56 technomancy: replaca: this is for alpha1: [org.clojure.contrib/complete "1.3.0-alpha1" :classifier "bin"]

23:56 you might be able to drop the classifier now for alpha2 and on?

23:56 not using master at work yet. =\

23:57 replaca: technomancy: Thanks, I haven't been using master yet either, but autodoc isn't picking up the source refs in contrib right all the time and I need to figure it out

Logging service provided by n01se.net