#clojure logs

2010-10-31

00:20rata_Raynes: so users of a library must remember which functions are in each of its (sub-)namespaces?
00:25somniumrata_: 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
00:26Raynesrata_: 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.
00:28rata_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
00:29rata_somnium: thanks :) I'll check it
00:29somniumhttp://github.com/ztellman/potemkin
00:29somnium^^ actually its just this I think, which looks rather similar to immigrate
00:29clojurebotNo entiendo
00:29somniumclojurebot: botsmack
00:29clojurebotclojurebot evades successfully!
00:31Raynes$botsnack
00:31sexpbotRaynes: Thanks! Om nom nom!!
00:31Raynes,botsnack
00:31clojurebotjava.lang.Exception: Unable to resolve symbol: botsnack in this context
00:31Raynes~botsnack
00:31clojurebotthanks; that was delicious. (nom nom nom)
01: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
01:15technomancy_danb_: lein install swank-clojure 1.3.0-SNAPSHOT && ~/.lein/bin/swank-clojure
01:15technomancyor use cljr
01:19_danb_ah great, thanks technomancy
01:52quizme(defmethod print-method org.neo4j.kernel.impl.core.NodeProxy (fn [node writer] (.write writer "NODE" 0 2)))
01:52quizmejava.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (NO_SOURCE_FILE:43)
01:54quizmenm
02:09rdsr1quizme, try (defmethod print-method org.neo4j.kernel.impl.core.NodeProxy
02:09rdsr1 [node writer]
02:09rdsr1 (.write writer "NODE" 0 2))
02:09quizmerdsrl yeah got it thanks
02:38rata_is it guaranteed that (zipmap (keys m) (vals m)) = m?
02:55rdsrrata_ 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
02:57rata_rdsr: but (= (zipmap (keys m) (vals m)) m) would be always true?
03:00rdsrrata_: hmmm, that is correct though...
03:00rata_rdsr: ok, thanks :)
03:07rata_and is it guaranteed that (= (first #{1 2}) 1)?
04:07rata_is it guaranteed that (= (first #{1 2}) 1)?
04:23tpAIAHello, any experts on gen-interface/gen-class?
06:28bmhgiven a sorted map, can I efficiently get the index of a key?
06:32Chousukeindex?
06:47_ulisesmorning folk
06:52bmhChousuke: Suppose we have a sorted map {a 5 b 6}, the index of a is 0, the index of b is 1
06:53bmhthe more important question is: can you do upper and lower bound queries on a sorted-map
06:55ChousukeI don't think so.
06:55Chousukenot very efficiently, anyway
06:56ChousukeThe datastructure *probably* allows it, but there's no interface for it that I know of.
06:57bmhhurumph. That's a serious design flaw if it's the case.
06:57Chousukemore like it's just not implemented :P
06:58bmhsounds like something to do before lunch.
07:01ChousukeThere might be some complications because the data structure is persistent, but I'm not sure.
07:02Chousukeoh wait
07:02Chousuke(doc subseq)
07:02clojurebot"([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...
07:02Chousukethat exists
07:02Chousukebut it gives you a seq only
07:03ChousukeI've never seen that in code so I forgot its existence :P
07:04bmhoh duh
07:04bmhI implemented linear time median/selection in terms of subseq!
07:05bmhspeaking of which, that code should probably be in contrib
07:40_ulisesis there any way to find out, within a (dosync ...) which number of retry the transaction is going through?
07:47angermanthough >- had to be changed a little...
07:47esjangerman made an angersmiley ?
07:48angerman(-> 1 (+ 1) (+ 1) (-< [(* 2) (* 2) (* 2)] [(* 8)]) (>- +))
07:48angermanso what are we doing?
07:49angermanwe thread 1 into +1 twice
07:49angermane.g. 3
07:49angermannow we thread 3 through some forms (2 here)
07:49angermane.g. (-> 3 (* 2) (* 2) (* 2)) and (-> 3 (* 8))
07:50angermanso we get 24 twice
07:50angermanand now we apply + to them, thus the result is 48
07:50esjnice.... a scatter/collect
07:51angermanand now guess what: (-> 1 (+ 1) (+ 1) (-< [(* 2) (* 2) (* 2)] [(* 8)] [( * 2) neg]) (>- +)) gives :)
07:51angermani call it thread-splicing :D
07:51esj32 ?
07:52esj(although I'm wicked hung over, so all bets are off)
07:52angermanwell you are off by 10
07:52esjdoes it dispatch each form to a thread ?
07:53esjas in a thread pool arrangement
07:54angermanno it doesn't
07:54angermanhttp://gist.github.com/655742
07:54angermanthough It potentially could
07:55angermanI guess if you define them as futures or so
07:55angermanthe collector would wait for those that are needed in the computation due to clojure semantics
07:56esjvery nice
10:00angermanhow do I tell lein to give my swank instance more memory?
10:19raekangerman: I think there is a :jvm-opts key for the project.clj file. check out the leiningen docs and example project
10:19angermanraek: thanks
10:21raek_ulises: you can do something like this: (let [tries (atom 0)] (dosync (swap! tries inc) ...))
10:22_ulisesphew, I was about to ask the question again just in case new people would be able to answer it :)
10:22_ulisesthanks
10:27_uliseshum, wait, won't the swap! not be committed if the dosync is retried?
10:28_ulisesI know atoms don't participate in the coord updates, but still, just wondering?
10:28raekno, that's why it has an exclamation mark in its name
10:28_ulisesright
10:28raekonly changes to refs and sends to agents are affected by transactions
10:29raekthe rest will happen as many times as the transaction body is executed
10:30_ulisesright
10:30_ulisesthanks
10:30raekyou're welcome :)
10:38LauJensenraek: dosync for atoms?
10:39LauJensen$(let [r (ref 0)] (dosync (alter r inc)))
10:40LauJensen,(let [r (atom 0)] (swap! r inc))
10:40clojurebot1
10:40_ulisesLauJensen: I'm trying to keep track of how many times a (dosync ...) has re-tried to do its body
10:41_ulisesso I guess that having a (let [tries (atom 0)] (dosync (swap! tries inc) ...)) would do it
10:42_ulisesin essence, I'm just trying to double check that they are being retried :)
10:42LauJensenaha
10:43_uliseshum, this is not working out that great :/
10:43dnolen_ulises: for some transactions that probably won't work ... I think.
10:44_ulisesI 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_ulisesand 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:45dnolen_ulises: do they sleep inside the transaction?
10:45_ulisesno, outside
10:45_ulisesah crap
10:45_ulises:D
10:45_ulisesthanks :)
10:49_ulisesexcellent, now it works
11:18LauJensenresultset-seq in core has a restriction which requires all column ids to be unique, any particular reason for this?
11:33LauJensenhmm, just looks like somebody didn't want to work around hashmaps only having unique keys
12:21duck1123is 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:24raekhttp://clojure.github.com/clojure-contrib/mock-api.html <-- I looked at this once, but I never used it
12:29duck1123raek, thanks
12:29kjeldahlduck1123 The book "Joy of Clojure" also shows how such test stuff can be made.
12:31raekthere is a new mocking library too, but I can't remember its name
13:00noididuck1123, the new mocking library that raek mentioned is probably midje
13:01raekyes. that was the one! thank you
13:03noidiI 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:04noidiI mean, is there something like doseq that would work like the above: (something-like-doseq [a seq-of-as, b seq-of-bs] ...)
13:05noididoseq generates all combinations of the input sequences, but I want to iterate several seqs at the same time
13:06MayDanielnoidi: (doall (map do-something as bs)) ?
13:07raekthe only alternate solution I can think is (dorun (map (fn [a b] ...) seq-of-as seq-of-bs)))
13:07MayDanielAh, dorun.
13:07noidithanks!
13:09itistodayis there a way to browse and lookup clojure documentation in emacs?
13:10dysingeritistoday: (find-doc "blah") & (doc blah)
13:10noidiitistoday, if you're using slime, you can use `C-c C-d a` to search the documentation
13:10dysingereven better
13:11dysingernoidi: you are looking for 'for' I believe
13:11noidiand when you have the cursor on a symbol, you can use `C-c C-d d` to look up that symbol's docs
13:11itistodaythanks dysinger, noidi! :-)
13:12noididysinger, for works like doseq, but it generates a lazy seq
13:12dysingerthen doall around it ?
13:12dysingerI'm probably not understanding your need
13:13raekfor/doseq does not have the "take elements from multiple seqs in lockstep" feature of 'map'
13:13dysingerah
13:13noidiraek, yes! thanks, I couldn't find the words for what I need :)
13:14raekit wouldn't be too hard to make a (domap [a as, b bs, c cs] ...body...) macro
13:15dysinger,(split-at 2 (interleave [1 2 3] '[a b c]))
13:15clojurebot[(1 a) (2 b 3 c)]
13:15noidiyup. 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:30angermanwheee. extra primitive bayesian net shows some good results.
14:17rata_good morning (UGT)
14:27LauJensen(doc defalias)
14:27clojurebotPardon?
14:27LauJensen,(doc defalias)
14:27clojurebotHuh?
14:33seancorfield,(doc clojure.contrib.def/defalias)
14:33clojurebot"([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:44jjidoWill there be a race condition if two tasks update an atom at the same time?
14:44LauJensenjjido: no, the atom updates its value atomically. All ref types protect against race conds
14:47drewrjjido: depends
14:48drewrremember that atoms are not transactional, so you can't read and then update
14:49drewr(except within the update function)
14:49drewrbest to show some code
14:51jjidodrewr: I would like transactional
14:52jjidodrewr: but for now I can do without
15:01drewrjjido: in that case, you would use a Ref
15:25jjidoA Ref is what I need for transactional memory?
15:26drewryes, that's what you want for coordinated changes between multiple values
15:29LauJensenjjido: 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:30jjidoLauJensen: I think I read all of the pages on clojure.org. Looks like I need to refer to it (again)
15:31LauJensenjjido: http://clojure.org/refs, http://clojure.org/refs, http://clojure.org/agents
15:31LauJensenoops, http://clojure.org/atoms
16:29dysingertechnomancy: http://gist.github.com/657091
16:30wsimpsonit's amazing how much you can learn just by sitting in here. :)
16:34hiredmandysinger: have you pulled recently? there was a commit to infer about an hour ago changing the version of the lein javac plugin
16:37dysingerah
16:42technomancyis it not a problem?
16:43technomancyI can't tell what's going on there
17:12vibranthmm.. i have a java object world returning Body from getBodyLis, and Body has a getNext
17:12vibranthow do I convert that to a seq?
17:14raekvibrant: if it implements the java collections interfaces, you can call seq on it
17:14vibrantdon't think so.
17:14tonylhello
17:14raekis it an itierator?
17:14raek*iterator
17:16vibrantraek; 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:16vibranta class
17:16raekwhat library is this?
17:17vibrantjbox2d
17:18LauJensenvibrant: I think this might work. (let [obj your-object] (fn myseq [] (when-let [elem (.getNext obj)] (cons elem (lazy-seq (myseq))))))
17:19ymasoryclojurebot: (doc sort-by)
17:19clojurebotdefmulti doc is (defmulti #^{:doc "docs for foo"} foo class)
17:20ymasorywhat happens if you provide both keyfn and comp for sort-by?
17:20vibrantLauJensen; but obj never chnages there?
17:21LauJensen$(sort-by :id > [{:id 1 :x 5} {:id 2 :x 10} {:id 3 :x 15}])
17:21LauJensen&(sort-by :id > [{:id 1 :x 5} {:id 2 :x 10} {:id 3 :x 15}])
17:21sexpbot⟹ ({:x 15, :id 3} {:x 10, :id 2} {:x 5, :id 1})
17:21ymasoryoh i get it. the function is for *extracting* they keys
17:21LauJensenvibrant: obj gets a number of calls to getNext, thats all
17:21vibrantlazy-seq does that?
17:22LauJensen&(doc lazy-seq)
17:22sexpbot⟹ "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:23raekI googled that method and I think that it actually returns a new thing, rather than change itself
17:25raekvibrant: (defn body-seq [body] (lazy-seq (when body (cons body (body-seq (.getNext body))))))
17:25vibrantLauJensen; but I should call the next getNext on the object that I get from getNExt and not on the original obj.
17:26raekstrange library...
17:26LauJensenvibrant: you've got the pieces to put it together now
17:26vibrantyea i'm puzzled, something simple in python takes 20 minutse here
17:26vibranthehe
17:26raekevery "Body" seems to have fields, so that it can participate in one doubly linked list
17:26vibrantyea
17:26vibrantretarded
17:54_seanc_Is there a function for adding to a map without creating a new map?
17:55tonylif the map is not persistent, you can, but all data structures in clojure are immutable. maybe a transient structure?
17:56tonylor 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_seanc_would it be (let a-map (merge a-map {:id 5})) ?
17:56tonylusing assoc or merge
17:57tonylyeah
17:57tonylthat would return a new map though
17:57_seanc_right, but if that's how it's done then I'll do it
17:58tonylyeah
17:58_seanc_I'm still fuzzy on the topic of atoms, refs, and vars
17:58_seanc_so I'm not sure if either is suited for this
17:58tonylif you really need to mutate it, use those
17:58tonylyeah me too :P
17:58tonylSTM 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:00tonyloh for that I would say an atom is fine
18:01_seanc_I found a nifty stackoverflow link: http://cl.ly/8770ad217c86af57399e
18:03itistodayis 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:04tonyl_seanc_: thanks for sharing, i'll take a look at it.
18:04_seanc_you're very welcome
18:10rata_how can I create exceptions in clojure?
18:12_seanc_rata_: Have you looked at 'throw' ?
18:12_seanc_http://clojuredocs.org/clojure_core/clojure.core/throw
18:13rata__seanc_: I want to create a Exception, not throw one
18:13rata_I want it to catch that particular exception
18:14rata_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_seanc_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:16angermanwhat does gen-class do?
18:17rata__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:18angermanmy google foo was probably strong enough
18:18angermanhttp://groups.google.com/group/clojure/msg/006579290248352c
18:18tonylrata_: what about reify? or extending a protocol?
18:19rata_tonyl: is Exception a protocol?
18:20angermanrata_: forgot to write you directly, the link was ment for you.
18:21rata_angerman: thanks
18:22raekI think the general theme is that Clojure does most things without types
18:23it_is_todayk, i think someone responded to me, but i've broken my emacs return key... and can't switch buffers :-p
18:23raekclojure.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:23tonylrata_ no my bad, you have to extend the class, and I think reify lets you extend your types based on protocols or classes
18:23raekit is indeed possible to create your own subclasses of Exception in Clojure
18:24angerman(try form (catch ExceptionClass ex form-with-e)) ?
18:24rata_raek: how?
18:25angermanThough Exception handling is parially done with monads in haskell iirc.
18:25raekgen-class, proxy, reify, deftype, defrecord
18:25angermanotherwise I've never really needed exceptionhandling except where interfacing with java
18:25clojurebothmm… sounds like your out of heap space
18:25tonylrata_:http://clojure.org/java_interop#Java Interop-Implementing Interfaces and Extending Classes
18:25tonylrata_: http://clojure.org/java_interop#Java Interop-Implementing Interfaces and Extending Classes
18:25raekbut gen-class requires AOT compilation
18:25kotarakangerman: scratch reify, deftype and defrecord
18:27raekah, yeah. those do not do subclassing. only implementation of interfaces
18:27angermankotarak: 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:27kotarakangerman: I mean was raek said about subclassing
18:28raekmy link?
18:28_seanc_sorry, it was tonyl's
18:28angermankotarak: ahh ok. Well I ment to read up on those anyway :D
18:29kotarakangerman: 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:30angermanha, got to hold a talk about clojure on wednesday at my faculty. I definitely should be up to date on them by then.
18:30kotarakangerman: and if the official info on gen-class or proxy is not enough: http://bit.ly/ckHpzG and http://bit.ly/cS8AjJ
18:30kotarak_seanc_: you look yourself into a specific type.
18:31kotarak_seanc_: say you hint on String and then want to plug in a CharSequence.
18:31angermankotarak: 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:34rata__seanc_: I think because it makes your code uglier
18:38rata_angerman: I didn't understand what Tom Faulhaber said he did for carrying custom info
18:40angermanrata_: why you usually want to extend an exception is to carry out information from the cause where you throw it.
18:41rata_yes, but I didn't understand the alternative he uses
18:42angermanI guess it's basically as if you just attach meta-data to the generic/default exception.
18:43angermanand then handle the catch based on the meta information.
18:43tonyl_seanc_ you lose the power that comes with dynamic typing, which clojure has a form of
18:44angermanIt'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:47rata_I understood that he doesn't use exceptions... but no idea what he uses
18:48technomancyit's an exception type that has a map attached
18:49angermanso basically an exception with meta support
18:49technomancyright
18:50rata_technomancy: I haven't read about it yet... will check it now
18:50technomancynobody's read about it. it's like a secret library.
18:51technomancyI told everyone I could at the Conj about it, but I'm only one man.
18:51angermanI wasn't there :p not my fault not to know... oooops.
18:52angerman:D
18:52technomancymaybe that'll be my next blog post
18:52angermanhehe. sure.
18:53angermantechnomancy: I think I bugged you about >- and -< yesterday. And you referred me to the flow conduit library.
18:54technomancyI think that would have been hiredman
18:55angermanthe 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:55mrBlissitistoday: I just read your question about RET in "comment mode" (an hour ago). Try M-j
19:06itistodaymrBliss: thanks, yeah I tried that and it did work, i ended up binding it to something a little more natural (Apple-Return)
19:07itistodayunfortunately 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:11mrBlissitistoday: 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:13itistodaymrBliss: yeah... my emacs lisp ain't so good.. i need practice
19:13itistodaymore than lisp, it's just knowing what functions exist, etc.
19:14mrBlissitistoday: I have exactly the same problem!
19:50rata_what's the emacs lisp function that controls how different forms are indented?
20:18rata_I found it... it's define-clojure-indent
20:18rata_but it's part of clojure-mode and it seems I'm not using it
20:18rata_how do I set the same using swank-clojure(-extra)?
20:37rata_ping
20:45rata_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:49tonylwhat is an example?
20:49rata_let me make a gist
21:57tonylping?
21:57clojurebotPONG!
22:21tonylare sets created in runtime, like expanding the dispatch macro? or are they a fully data structure?
22:39rata_tonyl: I think they are full data structures, but I don't really know
22:42tonylyeah, i keep reading they are, but I have this itch about it.
22:42rata_why?
22:42clojurebothttp://clojure.org/rationale
22:42tonyli guess there is no other way to find out than looking at the source code for macro evaluation
22:43tonylbecause they start with #
22:43clojurebotPardon?
22:43tonylthe dispatch macro
22:43tonylsets don't have a creation fn
22:43tonyllike maps have hash-map or sorted-map
22:43tonylor lists have list, or vectors have vec or vector
22:44tonylhaha why did clojurebot say pardon?
22:44rata_sets have one, set
22:45Raynes&(coll? #{})
22:45sexpbot⟹ true
22:45rata_&(set [1 2])
22:45sexpbot⟹ #{1 2}
22:45tonylmm true
22:45tonylok one mystery solve
22:45tonyli guess they are
22:45clojurebotexcusez-moi
22:45Raynesclojurebot: botsmack
22:45clojurebotOwww!
22:45tonylso #{} is just synthetic sugar
22:46tonylhaha clojurebot is going crazy
22:46rata_yes, #{} is a reader macro
22:46rata_not a macro
22:46tonylyeah ok
22:47tonylI still going to look into the source code, to see how synthetic sugar is made
22:47tonylthanks guys
22:48rata_you're welcome :)
22:48Raynessyntactic sugar
22:50tonylRaynes: :P I guess I was going all chemist
22:50Raynes:p
22:50tonylok so what is the difference in usage between a set and a vector
22:51Raynes& #{1 2 3 3 4 1 2 3 5}
22:51sexpbotjava.lang.IllegalArgumentException: Duplicate key: 3
22:51RaynesYou can't have duplicates in sets.
22:51Raynes&(#{1 2 3 4} 3)
22:51sexpbot⟹ 3
22:51tonyloh right, like a mathematical set
22:51Raynes&(#{1 2 3 4} 5)
22:51sexpbot⟹ nil
22:52RaynesSets are also functions that look up items within themselves, and return the item or nil if it doesn't exist in the set.
22:52RaynesVectors are the typical sequential collection in Clojure.
22:53tonylit makes sense now. I have to re-read some more about all this
22:53RaynesOf course, there are also lists: &| '(1 2 3) |&
22:53sexpbot⟹ (1 2 3)
22:53amalloyHeh. Enjoying the new toys, Raynes?
22:54Raynesamalloy: Indeed.
22:54Raynesamalloy: 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:54tonylwhat does &| do to sexpbot? evaluates too?
22:54Raynestonyl: The thing in between those is evaluated as code.
22:55amalloyHm okay, I'll check it out
22:55tonylhehe interesting
22:55RaynesIt can &|(println "appear!")| & anywhere in a message.
22:55RaynesWell, if I type it right. ;)
22:56tonylhaha
22:56amalloyI was thinking $(this) would be a neat syntax, but tricky to implement
22:56Raynesamalloy: It's actually impossible to implement consistently and without any chance of error.
22:57RaynesIt'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:58RaynesThere is no way to differentiate between "execute command x" and "evaluate x"
22:58amalloyRaynes: yeah, I suppose so
22:59amalloyYou could use it only for one of the two, right?
22:59amalloyEg, what is the $(fcst here)?
23:06rata_I'm back... there was a blackout here
23:08rata_(do you say blackout in english when the electricity vanishes?)
23:08tonylyeah
23:08tonylhere is usually because of a storm
23:09rata_here is usually because the power grid is so shitty
23:10rata_(no kidding)
23:10tonylthat sucks
23:11rata_yea
23:12rata_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:16rata_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:17tonylit might be that, but that defeats the point of importing protocols, let me test it
23:18tonylI thought import was only for java interop
23:21rata_no, everything that compiles to a class must be imported (I think)
23:27tonylyeah
23:30tonyli am guessing is throwing the exception with the use of A in the z namespace
23:30tonyli don't know why
23:32nurvnurvhey
23:32rata_which exception? does it throw an exception?
23:33nurvnurvdoes anyone knows why i can't evaluate an sexp on slime?
23:33nurvnurvit simply goes into infinite loop
23:33nurvnurvand stops works
23:33nurvnurvworking
23:33tonylrata_: it does to me, i assume that was your problem
23:33rata_tonyl: my problem is that (instance? A obj) returns false
23:34tonylrata_: I replicated your problem and it threw an exception ClassNotFoundException: x
23:35tonyluntil I took off the (:import x A) from the z namespace, then it all works fine
23:36tonylI don't have the latest version of clojure though
23:36rata_sorry... update the gist
23:37rata_that (:import x A) is supposed to be a (:import [x A])
23:39tonylrata_: ok tested your new gist and it works fine with me
23:39tonylit returns true
23:39tonyland i tested it on both y an z namespaces
23:40rata_mmmm... it's difficult to write a minimal code for this
23:40tonyli understand the situation
23:41tonylmy guess would be if there is other code conflicting with the boolean result
23:41tonylstripe 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:47tonylwell, good night
23:51rata_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:55replacawhat's the leiningen magic for grabbing contrib in master again?
23:56technomancyreplaca: this is for alpha1: [org.clojure.contrib/complete "1.3.0-alpha1" :classifier "bin"]
23:56technomancyyou might be able to drop the classifier now for alpha2 and on?
23:56technomancynot using master at work yet. =\
23:57replacatechnomancy: 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