#clojure log - Feb 28 2010

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

0:17 brian_: tes

0:27 _ato: technomancy|away: Clojars had run out of memory, not sure whether that was causing the hanging or was the because of it (too many connections building up). I've restarted it and put in a cron to monitor it in case it happens again.

0:30 maxhodak: is it possible to get a string of a symbol?

0:30 DeusExPikachu: ,(doc name)

0:30 clojurebot: "([x]); Returns the name String of a symbol or keyword."

0:30 maxhodak: lol

0:30 facepaml

0:30 facepalm

0:32 _ato: also note:

0:32 ,(name 'foo/bar)

0:32 clojurebot: "bar"

0:32 _ato: ,(namespace 'foo/bar)

0:32 clojurebot: "foo"

0:33 maxhodak: what about going the other way? returning the symbol named in a string?

0:33 DeusExPikachu: ,(doc symbol)

0:33 clojurebot: "([name] [ns name]); Returns a Symbol with the given namespace and name."

0:34 maxhodak: awesome

0:34 thanks

0:34 DeusExPikachu: np

0:40 Luyt: ,(1)

0:40 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

0:40 Luyt: ,('1)

0:40 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

0:40 Luyt: ,(int 1)

0:40 clojurebot: 1

0:40 Luyt: That's my boy.

0:46 brian_: seeking help with a library classpath issue

0:52 rickmode: Just starting with Clojure. What's the current best practice for getting clojure going with Aquamacs? I'm looking at various tutorials and they all do things a bit different (perhaps some or too old?)

0:57 technomancy: rickmode: check the docs for swank-clojure

0:57 aquamacs is not officially supported, but it should work.

0:57 _ato: thanks

0:58 _ato: have you thought about sharing the maintenance of clojars so someone else can reset it if there are problems in the middle of the Aussie-time night?

0:59 rickmode: technomancy: so we dont' start with clojure-mode?

1:01 technomancy: rickmode: installing swank-clojure will pull in clojure-mode as a dependency

1:01 though you can use clojure-mode standalone if you like

1:09 zaphar_ps: any ideas what might strip the meta away from a namespace after it's compiled into a jar?

1:10 danlarkin: zaphar_ps: it's a bug in clojure

1:10 technomancy: clojurebot: #130

1:10 clojurebot: Titim gan éirí ort.

1:10 technomancy: clojurebot: ticket #130

1:10 clojurebot: {:url http://tinyurl.com/ndkovn, :summary "Namespace metadata lost in AOT compile", :status :new, :priority :normal, :created-on "2009-06-19T04:47:33Z"}

1:11 zaphar_ps: ahhh ok so I'm not going crazy then

1:12 bummer that makes what I was planning to do a little difficult

1:16 brian_: hi,im new to clojure. I have a clojure library I'm trying to invoke in a file :

1:18 using (:require [com.twinql.clojure.http :as http]), but when I call file in repl user=> (load-file "http01.clj") I get java.lang.ClassNotFoundException: com.twinql.clojure.http (http01.clj:1)

1:21 however , the library is in my classpath: user=> (System/getProperty "java.class.path")

1:21 user=> (System/getProperty "java.class.path")

1:21 however, I know the library is in my classpath user=> (System/getProperty "java.class.path") ... compojure/clj-apache-http-standalone.jar:"

1:22 hiredman: and com.twinql.clojure.http is in clj-apache-http-standalone.jar?

1:24 brian_: well... root# jar vtf clj-apache-http-standalone.jar -> ...17123 Sat Feb 27 20:30:34 MST 2010 com/twinql/clojure/http.clj

1:24 hiredman: oh

1:25 brian_: are you using the ns macro?

1:25 brian_: oh

1:26 hiredman: if you are using load-file, you shouldn't be

1:26 brian_: hmm

1:26 hiredman: but :require is for the ns macro

1:26 you want require

1:26 brian_: wait a sec

1:26 hiredman: and you'll need to quote the arguments

1:27 brian_: thats probably iy

1:27 it

1:28 this is all i have in the file (:require [com.twinql.clojure.http :as http])

1:28 hiredman: :require is just a keyword

1:29 brian_: (ns (:require [com.twinql.clojure.http :as http])) ?

1:29 hiredman: no

1:29 I told you

1:29 brian_: ok

1:30 hiredman: if you are using load-file like that you shouldn't use the ns macro

1:30 just use require

1:30 (require '[com.twinql.clojure.http :as http])

1:30 brian_: require not :require?

1:30 hiredman: right

1:30 brian_: oh

1:30 hiredman: :require is just a keyword

1:31 brian_: yea

1:31 hiredman: it doesn't do anything

1:31 brian_: thanks

1:31 why no ns in load-file out of curiosity

1:32 hiredman: if you use the ns macro your file needs be in the correct place relative to the classpath and should be loaded using require or use, not load-file

1:33 brian_: oh, thanks much, that clarifies things

1:41 rickmode: technomancy: still no joy. getting errors during ELPA install: swank-clojure.el:48:1:Error: Cannot open load file: clojure-mode

1:48 technomancy: nevermind... the error were innocuous - slime comes up with the Clojure REPL. Thanks!

3:32 LauJensen: Morning

4:05 Leafw: any means to specify the return type of a function, as a form of type checking?

4:10 vy: Leafw: AFAIK, no.

4:10 Leafw: hum, not even in the meta? I am surprised

4:11 vy: Leafw: From java_interop doc.: All arguments are passed to Clojure fns as objects, so there's no point to putting non-array primitive type hints on fn args.

4:11 Leafw: Hrm... It might work for non-primitive data types, IMHO.

4:11 Leafw: that is what I thought

4:12 plus clojure's reader/compiler has been improving its type inference capabilities. It complains a lot more than before, for example when trying to call a method to an object that doesn't support it.

4:13 but a search for 'clojure function fn "return type"' in google didn't return anything beyond datatype and gen-class

5:33 LauJensen: Does anyone have a good description of what exactly -server does, compared to -client?

5:47 TheBusby: Lot's of info here, http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

5:56 LauJensen: Thanks

6:58 I'm wondering a little about how -Xmx works. If you set it too low, you risk that you program starts swapping which blows performance, but why this initial performance degradation, why not just a heap-explosion ?

7:01 TheBusby: if you google around, I think Rich made a few comments about why it's not always good to set everything high

7:01 I guess if the JVM doesn't have an appropriate ceiling it doesn't work very efficiently in some cases

7:04 LauJensen: I'm just not following the logic - is the Xmx the amount of memory that it hogs at boot, so that if you exceed it, it will start swapping or looting system memory until finally consuming all the systems memory and then the heap blows, or what ?

7:05 Chousuke: My guess would be the gc

7:06 It would make sense if, as you approch the limit, the GC goes wild trying to free memory for you :P

7:06 LauJensen: So your guess is that the GC is blowing the heap ?

7:08 Chousuke: no, I'm guessing it's causing the performance degradation

7:08 But I really don't know, so any guess is as good as mine :P

7:10 LauJensen: oh...

7:10 Wouldn't be too hard to find out, but yes it does make sense

7:13 Chousuke: Are you on Twitter?

7:13 Chousuke: no

7:13 the-kenny: Which version from contrib should I use with [org.clojure/clojure "1.1.0"]?

7:14 s/from/of/

7:14 Chousuke: there's a 1.1.0 release of contrib

7:14 the-kenny: Chousuke: huh? The only 1.1.0-stuff I'm seeing is 1.1.0-master-SNAPSHOT

7:15 Chousuke: hm

7:15 the-kenny: (In http://build.clojure.org/snapshots/org/clojure/clojure-contrib/)

7:15 Chousuke: http://build.clojure.org/releases/org/clojure/clojure-contrib/

7:15 the-kenny: huh

7:16 Didn't knew there is a releases-directory

7:16 Chousuke: I just found tht out a few days ago too :P

7:17 dm3: anyone using vimclojure here?

7:19 Leafw: dm3: meikel, the creator, hangs around here often

7:19 dm3: I see, thanks

7:20 LauJensen: dm3: under the name "kotarak"

8:05 rrc7cz-hm: why doesn't (read) like strings with forward slashes? I'm getting an invalid token on "bar/baz" within a string like "foo bar/baz"

8:16 vy: rrc7cz-hm: (let [rdr (java.io.PushbackReader. (java.io.StringReader. "bar/baz"))] (println (read rdr)) (println (read rdr))) works without a problem, do I miss something?

8:19 rrc7cz-hm: vy: I was trying to deserialize a large data structure (vec<map>). I manually wrapped it in a def and changed it to a .clj, used load-file, and found a missing "

8:20 something screwed up the serialization

8:20 vy: is print-dup still the correct way to serialize clj data structures?

8:24 vy: rrc7cz-hm: API docs say that "By default, pr and prn print in a way that objects

8:24 can be read by the reader"

8:37 rrc7cz-hm: vy: aha.. when I was writing (println ["one" "two" "three"]) it outputs the (un-deserializable) [one two three], but (prn) gives ["one" "two" "three"]

8:58 miltondsilva: (take 2 (for [vector (vec (repeat 9 nil))] [vector])) why isn't the result two vectors with 9 elements each?

9:04 Chousuke: miltondsilva: the name vector gets bound to each item in the vec of nils

9:05 miltondsilva: is there some way of getting it bound to the vecs instead of the items?

9:05 Chousuke: that's not what for is for :P

9:06 you could just do (let [v (vec (repeat 9 nil))] [v v])

9:07 miltondsilva: ok I see, I was trying to make something that didn't make much sense :S

9:14 vy: Any clojure-ant-tasks user in the house?

9:34 djpowell: just having a play with leiningen, as a maven-skeptic

9:35 bit worried about people shipping aot compiled libraries unless absolutely necessary

9:36 seems like it is more of a packaging choice for the app, and it causes lots of breakage if you try to use them with a different version of clojure

9:37 leiningen does look fun tho

9:38 esj: leiningen is fabulous

9:39 djpowell: i guess some code needs aot compilation for interop, but i wonder if there could be some sort of half-way point, where the interop stuff could be compiled (eg gen-class, deftype, etc), but not all of internal stuff that is likely to have binary compatability problems with different versions of clojure

9:41 yeah leiningen does look good. i'd never consider using maven really for java stuff, and ant feels like writing build scripts in an imaginary world where doing in in a procedural xml language would be a good idea. but i plan to use leiningen on clojure projects

9:42 defn: to me it's just that XML is noisy lisp

9:42 so of course leiningen makes sense

9:43 there's really no thinking involved -- that's just the way it is

9:45 leiningen is really just a lisp-like way of speaking to maven

9:46 kotarak: djpowell: This is perfectly possible: http://paste.pocoo.org/show/183865/ <- short example. Just name.classes must be compiled. name.space and name.room can be "normal" clojure files.

9:47 * kotarak throws clojuresque and gradle into the ring.

9:47 djpowell: maven scares me tho. maybe because i am very conservative with dependencies, and don't use commons-*.*, so i don't really have problems with dependencies that require something as complex as maven. i like lein as a build system tho

9:47 Raynes: kotarak: Do you remember how you told me to run kickoff.sh the other day?

9:48 kotarak: Raynes: I'm about fixing it.

9:48 djpowell: (I do use the odd commons jar, but yeah, i'm a bit conservative with stuff)

9:48 kotarak: Raynes: It works for me, btw.

9:48 Raynes: Well, I don't know if it broke. It put gradle in cache.

9:48 I was just wondering what I was supposed to do after that point. :p

9:49 djpowell: kotarak: yeah that might be a good aproach

9:50 kotarak: Raynes: export GRADLE_HOME pointing to the directory, where you put it. Then use "$GRADLE_HOME/bin/gradle build" in the vimclojure directory.

9:51 vy: Can anybody help with this Apache Ant problem please: http://privatepaste.com/226857830b

9:53 kotarak: vy: a) (ns com.acme.projects.nails (:gen-class) (:load "nails/main")), b) (in-ns 'com.acme.projects.nails) in main.clj. There you go.

9:54 Raynes: kotarak: Alrighty, that worked. What else? >.>

9:55 vy: kotarak: Thanks so much! Worked like a charm! But why using in-ns instead of ns?

9:55 kotarak: Raynes: ".../gradle install" to install the vimclojure jar in your local repo and ".../gradle installVim" to install the vimfiles.

9:56 vy: because ns is only for setting up the namespace. In sub-files being (load)'ed, one uses in-ns to tell clojure to which namespace they belong.

9:56 Raynes: you can then depend in your projects on the vimclojure jar and will be automatically added to your classpath (if you use gradle or maven, that is).

9:57 Raynes: Leiningen would work as well, right?

9:58 kotarak: Raynes: dunno. If it looks in the local .m2 maven repo, it should. Yes.

9:58 Raynes: It does.

9:58 Yay. Syntax highlighting works without breakage. You must have fixed whatever problem I was having before.

9:58 kotarak: Raynes: then there souldn't be a problem.

9:59 Raynes: I'll play with this more later.

9:59 Thanks.

9:59 kotarak: You are welcome.

9:59 defn: Anyone know how to log into an SSL site with clojure and scrape it with enlive?

10:00 I've been looking for an answer for weeks after spending way too long trying to figure out a good solution, but I couldn't find one due to my java ignorance

10:01 someone suggested apache-http-client

10:01 but i simply do not get how the hell im supposed to negotiate SSL based on the examples

10:01 (for the clojure lib)

10:22 djpowell: if I wanted to have a project-local leiningen repository for some reason, I was hoping I could do something like: :repositories {"project" "repo"} , but it looks like you can't just use a relative path there, you need a full file:// url. Are there any substitution variables or anything that you can use?

11:59 msch: hi, any idea where i can find this paper: http://portal.acm.org/citation.cfm?id=1408682

12:03 patrkris: msch: don't think you can find a paper - i think it refers to a talk given by Rich Hickey

12:06 msch: patrkris: ok, too bad. but thanks nevertheless!

12:59 arkrost: Hi! I have some questions about memory model in clojure. Whom can I ask?

12:59 anars: arkrost: just ask

13:00 if you're referring to the STM in clojure, check http://clojure.org/refs

13:01 if not, then you're probably looking for info on the JVM memory model :)

13:01 arkrost: Ok. For example I have seq. What happens when I apply functions such as conj or rest..Will it create a new seq?

13:01 hiredman: yes and no

13:02 you know linked lists?

13:02 seqs are like that

13:02 bosie: hiredman: are they doubly linked lists?

13:03 hiredman: bosie: nope

13:03 and they aren't "linked lists" either

13:03 but they have the same interface

13:03 bosie: ok

13:04 arkrost: So if i have a seq containing n elements, when I will apply conj function, I'll get another seq containing n+1 element. So I will save 2*n + 1 element?

13:05 Or I will save n+1 element ?

13:05 hiredman: what do you mean save?

13:05 esj: no, you'll have 1 element until you realise the seq

13:05 conj is lazy too

13:06 hiredman: esj: nope

13:06 esj: hiredman: rats ! I thought I had one :)

13:06 bosie: esj: had what?

13:06 esj: an correct answer

13:07 hiredman: conj'ing onto a lazy-seq should keep the rest of the seq lazy, but the operation is not lazy

13:07 ,(class (conj (seq [1]) 2))

13:07 clojurebot: clojure.lang.Cons

13:07 bosie: how does the garbage collector work on lazy seqs?

13:08 hiredman: same as on any other object

13:08 bosie: if i map a lazy seq and apply a side effect free function on it, does it keep both sequences in the memory?

13:08 hiredman: map is lazy

13:08 bosie: ye

13:08 so i realize map

13:09 hiredman: the datastructures are all immutable

13:09 bosie: what datastructure?

13:09 hiredman: all of the clojure ones

13:09 bosie: i have a function returning a lazy sequence i use in map

13:09 hiredman: seqs, vectors, maps, sets, etc

13:09 bosie: why would clojure keep that list in memory?

13:09 the entire list i mean, at the same time, in memory

13:10 hiredman: if you hang on to the head of a seq, and realize the whole seq, you have a reference to the whole seq, so it cannot be gc'ed

13:10 arkrost: will elements containing in seq be copying after applying conj function?

13:10 bosie: but i guess it doesn't anyway? would make the lazy sequence kinda useless

13:10 hiredman: damn

13:10 hiredman: arkrost: why would they be copied?

13:11 bosie: just don't hang on to the head

13:11 bosie: hiredman: how would you not?

13:11 hiredman: bosie: by not hanging on to the head

13:11 esj: bosie: In clojure you must differentiate between the concrete types and the seqs. Concrete types like vectors and sets keep everything in memory, and seq's can be thought of (initially) as clever iterators, they do not make any copies.

13:12 hiredman: esj: yeah they do

13:12 bosie: esj: wrong again i guess ;)

13:12 esj: dammit !

13:12 hiredman: they have to

13:12 bosie: hiredman: but if a function returns the a lazy list and i use it as a parameter to map

13:13 hiredman: every pass of a lazy seq function over a lazy seq creates a new layer of lazy seqs

13:13 bosie: hiredman: wouldn't that mean i hang on to the head for as long as map iterates?

13:13 hiredman: map does not hang on to the head

13:13 esj: hiredman: ok, they make a copy in the persistent datastructure sense, right ?

13:13 so its just the trie

13:13 hiredman: a seq is not a trie

13:14 bosie: hiredman: so if the first lazy seq has N elements, i only ever have I+1 elements (I being the current index of map) in memory and not I + N ?

13:14 hiredman: it's, uh, like a linked list

13:15 bosie: I can't make guarantees about when the gc will run

13:15 and thus I can't tell you what is sitting around in memory

13:15 bosie: hiredman: if the gc would be executed after each operation, it would be I + 1

13:16 hiredman: bosie: what do you mean by the current index of map?

13:16 kotarak: hiredman: when does a seq create a copy?

13:16 bosie: hiredman: the current iteration

13:17 hiredman: kotarak: copy is maybe the wrong word, but a chain of maps, say, builds up layers of lazy-sqs

13:17 kotarak: hiredman: yeah that's true

13:18 ... which can eventually create a stackoverflow.

13:18 If the chain is to long.

13:18 hiredman: bosie: depends how you are "iterating" through a map

13:18 bosie: hiredman: excuse me?

13:18 hiredman: isn't map fixed?

13:18 hiredman: oh no i am talking about the function map

13:18 hiredman: bosie: what do you mean "fixed"?

13:20 bosie: hiredman: thanks, will have to read up on it, somewhere ;)

13:21 hiredman: if you realize the lazy seq produced by map in such a way as to keep a reference to the head, as much of the map as you realize will be in memory and live

13:22 kotarak: (let [s (map foo coll)] (doall s)) <- no good

13:22 substitute doall with something useful

13:23 hiredman: if you use doseq or reduce and don't have a reference to the head, only one node in the seq at a time will be live

13:23 kotarak: (reduce bar (map foo coll)) <- good

13:26 esj: bollocks - chasing the source for seq takes one directly to java, do not pass begin, do not collect 200.

13:27 hiredman: ,(->> clojure.lang.ISeq .getMethods (map #(.getName %)))

13:27 clojurebot: ("more" "next" "cons" "first" "equiv" "count" "cons" "empty" "seq")

13:29 esj: so its a linked list, is it just of pointers elements in the conceret coll, which are lazily filled in (if its over a concerete coll ?), or the values themselves ?

13:30 i'm guessing values so that when its generated by lazy-seq they are just filled in

13:30 hiredman: what?

13:30 clojurebot: What is meta

13:30 esj: thanks cb.

13:30 the seq is a linked list.

13:30 what are the elements on the linked list ?

13:31 hiredman: like a linked list

13:31 esj: right, like a linked list.

13:31 hiredman: instead of the next pointer pointing to the rest of the linked list, it is a function which generates the rest of the list

13:31 esj: ok, i get that

13:43 bosie: hiredman: i have another question. so i have (map .... lazy-seq)

13:43 hiredman: if i realize map, i realize both lazy seqs at the same time?

13:45 hiredman: how could you not?

13:45 bosie: hiredman: what?

13:45 hiredman: if A depends on B and B doesn't exist yet, in order to get A you have to generate B

13:46 bosie: exactly

13:46 hiredman: then why ask?

13:47 bosie: dont understand the advantage of lazy seqs

13:48 hiredman: you can do operations over large datasets without having it all in memory

13:48 bosie: right

13:48 kotarak: bosie: with (filter bar? (map foo coll)) you traverse coll once, otherwise you have traverse it twice.

13:49 bosie: hiredman: so if i have a seq and want to split it up into N seperate parts so i can concurrently run operations on the seperate parts, how would one do that?

13:49 hiredman: i can't even read the length of the seq

13:50 kotarak: true

13:51 hiredman: bosie: depends on this that and the other

13:52 bosie: hiredman: funny

13:52 hiredman: it's not meant to be

13:53 kotarak: bosie: there is a talk of someone where he shows that linked lists (in particular seqs) are not well suited for such operations. tree (eg. Clojure vectors) are a better fit.

13:53 hiredman: it does depend on what you want realized where

13:53 kotarak: bosie: but don't ask me who "he" is or what the talk was called.

13:53 hiredman: guy steele

13:54 kotarak: hiredman: ah, yes! exactly

13:54 hiredman: I would remember the name, I think he shows a lot of potential and is going places...

13:55 bosie: hiredman: he went to harvard and mit ....

13:55 kotarak: http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf

13:56 chouser: hiredman: ha!

13:56 hiredman: bosie: because of the lazy nature of seqs, the partitioning and map can be done on a single thread, and then the results realized on other threads

13:56 chouser: :D

13:56 bosie: I think maybe where he went to school is the least interesting thing

13:57 bosie: hiredman: if you get a PHD from MIT one can assume he 'shows potential'

13:57 djpowell: i googled guy steel without the e at work the other day, and the sites that i got back definitely weren't about lisp

13:57 with some other term too, i forget what

13:57 kotarak: bosie: well, you have to pay and they have to keep the customers happy...

13:57 chouser: I actually saw him at ILC2009, but couldn't think of a thing to say...

13:57 bosie: kotarak: appreciated

13:58 hiredman: "will you sign my parens!"

13:59 kotarak: man! I'm really jealous. Why can't some cool clojure conf be here in Frankfurt?

13:59 bosie: here is a noob question. if i want to store the result of a function (which returns a sequence) for later, i store it in a Var, and realize it first?

14:00 hiredman: I have no idea what I'd say to guy steele either

14:00 bosie: what do you mean "for later"?

14:01 chouser: bosie: a var or local, but you don't necessarily need to realize it first.

14:01 bosie: hiredman: if i have to use it later on

14:01 hiredman: later during the execution of the program

14:02 hiredman: bosie: why do you have it before you need it?

14:02 bsteuber: bosie: Did you already watch the videos on clojure.blip.tv? I really learned a lot from them concerning data structures etc.

14:03 Raynes: kotarak: Does vimclojure look in the lib/ directory for the vimclojure jar?

14:03 It doesn't seem to be finding it.

14:04 kotarak: Raynes: vimclojure doesn't look anywhere. If you use lein, set up a lein task which starts the nailgun server. I think there was some plugin for that.

14:04 bosie: bsteuber: unfortunately i did

14:04 hiredman: i have it when i need it. but i need it more than once

14:05 Raynes: kotarak: Well, I actually did that already. I had the server running, but it's still saying it can't execute nail because it can't find the class that starts the server.

14:05 I assumed it was trying to start the server itself.

14:05 kotarak: Raynes: then you are classpath is wrong. How did you include vimclojure.jar in your classpath?

14:06 Raynes: -cp lib/*

14:06 kotarak: Is the class he claims not to find in the jar?

14:06 hiredman: bosie: if you keep a reference to a lazy seq, any parts you realize are not going to be gc'ed until the reference goes away

14:06 Raynes: Indeed.

14:07 bosie: hiredman: ok

14:08 Raynes: "Reason: Vim(echoer

14:08 r):Couldn't execute Nail! Exception in thread "main" java.lang.NoClassDefFoundEr

14:08 ror: com/martiansoftware/nailgun/NGServer"

14:08 Oops, didn't realize that was three lines.

14:09 kotarak: Raynes: did you quote the *? java -cp 'lib/*' ....?

14:09 Raynes: Let me check.

14:10 StartsWithK: kotarak, have you considered constructing a full installer for vimclojure?

14:11 if not, do you mind if i take a stab at such a thing?

14:11 Raynes: Yep.

14:11 bosie: for what are you guys using clojure?

14:12 Raynes: kotarak: I think I just have bad luck with Vim.

14:12 It's obviously not VimClojure's fault.

14:13 kotarak: StartsWithK: if have. It's a huge amount of work and headache for questionable use. I'm working on a multistep install: a zip with the vim stuff, which can simply extracted to .vim as usual, and a jar on clojars for the server part. Only the ng client makes me some headaches. If you want, to invest time on a installer, I'm happy to accept your efforts! I will not work on an installer however.

14:13 bosie: or to be more precise: anyone implemented a genetic algorithm in clojure? :)

14:14 StartsWithK: kotarak, i was thinking izpack based, not from scratch, ng looks like the bigest problem on unix, but izpack can exec stuff in its pre/post install hooks

14:14 kotarak: Raynes: I dunno. I have a working setup since about one and a half year. No problem with the classpath ever. Maybe I'm just lucky.

14:14 StartsWithK: only thing i would leave out is messing with a vimrc

14:14 thats just asking for it

14:15 kotarak: StartsWithK: never mess with config files. Especially not vims. ;)

14:15 StartsWithK: so ng would still need a manual configuration to work

14:15 kotarak: StartsWithK: well, just put in the PATH.

14:15 Then the standard should work.

14:20 StartsWithK: kotarak, what is the main problem with ng client? the fact that is native?

14:20 kotarak: StartsWithK: Bingo

14:20 StartsWithK: hmm

14:20 and..

14:20 what if you could replace it with a shell script

14:20 somethinkg netcat/socat based

14:21 hiredman: it would be complex

14:21 kotarak: StartsWithK: I thought about nc. How does this work on Windows?

14:21 StartsWithK: on unix, win has its .exe i see

14:21 clojurebot: The bird, bird, bird, the bird is the word.

14:21 StartsWithK: izpack can have selective downloads for different platforms

14:22 * kotarak googles izpack

14:23 StartsWithK: http://izpack.org/

14:29 djpowell: rhickey: i was wondering about binary compatability between aot compiled libs and later versions of clojure - eg 1.1 compiled libs on 1.2. is that mixing libs and clojure versions something to always avoid?

14:29 kotarak: StartsWithK: izpack looks interesting. I think the client is the only problem.

14:30 StartsWithK: kotarak, i would then try to recreate client with netcat or socat and make a simple installer by the end of the week

14:30 kotarak: StartsWithK: wow, looking forward to it :)

14:49 rickmode: I'm beating my head against Aquamacs / clojure-mode / slime. I want my IDE to use my language. I dont' want my IDE to own and manage my language. So is there a no-voodoo way to get a REPL working in Aquamacs?

14:50 ordnungswidrig: rickmode: I start swank using "lein swank" and connect from within emacs using "M-x slime-connect" without problems.

14:50 somnium: rickmode: define voodoo

14:50 ordnungswidrig: rickmode: using clojure-mode from elpa

14:51 hiredman: it's kind of depressing to see steele pushing for stack allocated objects for java in 1998

14:53 rickmode: Swank-clojure wants to download it's own copies of clojure and clojure-contrib. That's too much voodoo. It also wont' work should I have two projects using different versions of clojure (ties the dev environment to the particular versions too tightly).

14:54 fanatico: rickmode: have you looked at leiningen? lein-swank will start a server using the clojure version specified in the project.clj file.

14:54 somnium: rickmode: clojure-mode comes with a swank-clojure-project function that uses only the libs in your project

14:54 rickmode: Maybe that's not a real concern. Anyway - I'd just like something straightforward to get started. Is the *right* solution to use the Aquamacs 2 preview (based on Emacs 23)?

14:54 somnium: + lein-swank ^^

14:55 fanatico: any reason to use aquamacs? the vanilla release is better tested.

14:57 rickmode: fanatica: Aquamacs is a good Emacs for mortals. I've spent the past 19 years coding on IDEs (TurboPascal to Visual C++ to Visual Studio to IntelliJ IDEA to Eclipse to Xcode). Emacs is wildly different. Aquamacs is an excellent bridge. I can use my muscle memory to get around while learning Emacs.

14:58 fanatics: so it's an anti-frustration thing

14:58 fanatico: fair enough. pretty sure swank requires 23, so you'll need to use the preview.

14:59 hiredman: rickmode: I don't know much about aquamacs, but I do know #emacs things it is too different from actually emacs to be on topic for #emacs

14:59 well, I don't know much emacs in generally

15:00 so if you are trying to do emacs things in aquamacs it may be frustrating

15:00 I don't use OSX but for OSX I see carbonemacs recommended

15:02 rickmode: hiredman: I'm not married to Emacs. Just looking for a solid dev environment.

15:03 hiredman: emacs is decent, the main thing is paredit

15:05 it's just aquamacs is kind of off the beaten path, so if you are looking for something to keep down the frustration, I don't know that that is it

15:05 of course I am sure there are people around somewhere that are happily using aquamacs

15:06 fanatico: rhickey :P

15:06 but he doesn't use slime.

15:07 hiredman: when you are writing java, slime doesn't really work

15:08 fanatico: the curse of the language designer is the amount of time spent working outside their language.

15:09 * rickmode is doing lein self-install

15:09 grzm: rickmode: I feel your frustration. I don't spend enough time in slime/clojure to have figured out the nitty-gritty, but I have finally gotten swank-clojure-project to work in Aquamacs (2.0preview4b)

15:09 I went the ELPA route

15:09 rickmode: grzm: I was wondering if that was the route.

15:09 grzm: s/figured out/fully understand/

15:10 rickmode: the clojure.org page points to an older clojure-mode. It should perhaps be updated or at least note that this information is old.

15:10 grzm: rickmode: I think so. I followed technomancy's guide, iirc

15:14 rickmode: I'm not griping here. I just spent a few weeks in CL library hell (Aquamacs + SLIME + SBCL was easy - anything else was busted, underdocumented, and/or undersupported). I want to build web apps with Lisp. I initially didn't want to look at Clojure because i'm super anti-java (used it since 2000). So after watching the first video on clojure.blip.tv I was sold. Lisp + more core types + good concurrency. I'm in.

15:16 opqdonut: rickmode: i've done a web app in cl

15:16 used hunchentoot and cl-who mostly

15:16 raek: rickmode: seen this? http://www.bestinclass.dk/index.php/2009/12/dynamic-interactive-webdevelopment/

15:16 opqdonut: it was even cross-platform, worked on both sbcl and cmucl

15:17 rickmode: opqdonut: those bits are sollid... getting into a persistence and anything higher level (UCW / Weblocks) was a mess.

15:17 opqdonut: i feel you

15:17 we did everything ourselves for a reason :)

15:18 or actually two reasons, one of which was stubbornnes

15:19 rickmode: opqdonut: Clojure also feels less crufty. There's a bit of design-by-committee plus i actually felt like I had stepped back to 1990 with some of the path weirdness and other minor inconsistencies.

15:19 member:opqdonut: Edit: Clojure also feels less crufty. In *CL* there's a bit of design-by-committee plus i actually felt like I had stepped back to 1990 with some of the path weirdness and other minor inconsistencies.

15:20 opqdonut: yeah

15:20 clojure is nice

15:20 rickmode: raek: checking out the video. thanks

15:20 opqdonut: unfortunately we use it for stuff that is nearly realtime, so we ended up making our own compiler

15:20 (not for clojure, for a small dsl)

15:22 raek: if you want to do web apps in clojure, I really recommend looking at compojure

15:22 rickmode: opqdonut: seems like for something truly hard-core using C (or simplified C++) plus an embedded Scheme might be best. Never dont' a project that way though. I'm just thinking it would avoid Greenspun's 10th rule.

15:22 raek: that video is a great intro

15:23 opqdonut: it's pretty nice this way actually, we have a high-level description of the system with a domain specific language

15:23 facilitated by macros, of course

15:23 which then gets turned into something that runs fast

15:24 the point here is that the dsl and produces only a couple of primitives, so the compiler can be kept pretty small

15:24 hiredman: sort of the inverse of greenspun

15:24 opqdonut: yeah :)

15:24 rickmode: opqdonut: so you used Clojure to create a DSL?

15:25 opqdonut: basically

15:25 hiredman: mmmm

15:26 (Forget spreadsheets: trying to do cash flow projections based on the royalty schedule in this contract really demands an expert system. These contracts would be easier to understand if they were written in Lisp or ML ...)

15:26 hah

15:26 http://www.antipope.org/charlie/blog-static/2010/02/cmap-3-how-books-are-sold.html

15:27 rickmode: OK so got lein install.. not sure of next step - I'm googling away but not seeing how to get the other bits going.

15:27 djpowell: hmm in leiningen, something, somewhere is pulling an ant-1.6.2 into my project and breaking 'leiningen test'

15:54 drocko: can someone point me in the right direction on clojure, google app engine, and setting up the appropriate classpaths, etc? I am having issues getting my environment set up?

15:55 i guess the second half of that is not a question

15:56 hiredman: there is a skeleton lein appengine project on github

15:58 I have a ant build.xml for generating an appengine project, but I haven't touched it in many months, so it is sort of bit rotted

15:58 http://github.com/otfrom/blank-appengine-clj

15:59 http://github.com/hiredman/appengine-helper I definitely recomend the lein one

15:59 oi

16:00 even the readme has errors on mine

16:03 technomancy: man... people suck at reading docs.

16:04 reading about 2 pages into the swank-clojure readme would have answered rickmode's concerns about swank downloading its own copy of clojure.

16:05 hiredman: :|

16:05 technomancy: not saying swank doesn't have its issues, but the stuff he was running into is well-explained.

16:05 kotarak: technomancy: where does this myth come from, that someone reads docs? You have to deliver everything on a silver tablet nowadays :|

16:06 drocko: hiredman: ah i did see your lein appengine project

16:06 technomancy: kotarak: yup... time to /join #silver-platter and hang out there I guess.

16:06 clojurebot: swank?

16:06 clojurebot: Pardon?

16:06 kotarak: comparing scars and exchanging war stories?

16:07 technomancy: clojurebot: swank is try the readme. seriously.

16:07 clojurebot: Alles klar

16:07 kotarak: clojurebot: vimclojure

16:07 clojurebot: vimclojure is state-of-the-art

16:07 technomancy: kotarak: trying to outsource my job. =)

16:07 danlei: btw, is there something new about slime cvs compatibility?

16:08 technomancy: danlei: someone's submitted a patch that should bring it up to date, but it's fairly invasive... haven't gotten a chance to integrate it yet.

16:09 danlei: technomancy: no problem, just wanted to know if there is some progress

16:09 i just froze the last working config

16:09 s/last/latest

16:10 technomancy: danlei: I'm reluctant to open that can of worms just because I _know_ the current versions work.

16:10 I barely have enough time to keep up with that; don't feel like pulling in more variables.

16:11 patrkris: kotarak: hey - do you plan on pushing official vimclojure builds to clojars.org at some point?

16:11 technomancy: but this contributor was pretty gung-ho about helping out

16:11 kotarak: patrkris: yup

16:11 danlei: technomancy: I fear the day I finally update. Using your repo, is it possible to keep things in "one's own hands"? (no automatic downloading and stuff)

16:11 patrkris: kotarak: coolio

16:11 technomancy: danlei: sure

16:11 danlei: technomancy: very good

16:12 technomancy: danlei: it only downloads jars if you haven't configured it to use your own stuff

16:12 kotarak: patrkris: I'll try to setup also a SNAPSHOTS repo, since everyone wants to cut their fingers...

16:12 danlei: technomancy: perfect.

16:12 patrkris: kotarak: yeah, that's great :)

16:43 raek: is the Math/.... functions defined for all clojures number types?

16:45 hiredman: Math is java

16:45 it's all doubles

16:45 http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html

16:46 they are not functions, they are static methods

16:48 raek: ,(Math/floor 10000000000000000000000000000/3)

16:48 clojurebot: 3.333333333333333E27

16:48 grzm: erg. trying to escape double-quotes and backslashes in a string:

16:48 (require '(clojure.contrib [string :as string]))

16:49 raek: is this a resonable approach for getting the fraction part without losing precision?: (defn frac [x] (- x (int x)))

16:49 grzm: (println (string/replace-by #"[\"\\]" #(str "\\\\" %) "the \""))

16:49 the \"

16:49 (println (string/replace-by #"[\"\\]" #(str "\\\\" %) "the \" and \\"))

16:49 String index out of range: 3

16:50 raek: hmm, before I do too much... is there a round-half-to-even in java that can be directly used with any clojure number?

16:51 drocko: hiredman: do you think you could give me like a quick overview of how to get started with lein-gae? or maybe a link to some docs on it? I'm a bit new to all of this stuff i suppose

16:52 i have it installed, but i suppose i need to create a new project.clj someplace to get going with it?

16:52 hiredman: drocko: oh, my lein-gae? it's a project half started, I would not recommend it, I think there maybe a fork or two better a long

16:52 drocko: ah yeah?

16:52 rats

16:52 hiredman: yeah

16:52 drocko: ok

16:52 hiredman: :/

16:52 drocko: could you maybe help me with my gae strategy then?

16:52 hah

16:52 grzm: raek: looks like there might be: googling "java rounding to even" shows some stuff

16:53 drocko: like i have some code written and i want to test it, but i can't seem to get the dev server started with all the right services so i can test things like logging in and out

16:53 hiredman: I haven't done that much with the dev server

16:54 drocko: i think that the code from the hackerswithattitude post about interactive GAE development has the code that resolves my issues there, but i can't get that to work because of all the classes that it requires

16:54 jcromartie: somnium: Does congomongo support sorting and paging?

16:54 drocko: and i cant seem to use swank-project because i'm using a different directory structure

16:54 hiredman: so how do you develop with it? perhaps i'm just approaching this wrong

16:54 hiredman: drocko: figuring out the jars the sdk stuff needs is a pain

16:54 drocko: hiredman: yes i agree

16:54 hah

16:55 raek: grzm: yes, but they seem to be only for BigDecimal and such

16:55 drocko: hiredman: so how do you do it? are you using lein or ant? how do you structure your code?

16:55 hiredman: I did it with my appengine-helper

16:55 which uses ant

16:55 grzm: raek: casting won't work?

16:56 hiredman: but I didn't ever setup a repl for it

16:56 the build.xml for appengine-helper has a runserver target

16:57 drocko: hiredman: ahh i see. are you using the users service here?

16:57 raek: grzm: I guess I can always do that, but was thinking about something more general

16:58 hiredman: no

16:58 I am kind of surprised that it would need to be switched on though

16:58 drocko: hmm ok

16:58 yeah i may be misunderstanding it

16:59 hiredman: I think it must be split into two parts

16:59 drocko: but it's like if you want it to work in your test environment you have to start up like a proxy that catches that information

16:59 hiredman: the client side and the server side

16:59 the client side must be some jar you need in with the other libs

16:59 compojure.jar clojure.jar etc

17:00 drocko: yeah

17:00 keith-: ok so i'm missing clojure-contrib.jar and i cannot seem to find where it should come from.

17:00 hiredman: should it come from anywhere?

17:01 keith-: is there a reason that it does not exist? a few things seem to want to use it

17:01 Licenser: evening

17:02 hiredman: ah, well, if you have something that wants it, that drives where you would get it

17:02 but expecting it to exist in a vacuum is nonsense

17:02 so what requires contrib and what version does it require?

17:02 keith-: for some reason i like you.

17:03 well both vimclojure and swank-clojure want it. i'm not partial to either editor but i would like syntax highlighting in one

17:03 hiredman: http://www.thelastcitadel.com/images/social-skills.png

17:03 how did you install swank-clojure?

17:04 keith-: git

17:04 hiredman: did you follow the instructions from the swank-clojure readme?

17:04 hmm

17:04 if you install from epla you should get contrib with it

17:05 kotarak: keith-: you can have syntax highlighting in vimclojure without contrib

17:05 hiredman: you shouldn't need contrib for syntax highlighting in either vimclojure or emacs

17:05 in emacs for syntax highlighting you just need clojure-mode

17:05 keith-: that is the only thing i can't find and i can't seem to get them to work properly. thanks for the tip and i will investigate further

17:05 hiredman: for vim you can disable the dynamic stuff from vimclojure

17:05 keith-: and yes but i want slime to work fully

17:05 kotarak: kotarak: in vimclojure set "let clj_want_gorilla = 0" in your .vimrc

17:06 hiredman: the swank-clojure readme has good update instructions that should be followed, and all others ignored

17:06 grzm: raek: looks like clojure.contrib.math includes a round mulitmethod: perhaps you could extend that in your app to take a rounding method argument?

17:06 keith-: alright. i will try to figure out what's happening. thanks for the tips

17:12 jcromartie: somnium: did you find that the ClojureDBObject really helped performance?

17:57 rads: is clj-record the only ORM for clojure? it doesn't look like it's maintained anymore

18:00 somnium: jcromartie: yes, but it could be refactored into a set of static methods that operate on any collection. purcell tried to rewrite it in clojure, but said he could only get 6x slower. he thought it was related to the jit, I have no idea.

18:01 jcromartie: hmm

18:01 I would think multimethods would be perfect for that

18:01 to-mongo

18:01 to-clojure

18:01 but if it's really slow, then it's really slow

18:01 somnium: jcromartie: yeah, but multimethods are slow. double dispatch and all

18:01 jcromartie: yeah

18:01 somnium: jcromartie: protocols fit like a glove

18:01 jcromartie: ah, yes

18:02 we'll see I guess

18:02 how about sorting?

18:02 somnium: jcromartie: Im just waiting for a stable 1.2, already have a prototype

18:02 jcromartie: I have been playing with the mongo driver

18:02 somnium: jcromartie: its in the java driver, .sort on the cursor

18:02 jcromartie: it sems like a great API

18:02 somnium: jcromartie: the mongo driver?

18:02 jcromartie: yeah

18:03 it is pretty straightforward

18:04 somnium: yeah, just wish it didnt force DBObjects to be mutable hash-maps

18:05 the-kenny: Github now supports org-mode files as readmes :) </offtopic>

18:05 somnium: ooh

18:08 jcromartie: even if multimethods are slow, they make it easy to extend the lib

18:08 I just wonder: did anybody really hit performance problems?

18:09 I mean, the fact that a Ruby driver exists pretty much guarantees that a pure-clojure wrapper around the Java driver wouldn't be the slowest thing ever.

18:09 somnium: jcromartie: the ruby-driver is more-or-less unusable without the C-extension

18:09 jcromartie: heh

18:10 hiredman: stuartsierra posted a macro for doing double dispatch with protocols

18:18 somnium: jcromartie: the protocol version I had was roughly as fast as the current one. afaict the only reason its slower than java at all is because theres no direct way to override object creation in bytes, so everything gets traversed twice :/

18:18 jcromartie: yeah

18:18 hmm

18:18 wait, so what's the slow part?

18:19 coercing the cursor results from mongo objects -> clojure maps?

18:19 somnium: jcromartie: double walking, turning strings into keywords and array-lists into persistent vectors

18:19 jcromartie: was it a bottleneck?

18:20 somnium: yeah, the first pass I used keywordize-keys from clojure.walk

18:21 that was 20x + slower for very simple objects

18:23 jcromartie: interesting

18:24 I'm only looking to pull out a few objects at time

18:24 I wonder if it would be a problem for me

18:24 i.e. it would always be paged results

18:24 clojurebot: amespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

18:25 somnium: jcromartie: right now its plenty fast enough for the intranet kind of things I use it for

18:32 jcromartie: somnium: it might not be wise, but what about a memoized multimethod

18:32 for converting back and forth

18:33 somnium: jcromartie: you mean hashing every DBObject? O_o

18:36 jcromartie: not quite

18:36 not sure what the idea was, really :P

18:58 rads: hmm, trying to use congomongo, but when I do a fetch I get com.mongodb.MongoException$Network: can't call something (NO_SOURCE_FILE:0)

19:11 somnium: rads: that usually means you havent done $ mongod

19:27 tcrayford: is there anybody about who knows their way around clojure/core.clj

19:27 ?

20:06 mee: What's a good way of returning the items in a collection in random order?

20:07 danlei: clojure.contrib.seq/rand-elt

20:08 oh, sorry, that's a random element

20:08 mee: I guess I can call java.util.List.shuffle

20:09 danlei: there is permutations in clojure.contrib.combinatorics

20:11 mee: hmm, that returns /all/ permutations, which is a bit overkill

20:12 danlei: (rand-elt (permutations s))

20:12 mee: thanks

20:12 jcromartie: wow nailgun is seriously awesome

20:15 {newbie}: jcromartie: is it possible to use nailgun with javac?

20:15 jcromartie: I don't think so

20:16 I think you need to reload nailgun when your classes/jars are updated, if that's what you're asking.

20:16 {newbie}: No I was asking

20:16 to keep javac loaded

20:17 jcromartie: not unless javac is powered by a class that has a main()

20:17 but I don't think that's the case

20:17 (not positive)

20:17 {newbie}: :\

20:17 I saw another project

20:17 jolt

20:17 it works with javac

20:17 it's very nice for people who use make

20:24 danlei: mee: here is a more explicit solution: http://paste.lisp.org/display/95763

20:28 mee: ah, nice

20:29 thanks again

20:29 danlei: mee: np, as an exercise: (shuffle [1 1])

20:29 mee: I forgot about loop/recur

20:30 I kept avoiding 'building' the shuffle deck, thinking that I was restricted by the immutability of objects.. oops

20:34 I also just discovered clojure.contrib.seq/shuffle

20:34 danlei: oh, overlooked that, too

20:36 mee: but I was more interested in the how-to-fish part anyway

20:37 danlei: :)

20:38 jcromartie: I'm not really sure how to make clojure work with nailgun... aside from getting clojure.main to work, I don't see how I can have a reasonable classpath

20:39 i.e. one like lib/*:src:test:.

20:50 I guess it's not really useful for assorted projects, and is more of a sysadmin thing, where you have a fairly fixed set of classes that you might want to have ready.

22:40 atrerus: has clojure.contrib.str-utils moved to a different namespace in the current version?

22:41 current being 1.1...

22:46 zaphar_ps: atrerus: a lot of stuff looks like it moved in 1.1

22:46 it definitely doesn't seem to be a backwards compatible release

22:46 but to be fair a few things in there were marked as being unstable

22:47 atrerus: k... trying to get Stuart Holloway's book examples to run... I might have to go back to 1.0

22:54 danlei: atrerus: str-utils moved to clojure.contrib.string recently

22:54 atrerus: yeah, saw the git notes for that

22:54 cool, glad I'm understanding :)

22:55 I switched lein back to using clojure 1.0 and the book examples are going more smoothly now

23:00 brandonw: has anyone had trouble with using org.clojars.ato/nailgun "0.7.1" instead of lein-nailgun "0.1.0"?

23:01 if i use lein-nailgun it works fine. on `lein deps` ato's nailgun has two warnings about the the POM not being a good 4.0.0 POM. after that, nailgun doesn't show up as a task in `lein help`

23:09 also, i'm using lein for my first project that will actually need build management; i have a top level dir, and inside that classes,lib,src,test dirs. src and test both have a subdir of foo

23:10 and src/foo/core.clj has (ns foo.core)

23:10 yet if i run lein compile, it says `All :namespaces already compiled.` - but nothing is in the classes directory

23:11 and the repl generated by lein nailgun fails when i load src/foo/core.clj

23:11 it seems like i have some namespace issue somewhere, but i haven't a clue where. everything to do with namespaces was autogenerated from `lein new foo`

23:18 icey: does anyone know of anybody working on an event-based clojure framework similar to node.js or possibly twisted?

23:23 chouser: Java anonymous classes have no access to their outer lexical scope, right? What about Groovy classes?

23:23 dnolen: icey: no, but that would be cool.

23:24 hiredman: chouser: what?

23:24 icey: dnolen: yeah, i was just browsing some node.js stuff and all i could think of is that that style of development would be *amazing* in clojure

23:26 chouser: I mean in Java I can define an anonymous inner class entirely inside a method that has its own local variables and parameters, but the code inside my anon class can't access any of those, right?

23:27 dnolen: chouser: I think you can if the variables it's trying to access are declared "static final"

23:27 hiredman: chouser: it can, they just need to be final

23:27 chouser: oh! hm.

23:28 ok, thanks.

23:32 dnolen: icey: it could potentially cooler (perhaps via macros). I like the idea of Node.js but I'm not sold on the idea of writing a bunch of code with callbacks. I like Clojure's implementation of promise/deliver better.

23:34 icey: dnolen: i'm a huge fan of event driven program flows for the web; for whatever bizarre reason it fits my brain better - I feel like it's easier to take a vision of what the page should do and work backwards to the solution.

23:47 wooby: is there anything like CL's parenscript for clojure?

Logging service provided by n01se.net