#clojure log - Sep 26 2010

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

0:02 amalloy: heh. too late, bhenry

0:09 bhenry: that explains why it didn't tab complete his name.

0:09 yayitswei: ,(+ 1 2)

0:09 clojurebot: 3

0:09 yayitswei: just testing clojurebot

0:09 amalloy: clojurebot: can you still add?

0:10 clojurebot: Pardon?

0:10 yayitswei: clojurebot: wow you have language processing too?

0:10 clojurebot: processing is a language/toolkit for visualizations. See the Clojure wrapper at http://github.com/rosado/clj-processing/

0:25 kumarshantanu: hi, is it possible to assign docstring to a def'ed var?

0:26 ,(defn foo "Foo the arg" [x] (println "foos" x))

0:26 clojurebot: DENIED

0:26 kumarshantanu: (def bar foo)

0:26 (doc foo)

0:26 clojurebot: Pardon?

0:26 kumarshantanu: (doc bar)

0:26 clojurebot: I don't understand.

0:36 amalloy: kumarshantanu: you can't def things

0:36 with clojurebot, i mean

0:37 kumarshantanu: and yes, it is possible to assign docstrings to arbitrary vars, but i don't know the syntax

0:38 ,(source doc)

0:38 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

0:38 amalloy: ,(clojure.repl/source doc)

0:38 clojurebot: Source not found

0:38 kumarshantanu: amalloy: okay

0:39 amalloy: anyway try (with-meta) - it's one way to get what you want, if you figure out how

0:39 kumarshantanu: I found I can specify (def ^{:doc "The docstring"} bar foo)

0:40 but it (doc bar) is not the same as (doc foo) then

0:40 amalloy: kumarshantanu: meta-data is attached to vars, not values

0:41 but you could probably do (def {} foo foo) to attach meta to it

0:41 technomancy: amalloy: well, it's attached to both

0:41 but doc examines the var

0:42 amalloy: ah, here comes a real programmer to help out us bumblers

0:44 technomancy: actually, metadata on fn values is new to 1.2.0, so perhaps I'm being pedantic.

0:46 kumarshantanu: I am trying to create an alias for a function name -- hence the docstring thing

0:47 technomancy: I think you either need a macro for that or you must alter the metadata after defining the alias var

0:48 kumarshantanu: http://p.hagelb.org/metadata-on-aliases.html

0:49 that should do the trick

0:51 kumarshantanu: technomancy: ah....is that same as this? (def ^{:doc "foo doc" :arglists....} bar foo)

0:52 and where can I find a list of all keywords that applies to metadata?

0:52 technomancy: kumarshantanu: it just ensures that the metadata on the second is a copy of the first; the result should be the same as if you put them in ^{} in the def

0:53 I don't know of a list other than just checking an existing defn

0:53 ,(keys (meta #'comp))

0:53 clojurebot: (:ns :name :file :line :arglists :added :doc)

0:53 technomancy: :added is mostly just used in Clojure itself I think

0:53 kumarshantanu: technomancy: thanks! that was helpful

0:54 technomancy: no problem

1:00 brehaut: and enlive gurus present?

1:09 amalloy: kumarshantanu: i poked around a bit and you can alsu use alter-meta!

1:10 kumarshantanu: amalloy: yeah true, that's technomancy: said as well

1:13 amalloy: oh, i didn't follow his link

1:18 yayitswei: is there a way to use the latest version of a library in the project.clj file, or do I always have to specify the version?

1:22 amalloy: SNAPSHOT

1:23 put something like this in your :dependencies [cassandra-wrapper "0.6.3-SNAPSHOT"]

1:23 you still have to specify a version, but it will fetch the latest work done on that version, is my understanding

1:25 yayitswei: amalloy: there's no way to say "use the latest stable version?" for example, I want to use appengine-local-runtime but I'm not sure where to check to see what version numbers are available

1:27 jstirrell`: test

1:27 What's the best way to remove regex matches from a string in 1.2?

1:29 technomancy: yayitswei: you can use the lein-search plugin to update project.clj to include the latest

1:29 but having a "LATEST" version is just asking for trouble

1:30 even regular SNAPSHOTs are really only acceptable in production for libraries you control yourself

1:36 scottj: jstirrell`: .replaceAll maybe

1:43 yayitswei: technomancy: ah, so I guess what I was asking was a standard way of looking up the latest version

1:49 sounds like lein-search does just that.. thank you

1:56 dmead: hi channel

1:56 i'm trying to run clojure in emacs with slime and clojure mode.

1:57 and i keep getting an error saying inferior-lisp-proc is void

2:01 klang: dmead: http://github.com/vu3rdd/swank-clojure-extra

2:02 dmead: or see how it is done in http://github.com/relevance/labrepl (probably better)

2:02 dmead: ah

2:02 thanks

2:02 i guess

2:03 klang: swank-clojure-extra will let you run with an inferior-lisp-proc .. labrepl woun't ..

2:04 But I have both ways running to my own satisfaction (function tips are showing, jumping around the code works, eval current sexp works)

2:05 dmead: ahh

2:06 klang: did I help?

2:06 dmead: i just don't understand why it isn't set to something in clojure-mode

2:06 not really :(

2:07 klang: At least it doesn't complain when running labrepl ..

2:11 dmead: blah

2:11 klang: with labrepl, I connect to an external slime with slime-connect, with swank-clojure-extra (swank-clojure-project) I connect to an inferior slime running in emacs (starting up another repl)

2:12 of course, lein is used to control the projects (cake could be used as well, I guess)

2:12 dmead: i'm getting the impression that clojure-mode doesn't play nice if you have another lisp installed

2:13 thats the problem, slime is fucking up

2:14 klang: ah, custom emacs setup, eh? .. see http://github.com/briancarper/dotfiles

2:14 dmead: good lord.

2:15 klang: search for 'clojure' :-)

2:29 slyrus_: dmead: I use both clojure-mode and lisp-mode side by side

2:40 amalloy: wow klang, that is a lot of emacs customization

2:40 bookmarking that so i can selectively import stuff once i figure out whether i want it

2:41 klang: amalloy: in my case? well .. you collect a few things after one and a half decade of emacs use .-)

2:45 amalloy: i have about two months of emacs use under my belt

2:45 you should have seen how excited i was last night when i found out i could get it to use color-blind-friendly colors over the tty

2:45 klang: it's a worthwile investment, in my oppinion

2:46 amalloy: oh, absolutely. i wouldn't write a lisp in anything else, and i'm using it at work for php too ever since eclipse crapped out on me

2:46 klang: I must admit that php is my bread and butter too (and perl, and bash and, and and)

2:49 amalloy: every so often i shake my head when i realize how much time i wasted being just barely able to muddle my way through vi. i guess i wasn't using a lot of unix then, so it was excusable (no offense to vi users in the channel; i just never learned it right)

2:53 klang: When push comes to shove, I _can_ use vi, to open change and close a few files :-)

