#clojure logs

2010-04-14

00:15technomancyhugod: what about that function specifically?
00:15technomancyjust see that it makes sense?
00:17hugodok, slime-autodoc works for me in slime head without the patch
00:18technomancyso it was just a temporary bug in an older slime head?
00:18technomancythe hackiness that's evident when looking at slime code makes me feel a little better about the hackiness of swank-clojure
00:20technomancyhugod: gotta take off; will sync up with you later.
00:20hugodtechnomancy: I'm making mistakes - time to sleep - it's hanging for me
00:20technomancya fresh brain often helps =)
00:20technomancybye
00:57vIkSiThello all
00:58vIkSiTi was wondering - on a normal emacs-slime-clojure installation - how do you send a buffer where i'm writing code, to the repl for execution?
00:58vIkSiTi'm using aquamacs, but C-c C-k shows up as "not bound" for me.
00:58tomojwhat mode are you in
00:59tomoji.e. what's in parentheses in the modeline near the bottom
01:00polypusvIkSiT: try M-x slime-eval-buffer
01:01vIkSiTtomoj, ah - i've got a repl running in a split screen mode. the bottom contains [[(REPL)]] and the top has a clj file open which says [[(fundamental)]]
01:01hiredmanshould be clojure-mode
01:01hiredmanor just clojuire
01:02tomojdid you install the clojure emacs stuff before or after opening the clj file?
01:02vIkSiToh got it. clojure mode seems to send CcCk to the REPL.
01:02vIkSiTtomoj, ah, what i did was - typed in (println "foo") and then saved it as /tmp/foo.clj
01:03tomojtry C-x C-f /tmp/bar.clj
01:03tomojif that buffer opens in fundamental mode, something's wrong with your installation
01:03vIkSiTlooks like just M-xc lojure-mode will enable the mode, and I can then use Cc Ck
01:03vIkSiTtomoj, nope, its working now, I overlooked the clojure-mode!
01:04tomojclj files should automatically turn clojure-mode on, though
01:04vIkSiTtomoj, indeed. just looking at me .emacs
01:04vIkSiTmy*
01:05vIkSiTdoes anyone here use clojure for concurrency/parallel programming btw?
01:06vIkSiT(in the sense, they switched to it take advantage of agents, et al)
01:07hiredmanomg
01:07hiredmanincanter.latex
01:09vIkSiTsounds cool
02:49zkim,(conj [1 2] 3)
02:49clojurebot[1 2 3]
03:51LauJensenMorning crew
04:11vIkSiThmm, I'm running clojure-mode on a file named 2.clj in emacs - but I don't seem to be getting auto indentation anywhere
04:11vIkSiTany ideas on what I can check?
04:14LauJensen(global-set-key "\r" 'newline-and-indent)
04:17LauJensen@ vIkSiT
04:17vIkSiTLauJensen, ah this in my .emacs file?
04:17LauJensenYup - Put it in there and eval the expression
04:20vIkSiTLauJensen, awesome, thanks!
04:22LauJensennp :)
04:22npoektophow to compare sets by their content? i have #{{:id 1} {:id 2}} and #{id1 id2}, (= for them should say true.
04:26LauJensennpoektop: Why should it be true?
04:27LauJensenYou could do something like
04:27LauJensen,(map = (vals {:id1 1 :id2 2}) #{1 2})
04:27clojurebot(true true)
04:27LauJensenAnd that would make a little more sense, but you compare a set of hashmaps to a set of symbols should not be true
04:30npoektopLauJensen, i'd like to dereference those symbols so this comparison would give true
04:31LauJensenThen you need to convert them. You want to compare a keyword and an integer, in a concatenated form, to a symbol.
04:32npoektopLauJensen, ok. How to convert them?
04:34npoektopLauJensen, id1 = {:id 1}, id2 = {:id 2}. How to compare #{id1 id2} and #{{:id 1} {:id 2}}?
04:34LauJensenIs the actual comparison (= 2 2) or (= 'id2 'id2) ?
04:34LauJensendoes {:id 1} => id1 or 1
04:36LauJensen@ npoektop
04:38npoektopLauJensen, i do not understand what you mean(
04:38LauJensenI'm just trying to understand your data
04:39LauJensenIs this what you're trying to do
04:39LauJensen,(= (set (mapcat vals #{{:id 1} {:id 2}})) #{1 2})
04:39clojurebottrue
04:39npoektop,(let [id1 {:id 1}] (= id1 {:id 1}))
04:39clojurebottrue
04:42npoektopLauJensen, ok, another way. I have a function profiles-by-ids wich returns a vector of maps. I want to write a test that would check if '(id1 id2) = '({:id 1} {:id 2}). I thought coercing to set would work.
04:43LauJensenOk, so you have a vector of maps ala {:id 1} {:id 2} and you want some way of testing if an id is represented somewhere in that vector?
04:44LauJensen(let [id2 {:id 2}] (contains? #{{:id 1} {:id 2} {:id 3}} id2))
04:44LauJensen...true
04:44LauJensen:)
04:46npoektopLauJensen, ok. But what if there are hundreds of ids? (contains? ... id1) ... (contains? ... idn)?
04:47LauJensenThen perhaps you'd want to filter out those ids
04:47LauJensen,(filter #{{:id 2}} #{{:id 1} {:id 2} {:id 3}})
04:47clojurebot({:id 2})
04:47LauJensenThe predicate in that case, is just a set containing the relevant keys
04:53npoektopLauJensen, what should i do now with that vector?
04:53npoektop,(let [id1 {:id 1} id2 {:id 2}] (filter #{id1 id2} #{{:id 1} {:id 2} {:id 3}}))
04:53clojurebot({:id 1} {:id 2})
04:53npoektops/vector/list. count it's members?
04:56LauJensenFactor it out into a predicate
04:56LauJensen(defn contains-ids? [ids coll] (not (empty? (filter ids coll))))
04:56LauJensenSo if there are no hits, the filter returns empty (true) which we reverse with not.
05:01npoektopLauJensen, i don't know why it didn't work ten minutes ago. I tryed smth like this: (= (set (profiles-by-ids [...]) (set (list id1 id2)))
05:01npoektopnow it works
05:02LauJensenTry it with real data on Clojurebot
05:04npoektop,(let [id1 {:id 1} id2 {:id 2}] (= (set '({:id 1} {:id 2})) (set (list id1 id2))))
05:04clojurebottrue
05:07npoektopLauJensen, my question was a little tangled, i know) thank you for help
05:09LauJensennpoektop: Ah ok. This will fail if the number of arguments differ, I thought you needed to avoid that, ie
05:09LauJensen,(let [id1 {:id 1} id2 {:id 2} id3 {:id 3}] (= (set '({:id 1} {:id 2})) (set (list id1 id2 id3))))
05:09clojurebotfalse
05:09LauJensenBut I'm glad you worked it out
05:15npoektopis there a way to make a variable global, but for one file?
05:15LauJensenThe file concept is tricky, think in namespaces
05:16npoektopok. how to make non-public def?
05:17LauJensen,doc defn-
05:17clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
05:17LauJensen,(doc defn-)
05:17clojurebot"([name & decls]); same as defn, yielding non-public def"
05:18npoektopi'd like to def a variable
05:21hoeck(def #^{:private true} foo 10)
05:21hoeckor (clojure.contrib.def/defvar- foo 100)
05:22LauJensenYea I was just about to say, check out contrib.def
05:37_invisguys could you help me to write this Graphics2D g2 = (Graphics2D) img.getGraphics(); on clojure in let ?
05:39raek(let [g2 (.getGraphics img)] (do-stuff g2))
05:41raek_invis: rhickey does some graphics in the example in the end of this talk: http://clojure.blip.tv/file/812787/
05:42_invisthank you
05:43raek(the "ants example" is available here: http://groups.google.com/group/clojure/files look for ants.clj)
05:52LauJensenAlso my blog has more than a few examples of graphics sims
06:05npoektophoeck, LauJensen, thank you.
06:06hoecknpoektop: np :)
06:21vegaido the authors of The Joy of Clojure visit here?
06:21LauJensenthey practically live here
06:21vegaiah :)
06:22vegaiI was about to ask where to send corrections, but now I see that every single page has a like to a forum...
06:22vegailike/link
06:39LauJensenFor the european (or travel happy) people in here: http://www.bestinclass.dk/index.php/2010/04/clojure-meets-the-european-industry/
06:54esjLauJensen: nice choice - good beer.
06:54LauJensenesj: You should talk to cgrand, that was his argument as well :)
06:55esji tried to sell him on Cambridge, but no dice.
08:12RaynesLauJensen: European training sessions huh? :p
08:13LauJensenThats right - You flying in ?
08:13RaynesLauJensen: For 1200€ sessions? I think not. :p
08:13LauJensenI'll throw in a free cheese burger :)
08:14RaynesI'm sold.
08:14Raynes;p
08:15LauJensenPerfect
08:15RaynesI think the Rubylearning Clojure course guys like me.
08:16LauJensenWhy wouldnt they ?
08:16RaynesJust sayin'. Stuff like this: http://twitter.com/IndianGuru/statuses/12158700306
08:17RaynesSure know how to make a fella' feel warm and fuzzy inside. :p
08:17LauJensenAWwwww :)
08:18AWizzArdIs there already an idiomatic way to serialize (print + read) deftypes?
08:18RaynesThat was after I made the comment that I'm a "teacher undercover as a student".
08:20AWizzArdBest way is to add a print-dup method for user defined types?
08:36AWizzArdchouser: You implemented the printing for deftypes yes?
08:41RaynesWe need a Clojure window manager. ._.
08:41RaynesI want a window manager I can configure in Clojure.
08:51LeNsTR=)
08:52@chouserRaynes: yes. abrooks is working on it. :-)
08:52@chouserAWizzArd: yeah, the current (unreadable) format.
08:55AWizzArdchouser: who calls print-deftype in http://github.com/richhickey/clojure/blob/master/src/clj/clojure/core_deftype.clj#L301 ?
08:55AWizzArdin core_print.clj i didn’t find the caller
08:57rhickeyname game again
08:57AWizzArduh oh ^_^
08:58rhickeyI am trying to support stable names for deftype/defrecord even when used dynamically, using the same technique that definterface does
08:58rhickeythis means that it will be useful to auto-import the class name, and thus would conflict with the current factory fns
08:58AWizzArdrhickey: you wrote about stable nam.. ah, this is what I wanted to ask
08:59rhickeyin addition, there *may* be a facility for providing bodies for the factory fn(s), if so these wil end up as static method(s) of the generated class
08:59AWizzArdStable names means: (defrecord Foo [a b c]), (class (Foo 10 20 30)) <--- will keep the same name even after restarting JVM?
09:00rhickeythus we need name for static factory method, and possble wrapper fn for same
09:00rhickeyI like Foo/create
09:01AWizzArdyes, better than make-instance
09:01rhickeynot sure about wrapper fn, could be create-Foo
09:02AWizzArdIn what situations would the wrapper be used?
09:04rhickeyAWizzArd: hopefully most - it gives you some encapsulation of the host-iness of it. Also would be a first class fn (e.g. mappable)
09:04AWizzArdFoo/create and create-Foo sound good and clear.
09:05AWizzArdInstead of create maybe "new" or "make" could be used, but I like create more.
09:05rhickey"new" can't be used as static method name - Java keyword
09:05AWizzArdok
09:05liwpassuming we want to use the same name in both cases, new is out of the question
09:06liwpand Foo.make sounds weird in Java land
09:06liwpso I too would vote for create
09:06AWizzArdyes
09:07AWizzArdAlso interesting is this new question from the Wiki: "record equality: basic map rules, or incorporate type?".
09:08rhickeyAWizzArd: one question at a time :)
09:08jfieldswhat's the easiest way to create a seq of lines from a file?
09:08AWizzArdio/read-lines returns a lazy seq
09:09AWizzArdjfields: This means your jvm memory will not explode even for 10gb files, but it also means that you have to completely consume the file to have it closed again.
09:09jfieldsAWizzArd, thanks.
09:10rhickeyjfields: or you can use with-open and line-seq for more control
09:10AWizzArdmake, create, instantiate, create!, produce... "create" seems to be the best option
09:12AWizzArdgen / generate
09:13@chouserAWizzArd: 5 lines before that, in the deftype macro. (defmethod print-method ~tag ...)
09:14@chouserAWizzArd: create seems nice for the static method name, but I'm tending to agree with whoever it was that suggested against generating vars with computed names.
09:14@chousersorry, that wasn't specifically for AWizzArd
09:15@chouser(defrecord Foo [a b]) (create Foo 1 2) (create-rec Foo :b 2, :a 1)
09:15rhickeychouser: well, we were generating computed names with the factory fn before, with conflict now on class name
09:15AWizzArdchouser: okay, thanks for the hint with the 5 lines in the deftype macro.
09:16rhickey(record Foo ...) means records are more verbose than new sugar
09:16rhickeyand don't have single mappable fn
09:16rhickeywill we get a lot of (comp record Foo) ?
09:16@chouserAWizzArd: It's ((var print-deftype) ...) to allow the macro expansion to call a private fn
09:16@chouserrhickey: Hm, I suppose. But Foo-create feels like such a hack
09:16AWizzArdI think for such an important mechanism like defrecord it is okay to auto gen Foo/create and create-Foo
09:17rhickeychouser: Foo/create works tough?
09:17@chouser:-) yeah
09:17rhickeyhrm
09:18@chouserFoo is a thing that Foo/create is a part of
09:18rhickeythere still might be (record Foo k1 v1 k2 v2 ...)
09:18@chouserYou can ask Foo for its methods and find create. This doesn't feel like a hack.
09:19rhickeybut any data-driven (maker Tag ...) is going to have overhead vs a dedicated fn
09:19@chouserBut Foo-create is not a part of Foo, it's this other thing that was produced as a side-effect of defining the type.
09:19rhickeychouser: it would never be F00-create, more like create-Foo
09:19AWizzArdHow would we like to create instances of Foos? (Foo/create 1 2 3) or (create-Foo 1 2 3) or (create-rec Foo 1 2 3)?
09:20rhickeyAWizzArd: are you just restating the question?
09:20@chouserso a separate create fn will be: slower, compilcate usage of ->, probably produce a lots of (partial create Foo), ... all in exchange for "feeling" a little less like a hack.
09:20rhickeyFoo/create will be there, is hosty, and non-mappable (at present)
09:21rhickeycreate Tag ... has overhead, needs comp/partial to map
09:22rhickeyalso, there will still need to be a separate keyvals factory
09:22rhickeyin my mind that was (record Foo ...)
09:23@chouserthey might as well have the same shape, right? create-Foo and record-Foo ?
09:23@chouseror (create Foo v1 v2) and (record Foo k1 v1 k2 v2)
09:24@chouserthere's got to be some third way
09:24rhickeyyou have to also consider what Foo designates in (create Foo ...)
09:25rhickeyFoo will be a class name
09:25rhickeythus as an ordinary arg will designate a class
09:26@chouserIs the only strike against just using Foo/create that it's not a proper function?
09:26rhickeychouser: and hosty
09:27@chouserI can easily pretend its namespacy instead
09:27wthiddenrhickey: Was/is there a problem with the way CLOS does this sort of thing that Clojure want's to avoid?
09:28rhickeynote that falling out of this will be the ability to define deftypes of all static methods
09:28AWizzArdwthidden: the proposed way is more like CL structs I find
09:29hoeckwhat about generating a Foo/create static method and a Foo/create static field, where the latter contians the wrapper fn?
09:31wthiddenAWizzard: now that I think more about it I agree its closer to CL structs.
09:31rhickeywthidden: CLOS does the data-driven approach, will not compete perf-wise with direct fns
09:31rhickeyhoeck: sounds confusing
09:32wthiddenrhickey: Ah yes, the seventeen levels of indirection before we actually do some work. Now I rememeber some of the CLOS pain.
09:34AWizzArdSo far it sounds that for technical reasons create-foo has advantages over (create-rec Foo ...).
09:34wthiddenwell if I had my druthers I'd go more towards CL structs way of doing things, but then I'm a lisp weeny at heart.
09:35kzarSo I built Compojure and put the compojure.jar inside ~/.swank-clojure/ directory, restarted Clojure but (use 'compojure) isn't working. What should I do?
09:37rhickeywthidden: I think the data-driven approach is not the best foundation - since each ctor is really unique code, forcing them to live behind a generic data driven interface means you can't ever reach that code directly, whereas if you have the direct fn, you can always build a generic data-driven thingy
09:39npoektopif i do (assoc map key val), it returns a new map. Is there a way to destructively assoc?
09:39@chousernpoektop: not really -- why do you think you want to?
09:40npoektopchouser, i want to insert a new key/val pair into map
09:40npoektopinto existing map
09:40@chousernpoektop: part of the promise of Clojure's persistent maps is that if you have one, you can rely on the fact that it *will not change* on you. It is immutable.
09:41@chousernpoektop: why not create a new map and just start using that one instead of the old one?
09:42hoeckkzar: class-not-found exception?
09:43hoeckkzar: try (->> (System/getProperty "java.class.path") (.split #":") seq (map println) dorun) and look wether your .swank-clojure/compojure.jar is actually on the classpath
09:44npoektopchouser, how to bind (assoc my-map ...) to my-map?
09:44AWizzArdif my-map is state then it could be a ref
09:45npoektopAWizzArd, it's a variable
09:46hoeckkzar: maybe you have to restart emacs too (after putting jars into .swank-clojure or .clojure)
09:46AWizzArdnpoektop: when it needs to get accessed from several parts of your program and is something that could in principle get stored in a db, then you can say (def my-map (ref {})) and assoc into it within dosync
09:47kzarhoeck: Yea when I do it says it couldn't find anything like clojure.clj etc. Doing that command does list compojure.jar as one of the items. I have restarted emacs
09:48npoektopAWizzArd, yeah. I've just read that section. But i need smth simpler. I know it's a lame question, but i can't find how to do (_bind_ my-map (assoc my-map ...))
09:48@chousernpoektop: it depends on your context. AWizzArd is correct, but often the "rebinding" can be done locally and so no reference type is needed.
09:49@chouser,(loop [m {}, i 0] (if (> i 5) m (recur (assoc m i (str i)) (inc i))))
09:49clojurebot{5 "5", 4 "4", 3 "3", 2 "2", 1 "1", 0 "0"}
09:49hoeckkzar: can you paste your error to lisppaste or gist.github.com?
09:49AWizzArdnpoektop: for transient data you should follow chouser advice and rebind it locally, or use reduce or recursion.
09:50@chousernpoektop: there, each time through the loop, m and i are bound to a new value, even though the values themselves (a map and an integer respectively) never change.
09:51hoeckkzar: compojure has also some more dependencies in the deps/ directory, maybe you have to add them to .swank-clojure too
09:54kzarhoeck: hmm OK, here's the paste http://paste.lisp.org/display/97768
09:54sexpbotExecution Timed Out!
09:57kzarhoeck: brb, trying again now that the deps are there
09:59jfieldsis there a good example of using (-> ) anywhere?
10:01kzarhoeck: hey that worked, copied everything from compojure/lib into ./swank-clojure, restarted and it works :)
10:01hoeckkzar: great :)
10:01Raynes$(-> 3 (+ 4) (+ 1) (quot 3))
10:01sexpbot2
10:02Raynesjfields: Are you having trouble understanding it?
10:03jfieldswould prefer one example with each function, to help with understanding, I think I get it tho.
10:04RaynesMy previous example would end up as (quot (+ (+ 3 4) 1) 3)
10:04kzarah crap it didn't work I typed (use :compojure) by mistake which returned nil
10:06RaynesIt's ignoring that link kzar posted, because it has "paste" in it, so it's odd that it just randomly timed out.
10:06Rayneskzar: Think you could drop in #clojure-causal for a moment and mention that link again?
10:07hoeckkzar: mhh, maybe your compojure.jar is corrupt? can you open it in midnight-commander and examine its contents?
10:11hoeckkzar: (or use jar -t compojure.jar on the commandline)
10:12kzarhoeck: Should that command take a long time?
10:13hoeckkzar: maybe, the jar command is slow, thats why I'm always using mc :)
10:14kzarhoeck: Heh ok, all this is new to me anyway. brb going to make some tea. Thanks for the help
10:14kzarso far
10:14hoeckkzar: unzip -l compojure.jar will also work, and its faster :)
10:37kzarstill going heh
10:38wlangstrothjfields: http://java.ociweb.com/mark/clojure/article.html
10:38wlangstrothdo a find for "(->"
10:38wlangstroththat's the clearest example I've found
10:38hoeckkzar: the jar -t ?
10:39sexpbotExecution Timed Out!
10:39RaynesAha!
10:39RaynesOh wait.
10:39RaynesNever mind. :|
10:39wlangstrothie (-> x f3 f2 f1) is the same as (f1 (f2 (f3 x)))
10:40kzarhoeck: Yea, just tried the other command on a different machine and that was instat. Pasted an annotation to my paste with the output
10:40AWizzArd((comp f1 f2 f3) x) is also an alternative
10:40kzarisntant*
10:40kzarahh can't type
10:40RaynesThat last one was because that article is huge and it didn't find a title in time.
10:41RaynesAt least for URL grabbing.
10:41hoeckkzar: oh, there is something missing in your compojure.jar!
10:42wlangstrothAWizzArd: comp doesn't sit well with me, but maybe I have to warm up to it
10:42kzarhoeck: ah bugger, at least that 'splains it
10:42RaynesYou don't like function composition?
10:42RaynesYou'd hate Haskell.
10:43wlangstrothRaynes: no, it's the format - I prefer -> to comp
10:43AWizzArdwlangstroth: I also like -> because it lets us list the jobs in the order we think about them, while comp reverses this but reads like (f1 (f2 (f3 x))) === (comp f1 f2 f3)
10:43hoeckkzar: it should be about 0.5M in size, containing around 400 files
10:43RaynesOh. I agree.
10:43hoeckkzar: maybe download it again or run ant/lein whatever to rebuild it
10:43Chousukecomp creates a new function though
10:43kzarhoeck: Yea I'll get a proper version, I know how to test it's good now as well
10:44kzarhoeck: Thanks for helping me
10:44Chousukeso ((comp x1 x2 x3) foo) is more wasteful than (-> foo x1 x2 x3)
10:44hoeckkzar: youre welcome :)
10:44wlangstrothChousuke: haha - exactly
10:45AWizzArdIs something like reflection planned for defrecords? (defrecord Foo [a b c]), (reflect (create-Foo 1 2 3)) ==> {:class Foo, :create-fn #<ns$_create-Foo___36@e3ed>, :fields [a b c], :options {}}
10:46Chousukeyou can always use the java reflection APIs :P
10:47Chousukebut hm.
10:47ChousukeI accidentally pressed Cmd-Q in emacs, and it then asked whether I want to quit, as there are processes running
10:48ChousukeI answered no, the dialog went away, and... emacs quit.
10:49Chousukethat's a wierd bug to have :P
10:49Chousukeweird*
10:50rhickeyquestion #2 for the day - record equality can have either straight map semantics or include same-type check - preferences?
10:50hoeckChousuke: mhh, doesn't he ask "there are active processes, still want to quit" yes/no?
10:50AWizzArdinclude same-type check please
10:50Chousukehoeck: yes, it did. and I answered no, and it still quit :P
10:51AWizzArdrhickey: please allow me to ask if for Q#1 there is a descision yet.
10:51Licenser_lein search has now update (which updates used libraries :)
10:52rhickeyAWizzArd: no
10:52Chousukerhickey: would there be a way to compare records with map-semantics too then?
10:53rhickeyChousuke: dunno, but there is only one =
10:53AWizzArdI just see that there will be more usecases for included types.
10:55cemerickrhickey: map semantics please.
10:56rhickeycemerick: current deftype uses type tag
10:57cemerickyeah, I noticed :-)
10:59cemerickMixing the type tag into equality seems decidedly contrary to the general approach; records are just bags of slots (expandable, even), protocols cut across all hierarchies as necessary, etc.
11:00rhickeycemerick: I don't get your point re: protocols
11:01AWizzArdthe name defrecord already implies for me that type information is an important one
11:01AWizzArdfirst of all it is a specific kind of data collection, and only secondary it is a map
11:03AWizzArd(into {} (create-Foo 1 2 3)) ==> {:a 1, :b 2, :c 3}
11:03ChousukeI'm more inclined to think that a record is just a map that has been given a name
11:03AWizzArdif that were possible then it would be easy to compare with map semantics
11:03sattvikrhickey: Is there a significant performance penalty for one approach over the other? To a certain extent, I think that type checking vs. general seems somewhat analogous to equals vs. equalsIgnoreCase.
11:04AWizzArdChousuke: (def x {:a 1, :b 2}) is in my opinion a named map, while (defrecord Foo ..) is more general, it categorizes maps of a specific kind.
11:04rhickeysattvik: perf shouldn't matter for this decision
11:04AWizzArdLeaving out the the type in comparisons would miss the point.
11:04cemerickrhickey: my point (hardly made) was that IMO, records are their slots, for which the type tag is merely a shorthand, and it seems that protocols take the same stance.
11:05rhickeycemerick: protocols don't seem subject to meaningful equality
11:05cemerickhrm, now I'm arguing with myself in my head
11:06sattvikcemerick: So would two types with equivalent content be equivalent?
11:06cemericksattvik: that's what I've been suggesting, yes.
11:06cemerickwait, I'm going to go get a Snapple, and then be back with an astonishingly convincing argument.
11:07rhickeyor recant :)
11:08AWizzArdIn principle we would have to see how people are using it. If the place is scattered with (and (instance? Foo obj1) (instance Foo obj2) (= obj1 obj2)) something is wrong.
11:08AWizzArdBut (= (into {} obj1) random-map) is not bad for the case without the type.
11:08sattvikHmm.. should (= (create-Type1 1 false) (create-Type2 1 false))? From a Java perspective, this generally is not the case, but this is not Java...
11:09wlangstrothI'm going to avoid toolshedding entirely, but is there anywhere the defrecord issue is laid out in detail?
11:12AWizzArdNot implicating the type means in principle that a programmer is forced to manually check for the types explicitly in every single comparison, if he/she wants clean and self-documenting code.
11:13sattvikMore specifically, should (= (create-RadialPoint 0.4 1.0) (create-CartesianPont 0.4 1.0))?
11:13AWizzArdtype errors may get detected much later without implicit type checking
11:14cemericksattvik: presumably, the names of the slots are different for those objects.
11:15rhickeycemerick: that's a weak standard
11:15cemerickyeah, I know
11:16AWizzArdcemerick: now that defrecords will possibly get a stable name we can get even more useful serialization (long-term that is, and over the network)
11:16sethsrhickey: OT: how likely are breaking changes to deftype before Apr 22? I'm presenting labrepl then and want to be ready to update the code
11:16cemerickOnce concern I have w.r.t. including the tag is it potentially makes interop between two established, related libraries more difficult.
11:16rhickeyAWizzArd: they always got a stable name when AOTed
11:16rhickeycemerick: how so?
11:17sattvikcemerick: That's true. Or, at least, one should hope so. I am not sure I have a preference. The more general approach does seem more in line with how clojure handles value in general. After all (= [1.0] '(1)).
11:17AWizzArdrhickey: I mean more the "even dynamically" part of your update today :)
11:18rhickeyAWizzArd: that won't hold since while the names might be the same, the classes won't necessarily, and thus the serialization won't be dynamically viable
11:19AWizzArdrhickey: ok, i see. And what about this example case: I don't aot my code and serialize instances of (defrecord Foo [x]), then restart the jvm and reload the code and try to deserialize. Would that work, if the fields of the class didn't change?
11:20cemerickrhickey: well, consider ring and compojure -- for some time, the latter produced "ring-compliant" objects (requests, responses, etc). In such a situation, where one wants to produce records that are functionally equivalent to another lib's records, one would have to use that other lib's defrecord types. That seems like an unnecessary barrier.
11:20rhickeycemerick: your extending this equality limitation to a greater extent, other than equality, they will be substantially interoperable
11:21rhickeyyou're
11:21cemerickI suppose it's largely irrelevant in a world where everyone's using protocols.
11:21AWizzArdcemerick: even when you use Protocols?
11:22AWizzArdwhat if in this scenario my defrecord is incompatible? Then this would go unnoticed, because for a short moment some other ring defrecord may contain the same data/fields, but generally is incompatible.
11:22AWizzArdcemerick: also if (= your-map (into {} some-ring-record)) worked or something similar it would still be fine.
11:23cemericksure, but I'd like to be sure we don't need/want that wart :-)
11:23AWizzArdWhen I vote for "please include the type check" I don't want to *forbid* map-like comparisons.
11:23AWizzArdJust getting the default right.
11:23cemerickOK, let's get into stupid question territory: what are the types *for*? (a) protocol dispatch, (b) construction of an object matching the type's declaration, (c) ....?
11:24AWizzArdprogram correctness
11:24cemerickAWizzArd: meaning what?
11:24rhickey(c) interface implementation, (d) primitive fields, (e) fast accessors
11:24AWizzArdor filtering specific objects out of a vector of records
11:24cemerickrhickey: yeah, I was (perhaps foolishly) trying to stay away from impl details
11:25AWizzArdcemerick: I have no concrete case for that, I just think that objects may slip through comparisons as equal and produce some problems later on
11:26sattvikcemerick: Perhaps interop with host libraries? If I understand it correctly, you could deftype an EJB.
11:27AWizzArdBtw, will the newdeftype be able to do (deftype clojure.lang.PersistentVector ...)?
11:27cemericksattvik: sure -- and in that case, you're sort of opting into the host type hierarchy.
11:27cemerickAWizzArd: OK; say you have type A with slots :start and :end, and type B with slots :start and :end -- if your operations are protocols, where does an "erroneous" equality check lead you astray?
11:28rhickeycemerick: I'd flip it around, doesn't the fact that protocols won't match a same-shaped thing already create a difference?
11:29rhickeyi.e. equality alone doesn't break interop
11:29cemerickrhickey: yeah, that was what I was getting at with the ring/compojure interop thing not really being germane given protocols.
11:30rhickeycemerick: there is a huge amount of data manipulating stuff around maps that will still work, but I'm not sure entire-map-equality is that important an operation
11:31rhickeywhen manipulating things like records
11:31cemerickyeah, neither am I
11:31rhickeyand when it is, you don't ever want apples = oranges
11:32rhickeymaybe a-map-literal = an-orange
11:32rhickeybut I'm hoping for a convenient literal form for orange
11:32rhickey#Orange{:a 1 :b 2} or something
11:33cemerickI'm just trying to ferret out what it means for types to be involved in equality in general, i.e. why (= #Bar{:a 5 :b 6} #Foo{:a 5 :b 5}) would be bad
11:33rhickeycemerick: when Foos and Bars are used as keys in a map?
11:33AWizzArdAlthough there exists one case where it would be comfortable to have a map-like comparison: we don't need to create artificial Foos just for comparisons, or otherwise hack some verbose code. (= some-foo {:a 1, :b2}) vs (= some-foo (create-Foo 1 2))
11:34rhickeycemerick: when Foos and Bars are placed in a set
11:34rhickeyoops, some disappear
11:34cemerickrhickey: well, whether that's good or bad depends on one's preference w.r.t. equality semantics
11:35AWizzArdI already stumbled upon this with sorted-set-bys or sorted maps, don't remember, but I think it were sets. To get objects out of a set with subseq I had to artificially create deftype instances so that the comparator would work.
11:35rhickeycemerick: so, no oranges for me when I send you to buy groceries? :)
11:35AWizzArdI think rhickey got a point here, because that position is more safe. One may want another semantics, but then one should really write ones own comparator.
11:36rhickeycemerick: a common complaint when people were using metadata for types was that it *didn't* participate in equality
11:37cemerickthe other side will be coming for you shortly :-P
11:37rhickeycemerick: likely
11:37cemerickHaving to consider types at all is an odd-feeling reversion after a long time with just maps and multimethods.
11:37rhickeycemerick: but what were you using to distinguish your multimethods?
11:39AWizzArdI always added a :type slot *sigh*
11:39cemericksometimes class or type, oftentimes existence of slots necessary to support the methods being dispatched to.
11:39cemerickSome would say the latter is "manifest typing". 0.0
11:39cemerickhrm, wrong emoticon
11:41cemerickso, given protocol dispatch, I'm now flipping to include type in equality.
11:41cemerickBut there has to be a better solution for untyped equality than (= some-map (into {} foo-record))
11:41AWizzArd(:
11:41cemerickrhickey: the journey is the reward :-)
11:42rhickeycemerick: I agree, and it ends up type-including equality can be built on type-ignoring but not vice-versa
11:42cemerickplus, I got to scare AWizzArd a little ;-)
11:43cemerickrhickey: are we talking about anything fancier than a map-level = plus an instanceof?
11:44Licenser_Is the (theoretical Foo) here a java object or something else? Idnd
11:44rhickeycemerick: I appreciate the push-back. Now with defrecord distinct from deftype it would be possible to do something slightly less efficient with defrecord, if the flexibility was there
11:44rhickeycemerick: nope, just that
11:44Licenser_'t joined early enough sadly
11:44rhickeycemerick: actually identical? classes
11:44rhickeynot instanceof
11:44cemerickoh, right
11:45rhickeyone nice thing about types as metadata was that it was easy to spoof a type on the fly
11:47rhickeyotoh, there's no way to get the perf that deftype + protocols can deliver
11:47moshisushihello tehre
11:47moshisushinoob question: http://pastie.org/919515
11:48cemerickmoshisushi: you need to use clojure.contrib.duck-streams before you can invoke reader directly
11:48cemerickor, better yet, (require '[clojure.contrib.duck-streams :as io]) and then use io/reader
11:48Licenser_moshisushi: you - okay cem was faster
11:48moshisushi:>
11:50moshisushicemerick: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath
11:50bsteuberrhickey: I'm currently working on docstring-support for def - will there be a chance you accept the patch once I sent you the contributor agreement?
11:50moshisushihmm
11:50cemerickmoshisushi: what does your classpath look like?
11:50moshisushijust clojure.jar right now
11:51Licenser_ah you need clojure-contrib.jar too
11:51cemerickmake sure it's the same corresponding version, though.
11:51moshisushiLicenser_: makes sense! sorry for bothering y'all with these lamey questions
11:52Licenser_moshisushi: you are not bothering at all
11:53moshisushioh by they way... anyone knows of a "quotable" paper/article on clojure STM? i'm writing a bachelors essay on STM (in Haskell specifically), and would love to add a short comparison to the clojure dito
11:59cemerickrhickey: you replied "not yet" to Stu's question re: protocol dispatch precedence on the list last month. Should I read that as "coming soon" or "should be possible, but it's not on the table", or something in between? :-)
12:00rhickeycemerick: I really don't want to repeat "prefers"
12:01cemerickrhickey: what was wrong with prefers?
12:03rhickeycemerick: less a problem with prefers than with the situation it addresses (MI of interfaces and the ability to hook protocols up to interfaces). I don't have another solution at present
12:08cemerickgood luck on that one :-)
12:08Licenser_rhickey: I'd watch out this practice is patented by Siemens
12:11cemerickCould just dispatch based on lexicographic order when there's ambiguity. Would make interface names a lot more amusing.
12:12Licenser_a0001Cow a0002Sheep a0003Dog
12:12Licenser_weeh for class names :P
12:12rhickeycemerick: but the problem is always pre-existing interfaces
12:12cemerickrhickey: sure
12:12cemerickthat was a joke, there, son! :-P
12:12Licenser_can't you give the multi method a kind of 'compare' function?
12:13cemerickLicenser_: you can declare dispatch value priority.
12:14Licenser_so where is the problem?
12:20rhickeyLicenser_: no similar capability for protocols yet
12:22Licenser_oh okay
13:39borkdudeGuys, whenever I start swank-clojure-project in Emacs, it keeps polling forever
13:39borkdudewhat could be wrong?
13:41bsteuberBorkdude: check your *inferior-lisp* buffer
13:44Borkdudebsteuber: it starts a server
13:44Borkdude(do (.. java.net.InetAddress getLocalHost getHostAddress) nil)(swank.swank/start-server "/tmp/slime.2347" :encoding "iso-latin-1-unix")
13:44Borkdude
13:45BorkdudeAnd then this happens... Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
13:47Borkdudebsteuber: does swank-clojure-project use clojure+clojure.contrib from the project's lib directory?
13:47polypusBorkdude: yes it does
13:47BorkdudeI have the lib directory at war/WEB-INF/lib
13:47polypusi don't think it'll find it there
13:47cemerickrhickey: Not sure if you're watching this, but this issue is a combination of mundane and really important: https://www.assembla.com/spaces/clojure/tickets/281-make-more-datastructures-serializable
13:48sexpbot#281 - Make more datastructures serializable (Test) | Clojure | Assembla
13:48BorkdudeI am trying to run this project here http://github.com/sethtrain/beget
13:49Borkdudeah.. so swank-clojure-project doesn't really 'read' project.clj, it just supposes you use the same structure always?
13:49Borkdudethat would explain
13:49polypusyep. that got me once too
13:54s450r1Borkdude: since you have a project.clj, I'm guessing you're using lein? If so, you can run "lein swank" and then connect from emacs with M-x slime-connect. Then you can use the jars in war/WEB-INF/lib, I think.
13:55bsteuberBorkdude: so maybe you should go with lein swank then
13:55bsteubers450r1: oh, didn't see your post
13:55Borkdudes450r1, ah that sounds helpful
13:56BorkdudeI now made a symbolic link from lib to the war dir which also works
13:56Borkdudebut lein swank sounds cleaner
13:57Borkdudes450r1: borkdude@Ubuntu-VM:~/temp/beget$ lein swank
13:57Borkdudeswank is not a task. Use "help" to list all tasks.
13:57Borkdude
13:58Borkdudeah I see I need a plugin, sorry
13:58bsteuberyeah, they changed this
13:59technomancyno, it's always been a separate plugin
14:00s450r1Borkdude: oops, sorry, should have included that information
14:00s450r1http://wiki.github.com/technomancy/leiningen/emacs-integration
14:00bsteubertechnomancy: oh - then I guess I used the plugin without realizing :)
14:01Borkdudes450r1: yup, it works, thanks!
14:06s450r1np, technomancy did all the work :-)
14:07s450r1technomancy: thanks for all your projects, I'm using a good number of them... oh wow, relax.el, I think I can use that right now. Sweet!
14:07technomancys450r1: that makes one of us
14:08technomancyI haven't used it since I wrote it =)
14:09wlangstrothtechnomancy: lein is gold, though
14:10wlangstrothtechnomancy: I'm not trying to embarrass you or anything, but if I had to start with maven instead of being eased into the process with leiningen, that would have been painful
14:11wlangstrothso thanks from me, too
14:15technomancygreat =)
15:20BorkdudeHow do I specify the namespaces to compile in a project.clj?
15:20Borkdude:namespaces [beget beget.templates] ??
15:22BorkdudeI changed the beget/templates.clj file lein says all :namespaces already compiled
15:23jweissis there a fn, maybe in contrib that will automatically (use 'blah.blorg :reload-all) when i save blah/blorg.clj?
15:28LauJensenjweiss: You aren't that PHP blogger by any chance, are you?
15:28jweissLauJensen: PHP? good lord, no
15:28LauJensenOk, then I'll be happy to help
15:28jweisshehe
15:29LauJensenClojure doesn't know when you're saving files, you if you want that kind of functionality, you need to work it into Emacs
15:29LauJensen(just kidding, I have no hate for PHP bloggers)
15:29jweissLauJensen: yeah i figured it'd either have to run as a thread or agent from the repl
15:29jweissbut your emacs suggestion sounds interesting as well
15:40programblewow
15:40programbleyou guys arent pricks
15:41heejphey
15:41heejpcan anybody help me with something, please?
15:41programblefuckin #python pricks
15:41programbleheejp: just ask :)
15:41heejpI'm having trouble with multimethod dispatch functions
15:42heejpI'm working on an object system called Fenrir
15:42heejpand here's my instance making function:
15:42heejp(defmulti new-obj #(:_fenrir_class-name %))
15:42heejp(defmethod new-obj ::fObject [fclass & kvals]
15:42heejp (with-meta (apply struct-map (conj kvals (:_fenrir_struct fclass)))
15:42heejp {:_fenrir_class (:_fenrir_class-name fclass)}))
15:42kotarakheejp: please paste somewhere and post the link here
15:42LauJensen~paste
15:42clojurebotlisppaste8, url
15:42kotarakeg. paste.lisp.org
15:43heejpsorry
15:43LauJensenprogramble: One of the tricks of keeping a calm and friendly community, is to avoid from foul language and dissing other groups - So appologize and move on :)
15:43heejpI'll take that into account next time
15:43heejpanyway
15:43heejpwith that code snippet I pasted
15:43heejpwhen I do something like this:
15:44heejp(new-obj fGameObject :location 1 :sprite 2)
15:44heejpI get this error:
15:44heejpjava.lang.IllegalArgumentException: Wrong number of args passed to: core$fn (repl-1:17)
15:44kotarakheejp: you dispatch function must take the same number of arguments. Try: #(:_fenrir_class-nam (first %&))
15:45heejpum...
15:45heejpI see
15:45heejplet me try it
15:45hiredman(comp :_fenrir_class-nam first list)
15:46heejphey
15:46heejpit worked!
15:46heejphehehehe
15:46heejpthanks, guys
15:58dakrone,(.replaceAll "foo\bar" "\\" "SLASH")
15:58clojurebotjava.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^
15:58dakrone,(.replaceAll "foo\\bar" "\\" "SLASH")
15:58clojurebotjava.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^
15:58dakrone,(.replaceAll "foo\bar" "\\\" "SLASH")
15:58clojurebotEOF while reading string
15:58dakrone,(.replaceAll "foo\bar" "\\\\" "SLASH")
15:58clojurebot"foo\bar"
15:58dakronecan someone tell me how to get the backslash replaced?
15:59kotarak,(.replaceAll "foo\\bar" "\\\\" "SLASH")
15:59clojurebot"fooSLASHbar"
15:59kotarakI think "\b" is bell, no?
15:59programbleit is
15:59programbleno wait
15:59programbleisnt that \a?
16:00kotarakbackspace, maybe?
16:00programbleyes
16:00dakroneokay, why the 4 slashes for 1 regular slash?
16:00kotarak2 for the string, 2 for the regex
16:01kotarakregex requires \\, but \\ in a String is only one \.
16:01opqdonutthe string "\\\\" is really the string "\\" which corresponds to the regex "\"
16:01dakroneahh, so escaping for the reader, then escaping again for the regex
16:01hiredman,(->> #"" class .getMethods (map #(.getName %)))
16:01clojurebot("toString" "matches" "split" "split" "compile" "compile" "matcher" "quote" "pattern" "flags" "wait" "wait" "wait" "hashCode" "getClass" "equals" "notify" "notifyAll")
16:02hiredmansplit but no replace
16:02opqdonutdakrone: yeah, basically
16:02kotarak,(.toString #"\\")
16:02clojurebot"\\\\"
16:03kotarak,(str #"\\")
16:03clojurebot"\\\\"
16:03BorkdudeAnd then suddenly 'lein swank' stopped working, no idea what happened
16:03kotarak,(.replaceAll "foo\\bar" (str #"\\") "SLASH")
16:03clojurebot"fooSLASHbar"
16:03dakronehow does http://gist.github.com/366261 look for stripping out Clojure reader chars
16:03dakroneam I missing any?
16:04Borkdudestill have this in my project.clj: :dev-dependencies [[swank-clojure "1.1.0"]
16:04Borkdude [leiningen/lein-swank "1.1.0"]]
16:04Borkdudethen it should just work, right?
16:04LauJensendakrone: ^ ?
16:05hiredmandakrone: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L516
16:05kotarak^ is deprecated
16:05hiredmanoh
16:05LauJensenI vote for undeprecating it!
16:05hiredmanreader macros
16:05LauJensenOh wait, we're not voting :)
16:05hiredmanit's going to be used for type hinting
16:06kotarak"clojure is not designed by public voting" rhickey (or something like that) (and that's good, IMHO)
16:06dakroneLauJensen: thanks, I'll add that one
16:06dakronehiredman: cool, thanks
16:07LauJensenkotarak: Of course its good
16:08StartsWithKthere should be a secret voting then :)
16:08LauJensenStartsWithK: oh there is...
16:08LauJensenI'm pretty sure :)
16:09hiredmanclojurebot: secrets?
16:09clojurebotI don't understand.
16:09StartsWithKhmm.. is there a secret handshake too.. we may never know
16:09hiredmanI think polls have been on the todo list for clojurebot forever now
16:11kotarakStartsWithK: #^'~@ (<- secret reader macro)
16:12StartsWithKkotarak, hehehe
16:12LauJensenThe secret is, that when you see the Clojure Logo in a mirror, it reads "PERL" in swirly 3d letters
16:13StartsWithKrepl is a hidden clue :)
16:13kotarakI use Clojure as my secret weapon at work. Maybe we'll be able to hide clojure in perl programs to perfect this technique.
16:20raekwhat is recommended for signaling exceptions? deftype'd java exceptions? c.c.error-kit? c.c.condition?
16:23StartsWithKraek, gen-class is your only option if you want new exception name (or java)
16:23raekI want the ability do distinguish different kinds of errors
16:24hiredmancondition has a niggling little bug that I don't think is fixed upstream yet
16:24raek...but not neccerarily by having a java class for each one
16:24hiredmanthe various java.lang exceptions aren't good enough?
16:24BorkdudeAny idea why my 'lein swank' is not working anymore?
16:24hiredmanclojurebot: exceptions!
16:24clojurebothttp://paste.lisp.org/display/74305
16:25BorkdudeIt worked an hour or so ago...
16:25hiredmanclojurebot: botsnack
16:25clojurebotthanks; that was delicious. (nom nom nom)
16:25bsteuberBorkdude: what's the exact problem?
16:25Borkdudeit says 'swank is not a task'
16:26hiredmanhave you run lien deps?
16:26Borkdudehiredman, yes, but I will do it now to be sure
16:26hiredmanthe swank plugin needs to be a dev dependency
16:26hiredmanand deps will fetch it
16:28Borkdudeah I now get it
16:28Borkdudealso with lein swank it doesn't support the lib directory to be something other than <proj-dir>/lib
16:29Borkdudeeven if specified otherwise in project.clj
16:29Borkdudeeven if > although I mean
16:39slyphonanyone else have slime sort of mysteriously change back to the 'user' namespace occasionally?
16:41tomojwhen I tell it to switch into a namespace that doesn't exist, it goes back to 'user'
16:41tomojthat's the only time I've noticed it
16:41slyphonhmm
16:41slyphonoh, maybe it's when i open a namespace i haven't previously required
16:41slyphonor compiled
16:41tomojyeah, that would do it
16:42slyphonok, as long as i'm not just losing it :)
16:48ztellman,(assoc {} :octaves 3)
16:48clojurebot{:octaves 3}
16:48ztellmanhmm, in 1.2.0 that throws an exception for that particular keyword
16:48ztellmananyone know why?
16:51@chouserztellman: seems to work fine here
16:52dakroneyea, same here
16:52ztellmanhmm, when I open a fresh repl it works fine for me too
16:53ztellmanweird, dunno how I got into this state
16:53tomojwhat's the exception??
16:53ztellman(class: example/opengl/marble$eval__70767, method: <clinit> signature: ()V) Incompatible argument to function
17:19Licenseris there a function to test if something is a map?
17:19Licenseraka hashmap
17:20remleduffassociative? maybe
17:21tomojwell, there's map?
17:22Raynes$(map {})
17:22sexpbotWrong number of args passed to: core$map
17:22Raynes$(map? {})
17:22sexpbotDENIED!
17:22RaynesOrly
17:22RaynesMust not have map? whitelisted.
17:22remleduff$(associative? {})
17:22sexpbotfalse
17:22remleduffColor me surprised
17:22remleduff$(associative? [])
17:22sexpbottrue
17:23RaynesWhoda thunk it?
17:23remleduff$(doc associative?)
17:23sexpbot------------------------- clojure.core/associative? ([coll]) Returns true if coll implements Associative
17:23tomojuhh
17:23tomojhere, (associative? {}) is true
17:23Raynes,(associative? {})
17:23clojurebottrue
17:24RaynesLicenser: ^ That's kind of weird.
17:24Licenserno that my friend is a bug
17:24RaynesOh.
17:24RaynesI thought so.
17:30Licenserthanks for the help and night people
18:00maaclWhy would I get a null pointer exception if I try to do M-. (using emacs/SLIME) on a the name of a var in the same file as it is defined, while it works perfectly well if doing the same from within another file?
18:08dnolenmaacl: that will only work if you ran compile file (C-c C-k) on that file, if you eval'ed a secpr with C-x C-e, M-. will not work
18:09maacldnolen: ah, thanks
20:27rhickeyit's alive! - first cut of defrecord is up
20:33arohnerhttp://arohner.blogspot.com/2010/04/writing-jquery-code-with-scriptjure.html thoughts?
20:33sexpbot/dev/rohner: Writing JQuery code with Scriptjure
22:27vIkSiThi all
22:27vIkSiTcan anyone point me to some documentation on settings up slime / swank for a specific project started using lein?
22:30slyphonhttp://technomancy.us/126
22:30sexpbotin which are found tricks of the trade concerning clojure authorship - Technomancy
22:35vIkSiTslyphon, ah my problem is that once I do M-x swank-clojure-mode .. and point it to the proejct dir..
22:36vIkSiTI'm still stuck with a "Polling /var/folders.." message and slime never starts up.
22:36slyphondoes "lein repl" work in your project dir?
22:36clojurebothttp://www.thelastcitadel.com/dirt-simple-clojure
22:37vIkSiThmm
22:37vIkSiTyes it does - but looks like it takes 1.1.0 rather than 1.2.0-master that I have otherwise
22:38slyphon1.2.0 hasn't been released officially yet, afaik
22:39Raynes1.2.0 master works with it.
22:39vIkSiTslyphon, ah yes, I mean that 1.2.0 is the JAR I'm using in my CP
22:39vIkSiTso I guess there are 2 issues : 1) lein repl picks up a 1.1.0 jar; and 2) swank doesn't connect to anything at all.
22:40vIkSiTso 1) can i specify a version of clojure for lein to use, and 2) is there a way to see the output of the swank-polling process to see where it hangs?
22:40arohnervIkSiT: the released version of lein starts the clojure version it's built with
22:40arohnersorry, the stable version of lein
22:40vIkSiTarohner, ohh I see.
22:41arohnerthat's fixed on lein HEAD
22:41vIkSiTthat sucks
22:41vIkSiTdo you recommend using the version of lein that runs 1.2.0?
22:41arohnerI haven't tried it, but I think other people are using it successfully
22:42vIkSiTah ok.
22:42vIkSiTand any ideas about question 2) ?
22:43slyphon*slime-events* buffer?
22:43slyphoni usually do lein swank
22:43arohneralso check *inferior-lisp*
22:43slyphonand then connect using M-x slime-connect
22:43slyphonthat way if there's a narsty stack trace i see it
22:43slyphon(it also lets you set properties on the command line)
22:44slyphon(more easily than the other way)
22:45vIkSiTwait, you do lein swank from the command line?
22:45vIkSiTis that a valid option?
22:45slyphonyes
22:45vIkSiTweird. It doesn't seem so in my case
22:45slyphonare you using a recent lein
22:45slyphonwait, hang on
22:46vIkSiT"swank is not a task. Use "help" to list all tasks."
22:46slyphonlein version?
22:47liebkemake sure you have [leiningen/lein-swank "1.1.0"] in your project file in :dev-dependencies
22:47slyphonah, that too
22:47slyphonit's a plugin
22:51vIkSiTone sec, checkingversion
22:51vIkSiTits 1.1.0
22:51vIkSiTI've added :dev-dependencies [[leiningen/lein-swank "1.1.0"]] to my project.clj now
22:53vIkSiTand now doing a lein deps.
23:07arohnerso if I have a deftype/defrecord, and I get its constructor, java claims the constructor takes n+2 arguments, where 2 is the number of fields I have
23:07arohnerlisppaste8: url?
23:08hiredmanarohner: I imagine it also takes a map of metadata and maybe other stuff
23:08arohnerhiredman: oh right, there are two
23:24arohnerhiredman: btw, props again on naming c.c.java-utils/wallhack
23:24arohnerI have a legitimate use for it now, and I smile each time I see the name
23:34timcharperIs there a way to map a collection of values across a function that has a side effect and still get the return value?
23:34timcharperActually using the return value (somewhere down the line) is optional.
23:34timcharper(I'm mapping over a collection of hash maps and inserting records in a database, returning the results from those inserts)
23:35timcharperHowever, doseq, while successfully causing the side effects to occur, returns nil
23:36arohnertimcharper: you can (doall (for [] ...))
23:36arohneror (doall (map...))
23:37timcharperExcellent! That's exactly what I'm looking for :-) thank you!