2:53 amalloy: yes. i know where undo, cut, and paste are

2:53 clojurebot: lisppaste8, url

2:54 amalloy: and everyone's favorite "augh what was that key i just pressed?" :q!

2:54 klang: vi would be my choice, if I had to connect to a running clojure instance via a smart phone .. emacs has too many keyboard modifiers, and vi is practical in that case

2:54 amalloy: the "abort abort abort panic" key :-)

2:55 amalloy: maybe. i haven't yet found a shell app for my phone that's visually accessible, and i wouldn't torture myself by trying to write clojure on it anyway

2:56 klang: just to show that you can?

2:57 pomyk: I tried using vi on an iPod, doesn't work very well

2:58 amalloy: well, i wrote a list-sum program with the phone's text editor, to demonstrate lisp syntax to a friend. painful, but not as bad as trying to use shell/vi

2:59 klang: pomyk: but it does work .. as a coolness demonstration!

3:04 pomyk: with a better keyboard it would be usable actually

3:08 klang: pomyk: do you know if the bluetooth keyboard can be used on an iPhone?

3:16 pomyk: klang: looks like iOS 4.0 has support for bluetooth keyboards

3:17 klang: interesting! Then we might see some small bluetooth keyboards soon .. 3rd party

3:17 kumarshantanu: is it possible to get a list of all types that a var belongs to? unlike (type arg)

3:18 amalloy: ,(supers (java.util.ArrayList.))

3:18 clojurebot: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Class

3:18 amalloy: ,(supers (class (java.util.ArrayList.)))

3:18 clojurebot: #{java.util.List java.lang.Cloneable java.io.Serializable java.util.Collection java.lang.Object java.util.RandomAccess java.util.AbstractCollection java.util.AbstractList java.lang.Iterable}

3:18 kumarshantanu: amalloy: thanks!

3:19 amalloy: kumarshantanu: i make sure to always be right on exactly the second try :P

3:20 kumarshantanu: amalloy: he he...just added supers to "see also" for "type" on ClojureDocs

3:21 amalloy: where is this ClojureDocs thing?

3:21 clojurebot: ClojureDocs?

3:21 clojurebot: Gabh mo leithscéal?

3:22 kumarshantanu: amalloy: http://clojuredocs.org/v/2068

3:50 Raynes: Where did the clojure.java.* docs go?

4:03 kumarshantanu: is there any equivalent of Java instanceof in Clojure?

4:03 jarpiain: ,(instance? String "foo")

4:03 clojurebot: true

4:04 kumarshantanu: jarpiain: thanks?

4:07 s/?/!/

4:30 can I also cast a class as another in Clojure?

4:31 tomoj: no reason to

4:31 well, except maybe when calling java methods? there you use type hints

4:31 kumarshantanu: tomoj: I have a use-case

4:32 (defprotocol IFoo)

4:32 (instance? IFoo something)

4:32 this doesn't work because instance? expects a Class, and IFoo is a persistentArrayMap

4:34 tomoj: (doc extends?)

4:34 clojurebot: "([protocol atype]); Returns true if atype extends protocol"

4:36 tomoj: (instance? IFoo something) works in a different namespace if you import the interface

4:36 but extends? is made for this

4:41 kumarshantanu: tomoj: cool, thanks!

4:41 (extends? IFoo (type something)) it is

6:15 quizme: anybody have suggestions as to how to get a clojure job ?

6:23 LauJensen: quizme: in which setting?

7:26 FYI this is not a unique machine ID

7:26 (->> (enumeration-seq (java.net.NetworkInterface/getNetworkInterfaces))

7:26 (map #(hash (.getHardwareAddress %)))

7:26 (apply str))

7:55 coldhead: can anyone suggest why i cannot get (use '[clojure.contrib.duck-streams :only (spit)]) to work when for example (use '[clojure.contrib.str-utils :only (re-split)]) works happily?

7:56 i get java.lang.NoClassDefFoundError: Could not initialize class clojure.contrib.duck_streams__init (NO_SOURCE_FILE:0)

7:57 AWizzArd: coldhead: have a look into your clojure-contrib.jar file (it is just a .zip file with another extension), and see if duck-streams is present.

7:57 raek: strange... what versions are you using?

7:57 also, clojure.contrib.duck-streams kinda changed into clojure.contrib.io and later clojure.java.io

7:58 Raynes: If you're using Clojure 1.2, check out clojure.java.io

7:58 raek: but the old ones should be fully functional in 1.2

7:58 coldhead: clojure/contrib/duck_streams.clj is present, apparently

7:58 this is c.c-1.1.0

7:59 raek: and you're using the same version of clojure and contrib?

8:00 coldhead: no, clojure-1.2.0-master-SNAPSHOT

8:00 raek: ah

8:00 coldhead: i gather that's a likely cause

8:00 i'll downgrade

8:00 raek: different versions of clojure are not binary compatible with each other

8:00 Raynes: c.c is AOT compiled.

8:00 So, if you use mismatched versions.

8:00 Boom.

8:01 coldhead: but not boom everywhere, which is what confused me

8:01 thanks for the wisdom

8:01 Raynes: I've never had that sort of boom before.

8:01 :\

8:01 Mine are usually loud and resounding.

8:02 raek: code written for 1.1 should work with 1.2 too

8:02 so, you could upgrade both

8:08 coldhead: mucho gracias, friends, all is well now

8:10 Raynes: coldhead: De nada.

8:21 klang: Raynes: Hablas Español de puta madre! :-)

8:23 Raynes: klang: I don't speak Spanish, but but I do know what those words mean. :p

8:24 klang: Raynes: They are not negative, just so you know ;-)

8:24 Raynes: Right.

8:24 ;)

9:07 fliebel: good afternoon everyone :)

9:07 (dependfing on you timezone of course)

9:28 raek: fliebel: good afternoon (CEST)

10:02 v-alex: hi all

10:03 this is probably a dumb question, but is there a way to unquote-splice a form that is *not* inside a syntax-quote?

10:04 Raynes: You could probably just use the apply function.

10:05 v-alex: Raynes: with identity? don't know

10:05 Raynes: Show me what you're trying to do.

10:05 v-alex: Raynes: i'm trying to write a macro without using syntax-quote

10:06 Raynes: Oh.

10:06 v-alex: Raynes: i could point you to the specific example :)

10:06 Raynes: I misunderstood what you were trying to do.

10:06 v-alex: Raynes: yeah, don't know exactly how to describe it

10:14 Raynes: v-alex: http://gist.github.com/597962 You just have to be a little creative.

10:18 Well, I should have quoted +, but nonetheless. http://gist.github.com/597964

10:18 v-alex: Raynes: i see

10:18 Raynes: yeah, np

10:19 Raynes: v-alex: If you need any help with your specific case, don't be afraid to ask.

10:20 v-alex: Raynes: thx; i'm still trying to comprehend this.

10:21 Raynes: It helps to realize that you're simply working with data structures. You can back away from your macro and see how they are being constructed. Just doing stuff like (list '+ 1 2 3) and seeing the output can be enlightening.

10:23 v-alex: Raynes: yeah, seems obvious know

10:23 Raynes: that's my case: http://gist.github.com/597967

10:25 Raynes: apply is also a nice trick

10:26 Raynes: Indeed, but cons tends to do the trick in macros, and probably makes more sense.

10:28 Unless of course, you enjoy redundancy. :p

10:28 -> (apply list '(+ 1 2 3))

10:28 sexpbot: ⟹ (+ 1 2 3)

10:28 Raynes: (+ 1 2 3)

10:28 clojurebot: *suffusion of yellow*

10:28 Raynes: failpaste

10:29 v-alex: Raynes: macros are still mystified for me

10:30 Raynes: I guess working with non-homoiconic languages makes that to you

10:30 Raynes: It'll all become clear.

10:31 v-alex: Raynes: i guess so. Thank you :)

10:32 fliebel: Has anyone in here read this? http://lambda-the-ultimate.org/node/4088 And if so, what do you think about it?

11:29 hrm, what is a sensible thing to do when I need apply for a macro? A nonsensical thing would be syntax-quoting and evaling. Another thing could be a macro for the macro. Basically I need ~@var outside of a macro.

11:30 I'm making an enlive template on-the-fly, using the list of expressions.

11:31 Raynes: That sort of thing typically needs to be done in a macro.

11:32 fliebel: Raynes: The point is that I have as huge macro as it is now, and I want to split it up in readable chunks.

11:32 Raynes: Unless you use eval, I'm doubtful you'll find a way to do exactly what you want.

11:33 fliebel: okay, so since eval is evil, I'll use a macro.

11:34 Raynes: You could do the splicing inside of your huge macro and pass it to the readable chunk that needs it, if possible.

11:35 fliebel: Yea… plausible option.

11:35 Hey, isn't there just macro, like there is fn?

11:36 wooby: fliebel: na, macros aren't first class like fns are

11:52 fliebel: Oh, another apply-related question. Or -> rather. -> inserts the result in the second position, but in my case the result is a function. Should I use apply, go for nesting, or is there another trick?

11:58 Raynes: fliebel: I'm not sure what you mean. Are you trying to do something like this: (-> 1 #(+ % 3))?

12:00 fliebel: Raynes: Rather (-> + (1 1)

12:01 Raynes: -> (-> '+ '(1 1))

12:01 sexpbot: ⟹ (quote +)

12:01 Raynes: Heh.

12:02 fliebel: ,(-> '+ (list 1 1))

12:02 clojurebot: (+ 1 1)

12:02 Raynes: Indeed.

12:02 fliebel: ,(-> + (list 1 1) eval)

12:02 clojurebot: DENIED

12:05 fliebel: But is that any better than this?

12:06 ,(-> + (eval [1 1]))

12:06 clojurebot: DENIED

12:06 fliebel: ,(-> + (apply [1 1]))

12:06 clojurebot: 2

12:06 fliebel: I mean

12:08 raek: -> forms can be nested

12:08 sexpbot: java.lang.Exception: Unable to resolve symbol: forms in this context

12:09 fliebel: raek: What are you aiming at?

12:10 raek: (-> x (a b) (-> (p q) (r s)) (c d)) => (c (r (p (a x b) q) s) d)

12:10 oh, I misinterpreted the question

12:11 fliebel: np

12:11 raek: apply sounds resonable to me

12:11 Raynes: Don't see anything wrong with apply here.

12:11 fliebel: okay :)

12:47 jk_: can you have a namespace across multiple files?

12:48 there must be a way to "continue" the namespace in another file but i don't see it

12:49 fliebel: jk_: Maybe in-ns? Just guessing.

12:50 jk_: fliebel: thanks, that looks like it.

12:52 fliebel: jk_: I don't think requiring that ns will load both files though.

12:53 jk_: fliebel: in the repl, i just pasted in the second file (the one using in-ns)

12:53 fliebel: kind of gross but it worked at least

12:54 fliebel: now i need to find the command to load in a file (probably "load"!) :)

12:54 fliebel: yea, load. Takes a filename without extansion

12:55 Raynes: jk_: There is also load-file.

12:56 But, depending on what you mean by "load in a file", you might be looking for require or use.

12:57 fliebel: Raynes: I think he needs load, because require is going to error out when he loads the second file without a ns of itself.

12:58 jk_: Raynes: sure, i'll look at that. basically i want the contents of the file read in and the contents to be available for evaluation

12:59 Raynes: jk_: Curious: why do you want to have a namespace over multiple files?

13:00 jk_: Raynes: well... mainly for when a file is getting overly big. i suppose the counterargument is to break it up in to sub-namespaces if there is a common theme

13:00 Raynes: is it considered idiomatic to have only one file in a namespace?

13:01 fliebel: jk_: Considering the amount of effort it takes to get it sreapd over 2 files I'd say yes.

13:01 Raynes: I do believe so. Except in extraordinary circumstances.

13:01 And a file getting too large isn't an extraordinary circumstance, because it can be easily mended by throwing related stuff into other related namespaces.

13:03 quizme: are function dependencies detectable within the clojure language ?

13:03 LauJensen: I think this is a solid way to generate a unique machine-ID, all who disagree say aye!

13:03 (def userid (->> (enumeration-seq (java.net.NetworkInterface/getNetworkInterfaces))

13:03 (map #(apply str (.getHardwareAddress %)))

13:03 (apply str)))

13:03 jk_: Raynes: yes, that's pretty much what i meant by breaking it up into sub-namespaces. some sort of refactoring :)

13:03 Raynes: fliebel: thanks for your input. not going to fuss with this cross-file namespace issue then

13:04 quizme: i guess you could write a parser to detect them

13:05 fliebel: *fumbles around in clojure internals* Huh, what is spread?

13:05 ,(#'clojure.core/spread [[1 2 3] [4 5 6]])

13:05 clojurebot: ([1 2 3] 4 5 6)

13:07 jk_: quizme: are you asking whether the reader would accept a form with an unbound symbol?

13:08 quizme: jk_ i was just thinking if there was some language-level support for understanding a code base as a graph

13:09 fliebel: quizme: You mean like making a graph which function calls which?

13:09 jk_: quizme: you mean for somehow viewing or traversing the dependency graph?

13:13 quizme: fliebel, jk_ yeah.

13:14 so that when loading a project during runtime, you could make the loading of disjoint chunks of the graph atomic.

13:15 so that you don't have run-time breakages due to function dependencies

13:15 then we could be like erlang

13:15 :)

13:15 jk_: quizme: i'm a lisp/clojure newbie but i think that's an interesting question - i'll just listen to others. you're trying to prevent the run-time evaluating something before it gets loaded in, right?

13:17 quizme: jk_ trying to load code in independent chunks automatically

13:18 jk_: quizme: well you can't load something into the reader that refers to symbols that are undefined, to the best of my knowledge. but that definition doesn't need to be bound to something useful :) , like (def x) (defn call-x [] (x))

13:19 quizme: forward references that are unbound will still cause breakage taht you're trying to avoid, if i understand you

13:22 quizme: anyway

13:22 it's just my add kicking in

13:22 good night

13:24 gcv: ,(let [v ^{:tag :key} ['surname]] (meta v))

13:24 clojurebot: {:tag :key}

13:24 gcv: ,(let [v ^:key 'surname] (meta v))

13:24 clojurebot: nil

13:24 gcv: Can someone explain why the metadata reader macro doesn't work for a bare symbol here?

13:26 ,(let [v ^:key ['surname]] (meta v))

13:26 clojurebot: {:tag :key}

13:27 gcv: Documentation says symbols support metadata, but the reader macro shorthand doesn't work with them.

13:29 ,(let [v (with-meta 'surname {:tag :key})] (meta v))

13:29 clojurebot: {:tag :key}

13:34 raek: ,(let [v ^:key (quote surname)] (meta v))

13:34 clojurebot: nil

13:35 raek: the metadata is added to the list containing quote surname, I think...

13:36 if you pass "^:key surname" to a macro, it should get the symbol with the correct metadata

13:36 so, in normal code, use with-meta

13:37 gcv: Good point, thanks.

13:37 raek: (let [l '(foo ^:key surname)] (meta (second l)))

13:37 ,(let [l '(foo ^:key surname)] (meta (second l)))

13:37 clojurebot: {:tag :key}

13:37 gcv: I ran into trouble doing this with a macro across namespaces.

13:43 yup, I get a compile-time exception when I try this across namespaces: java.lang.VerifyError: (class: cv-test-1/core/Family, method: <clinit> signature: ()V) Incompatible argument to function

13:43 raek: ,(let [v (quote ^:key surname)] (meta v))

13:43 clojurebot: {:tag :key}

13:44 raek: ah, you can put the metadata inside the quote too

13:44 hm, that smells incompatible versions of libraries...

13:45 are you sure you have, for example, matching versions clojure and conrtrib?

13:45 gcv: interesting point

13:46 raek: AOT libraries are not binary compatible between clojure versions

13:46 the differences might be small, so in some cases it works most of the time

13:47 gcv: I double-checked, this isn't the problem...

13:47 I'm working on a library of my own, and this problem comes up when when I test using it from another project. I thought maybe I didn't "lein install" it, but that wasn't it.

13:48 It's related to using defrecord somehow, though.

13:48 raek: try clearing the classes/ directory of all the involved projects

13:50 gcv: if you use leinginen, you might be interested in the "checkouts" feature

13:50 create a checkouts/ dir and put a symlink in there to the other project

13:51 hrm, do both of your projects use the same clojure versions?

13:51 gcv: raek: got it, that sounds awesome

13:52 raek: I'd better go dig some more and try to narrow down where the error happens; thanks for the hints.

14:03 raek: ,(let [v ' ^:key surname] (meta v))

14:03 clojurebot: {:tag :key}

14:03 raek: heh, that worked :-)

14:07 gcv: definitely cool

14:22 solussd_: ,(empty? nil)

14:22 clojurebot: true

14:23 solussd_: ,(next '(5))

14:23 clojurebot: nil

14:32 gcv: All right, I have a reproducible case for the weird metadata problem. http://gist.github.com/598174

14:32 raek: What do you think? Just a remarkably unhelpful error message or an actual Clojure bug?

14:35 raek: the mac1 call looks strange

14:35 the macro takes two arguments, but you give it one

14:35 oh

14:35 sorry

14:35 disregard that

14:36 ,(keyword (first (filter #(meta %) [' ^:key one 'two])))

14:36 clojurebot: :one

14:38 raek: gcv: I suggest that you post this one the clojure google group

14:38 adding the str call shouldn't change things, I think

14:38 so something strange is going on

14:38 from what I can tell

14:40 gcv: raek: thanks, I'll go post it right now

15:29 klang: does anybody know, for a fact, that :jar-behavior :symlink has been deprecated from leiningen? There is some indication that it should be possible to use symlinks in http://github.com/technomancy/leiningen/blob/master/src/leiningen/deps.clj, it's tweaked into place here: http://github.com/technomancy/leiningen/commit/0df6f8477d88a3d606c8b9d2f33f2ee55ff5fdd8 and then removed from the example one commit later here:

15:29 http://github.com/technomancy/leiningen/commit/b3a794c60473a1c03098bfb608e4a9d1ec6af89d, I am trying to decide how to go about implementing the :jar-behavior :symlink (or optimally :hardlink) functionality in either leiningen or cake (or both).

15:31 lypanov: any vim + clojure users around if so, which ext do you use for editing?

15:31 slimv looks need but i've heard some negative povs

15:31 neat*

15:35 klang: .. a shell script that proves, that it is possible to work with hardlinks in leiningen controlled projects is available here: http://gist.github.com/598251

15:35 LauJensen: lypanov: weren't you the clever guy using both arch and emacs way back when ?

15:36 lypanov: LauJensen: yes and both drove me completely nuts and i gave up on clojure. :)

15:36 now back with vim on osx.

15:36 LauJensen: ha

15:36 v-alex: lypanov: i'm using vimclojure. ext to edit what?

15:36 lypanov: v-alex: extension - as in, vimclojure, :) thx for answer

15:37 v-alex: lypanov: np

15:37 lypanov: started with that also. like the rainbow parens.

15:37 v-alex: lypanov: sweetest thing =)

15:38 lypanov: LauJensen: i guess that editor switch + lang switch + wm switch + os switch + vmware was a bit much. i don't blame any given thing. i do know that viper drove me crazy and i can't put my wrists through emacs again though.

15:40 LauJensen: amusingly something did come out of the whole thing though, found a tiling "wm" for osx which makes life less miserable

15:40 LauJensen: Well thats something for your trouble

15:41 klang: lypanov: you just need to move Ctrl to CapsLock and you will be golden :-)

15:41 lypanov: klang: been that way for a decade :)

15:42 klang: lypanov: I wish I had found out about that a decade ago .. 15 years using emacs does things to your hands ..

15:42 lypanov: klang: at 24 i couldn't type anymore. don't envy it :)

15:43 LauJensen: lypanov: I think you need to hit the gym

15:44 klang: lypanov: oh, I don't :)

15:44 lypanov: LauJensen: ?

15:44 klang: Exercise the fingers, right?

15:44 LauJensen: lypanov: I think the ratio between actual physical activity and typing must be pretty skewed, if typing can wreck your body so much that you cant type

15:45 andyfingerhut: Kinesis keyboards are not cheap, but they are cheaper than wrist surgery. They help me out when I'm doing heavy typing.

15:45 LauJensen: Its just a hunch though, I have no evidence

15:45 lypanov: LauJensen: back then i was a heavy swimmer.

15:45 now i don't do a damn thingy and am in no pain.

15:45 LauJensen: lypanov: by that you mean fat swimmer? like a floater? :)

15:45 lypanov: thing*

15:45 andyfingerhut: http://www.kinesis-ergo.com/

15:45 lypanov: just coding environment and genes.

15:46 * lypanov likes his mac keyboard, does the job for him

15:46 klang: LauJensen: I've taxed my fingers more climbing, than from using emacs, so you might be right.

15:46 lypanov: (alum ones, not the old pieces of !@#%)

15:47 andyfingerhut: And I've been using viper in emacs almost since I started using emacs. Like to keep fingers on home row.

15:48 lypanov: andyfingerhut: dvorak?

15:49 andyfingerhut: I was touch-typing for 10 years before I heard of dvorak, and didn't want to do that to myself.

15:49 lypanov: ah.

15:49 i had to. had to quit my work otherwise.

15:49 did the trick luckily.

15:50 LauJensen: lypanov: Did you have a look at Neo ?

15:50 andyfingerhut: I'm fine with a normal keyboard if I do light enough typing, but when I'm in it heavy, I pull out the Kinesis. Fully remappable, and by default space, enter/return, and control/command/alt keys are under your thumbs.

15:51 Takes a week or so to get used to, but I found it worthwhile.

15:52 technomancy: klang: in the next version of Leiningen we'll have the ability to skip lib/ entirely and just construct a classpath that uses ~/.m2

15:53 klang: but if you want to work on symlink support that's great too. it was contributed a while ago, but I don't think anyone uses it, and it didn't come with tests, so it's possible it doesn't work quite right in the latest version.

15:53 bmh: is there an assoc'ish equivalent to merge-with?

15:55 lypanov: LauJensen: neo?

15:55 LauJensen: lypanov: http://www.neo-layout.org/

15:56 lpetit: technomancy: thoughts on "enhancing" support for multi-project simultaneous work ?

15:57 klang: technomancy: It doesn't quite work in the latest version. Skipping /lib entirely, would be even better, as nothing at all would be copied around on the disk. Is there any indication of this work in the source yet?

15:58 Raynes: I wish I spoke German.

15:59 bmh: Raynes: Study it.

15:59 Raynes: bmh: I'd rather use Google Translate.

16:00 andyfingerhut: I wish brains had pluggable modules that let you learn things like German overnight. I'm not asking for much :)

16:00 bmh: andyfingerhut: I was just going to suggest that.

16:00 lypanov: german is teh easy.

16:00 klang: andyfingerhut: would you dare to be the first to try out a new module?

16:00 andyfingerhut: Whoever invents it either becomes a billionaire, dead, or sued out of existence.

16:01 bmh: We already have pluggable brain modules. We interact with them using keyboards, though.

16:01 andyfingerhut: They don't let you learn German overnight, though :)

16:02 lypanov: LauJensen: seems built for german?

16:02 bmh: andyfingerhut: Natürlich tun sie. Ich kann Deutsch sprechen jetzt!

16:02 LauJensen: lypanov: Im told by AWizzArd thats its suited for German, English and Programming

16:02 andyfingerhut: klang: Almost certainly no. I haven't even done lasik surgery. I'd think about it, though.

16:03 bmh: so to my earlier question: Is there a function in core that works like assoc with a combining function?

16:04 klang: andyfingerhut: laser surgery, for the eyes .. I have a big "no thank you" on that count as well

16:04 raek: there is a gap in the family of assoc - assoc-in, dissoc - dissoc-in (contrib) and (update) - update-in

16:04 LauJensen: klang: why?

16:04 raek: + get - get-in

16:04 arkh: if there's an if-let, why not if-not-let ?

16:05 raek: and when-first but not if-first?

16:05 fliebel: arkh: What would there be to let? false or nil?

16:05 lypanov: klang: my aunty got it done. i'm waiting 10 more years. if hers is still fine, may get mine done.

16:06 my wife hates me without glasses though. so yeah...

16:06 raek: I sometimes want something like if-let, but with the order of the branches swapped

16:06 to get the special cases first

16:06 arkh: fliebel: what raek said ; )

16:06 bmh: I wouldn't get lasik. 1) My vision isn't bad enough, 2) Beck Weathers's eyes went to hell at 8000m

16:07 LauJensen: bmh: ?

16:07 arkh: fliebel: point well made, though

16:07 klang: LauJensen: why to the "taxed fingers"? .. because hanging from your fingertips a suitable amount of distance from the ground, knowing that you have to yank yourself a bit further up to avoid a fall comes back a four o'clock in the morning in the form of a yelp and hurting fingers .. why to the :symlink question?, because I want to limit disk use.

16:07 LauJensen: klang: why no thanks to laser surgery ?

16:08 (sorry for not qualifying the first time)

16:09 klang: LauJensen: oh, that one. I sort of need my vision, and would rather live with glasses than without vision (i.e. I am a pussy)

16:10 lypanov: We don't hear about too many failed surgeries, to be fair, do we?

16:10 LauJensen: I've never heard of a singe eye laser surgery that didn't go well

16:11 lypanov: klang: nope. else there is no way they'd be allowed to do it.

16:11 arkh: I've never heard of a single eye surgery that resulted in disaster - my mom's eye surgery didn't go well but it just means she still needs to wear glasses

16:11 klang: ..well, that certainly does not make me less of a pussy for not wanting it done .. :-)

16:12 arkh: ... and you don't have the option to wear hard/gas-permeable contacts after the surgery

16:12 lypanov: as soon as i can convince my insurance company to pay, i'll go for it. until then, naah.

16:13 technomancy: klang: just a TODO entry (re: classpath that uses ~/.m2 only)

16:14 klang: technomancy: no wonder I couldn't find anything (I was looking for symlinks)

16:26 technomancy: klang: if you're interested in implementing it, I can provide details on the mailing list later

16:32 klang: technomancy: I think it makes more sense to implement classpaths based on ~/.m2 than the symlinking stuff, so yes.

16:37 technomancy: klang: briefly, it would be done by taking the same approach as leiningen.jar/script-classpath-for

16:37 take a look at that code and let me know if you need more details

16:38 klang: technomancy: will do, thanks!

16:51 LauJensen: technomancy: Actually the symlinks will likely be alot easier to work with in case you have to debug something

16:53 technomancy: LauJensen: yeah, this will be optional

16:54 some people even still use M-x swank-clojure-project, which would never work with it

16:56 jjido: what kind of "def" should I use to create a new Exception class?

16:56 technomancy: jjido: generally you don't need to

16:56 try c.c.condition instead

16:57 jjido: ,(doc condition)

16:57 clojurebot: No entiendo

16:58 technomancy: clojure.contrib.condition, that is

16:59 LauJensen: technomancy: So you're still keeping the door open for swank-clojure-project?

17:01 technomancy: as long as I don't have to support it

17:01 it's not the only thing that assumes a lib full of jars though

17:02 (support meaning maintain and answer questions about it)

17:03 jjido: what does AOT compilation mean?

17:03 LauJensen: jjido: Attack Of Toasters Compilation

17:03 Can get pretty dangerous

17:03 jjido: are there ducks?

17:03 LauJensen: No

17:03 jjido: In Clojure it means Ahead of Time :)

17:04 Gotta jet, good night all ya'll

17:05 jjido: I don't even know how to compile Clojure programs :/

17:05 bmh: I'm loathe to preface a question with a disclaimer that the question might be foolish, but: Where the heck are queues in clojure.core?

17:06 raek: PersistentQueue? undocumented.

17:06 ShereKahn: Guys, I am running in an issue with Emacs.app + slime (2010-07-22) + swank (20100404). Slime works well with SBCL, but with swank-clojure, whenever I enter an sexp, return does not evaluate it and block the repl. An atom works fine though. Rings any bell

17:06 raek: ,(into clojure.lang.PersistentQueue/EMPTY [1 2 3])

17:06 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@6b58d153>

17:07 technomancy: jjido: you don't need to

17:07 95% of the time

17:07 bmh: raek: Is there a reason why it's undocumented/I shouldn't use it?

17:07 jjido: technomancy: can I use contrib condition without it?

17:07 raek: it's fairly undocumented probably because it doesn't have its own syntax

17:07 technomancy: jjido: yeah

17:07 raek: but you should not hesitate to use it, I think

17:08 The Joy of Clojure mentions it...

17:10 technomancy: jjido: c.c.condition is already AOT'd for you; you don't need to do anything special to use it

17:10 bmh: raek: http://clojure-log.n01se.net/date/2008-07-23.html straight from the man's mouth himself (search on Persistent)

17:14 raek: whoa, chouser learning rather than teaching stuff regarding data structures... this must be ancient.

17:14 bmh: June 2008.

17:14 erm July

17:19 wooby: cool quote at the end of that page

17:19 AWizzArd: ~seen rhickey

17:19 clojurebot: rhickey was last seen quiting IRC, 1529 minutes ago

17:22 bmh: raek: Is there an efficient way to convert a PersistentQueue into a list?

17:22 technomancy: bmh: you can call seq on it, which is almost the same thing

17:23 bmh: technomancy: lovely!

17:26 hsuh: i'm a beginner... i ran lein deps inside my clone of "ring"

17:26 and then i got 7 artifacts are missing..

17:28 raek: for me it has happened that the artifact downloading thingy can't download obviously existing artifacts

17:28 at those times, deleting ~/.m2 solved the problem

17:28 hsuh: all of it ?

17:28 raek: yes

17:29 maybe moving it would be a better option

17:29 hsuh: its gone

17:29 :)

17:29 raek: I have no idea if this will work, but it has worked for me when it says that, for example, clojure-1.2 can't be downloaded

17:50 amalloy: any of the cake maintainers around?

17:51 hsuh: raek: that worked, so it was something with the state of .m2

17:51 AWizzArd: amalloy: I think this could be ninjudd

17:52 amalloy: whoa, a second ago he wasn't here

17:54 anyway ninjudd, how do you recommend managing swank on multiple projects? i could put them on different ports, but that's kinda a hassle; with lein i have a script that kills the existing swank process and starts a new one in the cwd. but that seems to lose me the benefits of cake's fast startup

17:55 (assuming that i'm willing to work on only one at a time, and it's just the act of switching from one to the other that's awkward)

18:57 wow, (new SomeStruct arg1 arg2) is a *lot* faster than (into empty-struct {:x arg1 :y arg2})

19:02 ninjudd: amalloy: I'd recommend separate ports with shortcuts in emacs to connect to each

19:21 amalloy: ninjudd: i don't quite get the cake metaphor yet. is it correct (or close enough to be useful) to say that each directory is associated with a different cake process/jvm, and commands like cake swank, cake stop, etc, will only operate on processes started from the cwd?

19:22 and if so, how do i shut down jvms if i don't remember where i was when i started them?

19:28 ilya_s: I'm having some issues with lein repl. Regular clojure repl works fine with (read-line), it collects a line of input, then reads it and continues. With lein repl this is not so, (read-line) goes to new line and never returns even after new line. There must be some mingling with *in* and possibly *out*, was wondering if anyone knew of the issue and if there is a way to fix/remedy it?

19:29 amalloy: ilya_s: hm, i have the same issue. but it works in cake repl and in swank

19:30 ilya_s: I haven't tried cake repl, but lein swank does the same thing, so I take it that lein generally mingles with *in*.

19:31 amalloy: really? i've never had trouble with lein swank

19:31 ataggart: anyone know the trick to call a ^:static function from the repl?

19:31 amalloy: otoh i guess i haven't tried read-line in swank :P

19:32 ilya_s: lein swank works great, until you want to collect stdin. Does (read-line) work for you in slime connected to lein swank?

19:32 amalloy: no, just tried it

19:33 ilya_s: :-)

19:33 amalloy: doesn't behave the same as what you describe though

19:33 it immediately returns nil

19:33 (cake swank doesn't work either; it immediately returns "")

19:34 ilya_s: yeah, mine hangs, actually let me try again

19:35 but either way, even regular lein repl doesn't work correctly. clojure repl works fine though

19:36 amalloy: heh. i don't even know how to open a repl without lein/cake

19:37 hm, i guess you're right. i wonder what the build tools are doing that makes this so hard for them

19:39 ilya_s: (.readLine (reader (System/in))) to go behind lein's back

19:39 ilya_s: well, I quickly looked at lein source the other day (for about a minute) and definitely saw *in* being rebound. I didn't have enough time to really check it out and before I got too deep, was wondering if anyone knew and/or maybe there is a reason for this and it can't be fixed.

19:39 amalloy: that is, using (reader) from clojure.java.io

19:42 alpheus: I'm inserting two apparently equal maps into a set. Obviously my idea of equivalence for maps is different than what set uses. What does set use to determine whether a set member already exists?

19:43 andyfingerhut: It should be Java equals, or Clojure =, but I'm not an expert on that point.

19:44 Have you tried comparing the two apparently equal maps with Clojure =?

19:44 ilya_s: amalloy, ah, cool, yeah, I can use that for now, at least during development when I need my repl. Thanks a bunch

19:44 amalloy: andyfingerhut: i think it's not actually either of those, but something that behaves a lot like clojure =

19:45 alpheus: I just realized I'm lying. The values are not maps.

19:45 amalloy: alpheus: the repl knows all! it sees through your transparent lies!

19:46 ,(conj #{} {:a 1} {:a 1})

19:46 clojurebot: #{{:a 1}}

19:46 alpheus: FWIW the "maps" are something created by defrecord, and I've been thinking of them as maps. So the comparison is probably based on object identity, or a pointer.

19:47 amalloy: alpheus: no, defrecords compare by value

19:47 alpheus: Then I'm really baffled.

19:47 amalloy: user=> (defrecord A [a]) (conj #{} (A. 1) (A. 1))

19:47 #{#:user.A{:a 1}}

19:47 andyfingerhut: Yeah, Clojure strives to use value equality on immutable values.

19:47 amalloy: so give us a gist to look at alpheus, and we'll try and see what's really going on

19:48 alpheus: I'll try to extract the relevant parts. What's a gist?

19:48 amalloy: or a pastie or whatever. http://gist.github.com/

19:49 bhenry: gist is superior in my opinion

19:49 amalloy: bhenry: agreed. but if he happens to be familiar with pastie or something, who am i to argue

19:50 bhenry: i hear ya. some of the layouts of those sites are so horrible. i just think gist combines all the best features of any one of them.

19:51 plus the git history stuff is excellent. i did see one awhile back that let you live test your javascript which i thought was pretty neat.

19:51 amalloy: personally i don't much care; i just like that gist (a) has clojure font-lock, and (b) knows who i am and keeps track of my gists

19:51 bhenry: indeed

19:52 amalloy: i'm not at all influenced by the emacs gist plugin...

20:04 ninjudd: amalloy: cake searches backward up the path for a project.clj. if it finds one, it starts the jvm in that dir. otherwise it uses ~/.cake

20:12 bhenry: amalloy: do i sense sarcasm?

20:12 amalloy: bhenry: maybe. but it might just be the emacs user's casual smugness

20:14 bhenry: haha. i've been learning emacs and clojure at the same time for the last few months, and i already don't want to ever go back to anything else.

20:14 amalloy: that's about my time scale too, except i had a little emacs experience from my experimentation with CL earlier this year

20:16 it's helped that i've also started working at a company that develops on ubuntu

20:18 bhenry: if you use emacs in terminal mode gist-buffer and gist-region are the only sane way to get from IDE to IRC, because copying is wonky from the terminal with split screens, and i always have split screens.

20:19 amalloy: i haven't tried erc yet; i bet that would make it fairly easy

20:19 bhenry: amalloy: yes. the fact that my very smart coworkers told me i should learn clojure really helps.

20:20 amalloy: heh. mine snort in disbelief when i mention clojure. bunch of bigoted rubyists

20:21 bhenry: amalloy: never thought of that. i actually used gmail in emacs for a day. maybe i should give chat in emacs another shot.

20:22 amalloy: yeah, i should try it out. pidgin is really a terrible irc client

20:28 bhenry: hello from emacs. it's not *great*, but it's usable and convenient

20:37 bhenry: i remember chatting to my friends in gtalk. i think i didn't like it, because it was hard to know if things were failing silently (i.e. my friends didn't get all the messages which i thought went out)

20:38 amalloy ^^

20:42 alpheus: Regarding the duplicate set members problem earlier: http://upholsters.us/set-dupes.txt

20:43 amalloy: alpheus: that's a set containint one item, which is a list containing two rows

20:43 sorry, that's a lie

20:45 alpheus: it has to be something wrong with row-of (which you didn't upload). if i run it with Record. in place of row-of, it works just like you'd want

20:47 on second thought, maybe i should think about the problem before offering two bogus suggestions

20:47 alpheus: http://upholsters.us/row-of.clj

20:48 Sorry, I don't have a web browser available, so I can't use one of the nice colorizing paste things.

20:50 bhenry: qa.setup> (= (Row. "brands" "id" 1) (Row. "brands" "id" 1))

20:50 false

20:50 qa.setup> alpheus ^ the problem goes beyond it being in a set. two calls to Row. create different things.

20:53 amalloy: bhenry: i don't think that's the issue: http://gist.github.com/598451

20:53 alpheus: Sure. That's why I originally asked about set's equivalence model. I assumed it was based on identity, but amalloy says it's by value. And the two values look alike (from my naive viewpoint).

20:54 amalloy: alpheus: maybe they have different metadata from the SQL select?

20:54 bhenry: something like that. i don't know for sure, but even in your gist you're making two calls to row. so (= f r) would return false, meaning the set would allow both of them.

20:55 amalloy: but it doesn't

20:55 bhenry: (= r f) is false, but (.euqls r f) is true

20:55 s/euqls/equals

20:55 bhenry: ah.

20:56 amalloy: alpheus: try (map meta (list row1 row2))

20:57 alpheus: (nil nil)

20:57 amalloy: so much for that idea. (.equals row1 row2)?

20:58 alpheus: false

20:59 amalloy: and if you try it with two Rows constructed just via (Row.) it will be true. so something we don't understand about (fetch) is causing them to not be equal

21:01 since you're using rs's values directly via %, i'm guessing that the Row class your SQL library is using doesn't implement .equals intuitively

21:01 alpheus: i bet it works if you change % to (into {} %)

21:05 alpheus: Using set to remove duplicates is a band-aid anyway. The duplicates are a side effect of a sub-optimal graph traversal. It just seemed good enough for the time being.

21:06 amalloy: but now you've got me curioue! does my fix work?

21:07 alpheus: no

21:08 amalloy: wild. well, go fix your algorithm instead then :)

21:08 alpheus: Yes, I will. Thanks for your help.

21:13 Replacing the defrecord form with this works: (defn make-row "Replacement for defrecord Row "[table values scrubs] (hash-map :table table :values values :scrubs scrubs))

21:13 By works, I mean, two calls to row-of result in values that compare equal

21:13 amalloy: baffling

21:14 you don't have to call hash-map, by the way; the body of your fn can just be {:table table...}

21:15 alpheus: I'm afraid that a map in that position will be taken as a condition-map

21:15 unless that's impossible without any keys named :pre or :post

21:16 amalloy: (defn) is smart enough to figure out how many forms you've passed

21:16 alpheus: ah, ok

21:30 gfrlog: does anybody know why c.c.shell[-out] is deprecated?

21:32 amalloy: alpheus: by the way, "that position" isn't just pre- and post-conditions; arbitrary metadata for the function goes there

21:37 alpheus: amalloy: I didn't know that. Thanks.

21:38 amalloy: you're ahead of me, though; i haven't tried to get the hang of pre- and post-conditions. how useful have you found them to be?

21:38 alpheus: Another typical day of clojure. My program has more features and fewer lines of code.

21:38 amalloy: haha

21:38 alpheus: I just found out about pre/post conditions a couple of days ago. I've replaced all my comments about them with actual condition-maps.

21:39 Since I've had Eiffel-envy for years, they seem pretty cool.

21:48 bhenry: amalloy: do you use ring with wrap params?

21:48 amalloy: bhenry: i haven't done any web development yet

21:49 my pet project is all back-end and AI, so i'm not worried about ring for the moment. but maybe alpheus can help?

21:49 bhenry: anyone watching right now who has done development with ring and ring middleware?

21:56 brianstamand: What's the best way to make a compojure/jetty http daemon?

22:07 TheBusby: So what is necessary to enable UTF-8 (Unicode support) when using $lein swank and slime-connect?

22:11 hsuh: there is a very interesting post on the mailing list titled "State of web development"

22:50 brianstamand: thanks hsuh that thread is very helpful

23:12 bhenry: dang

23:48 scottj: brianstamand: not sure, might look for term coding-system, such as slime-net-coding-system

23:48 opps, TheBusby ^

Logging service provided by n01se.net