#clojure log - Apr 11 2009

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

0:00 hiredman: ,(uncurry +)

0:00 clojurebot: #<sandbox$uncurry__1858$uc__1860 sandbox$uncurry__1858$uc__1860@127d5a0>

0:00 hiredman: ,(((uncurry +) 2) 3)

0:00 clojurebot: #<sandbox$uncurry__1858$uc__1860 sandbox$uncurry__1858$uc__1860@fae256>

0:00 Raynes: Man, why do people like Groovy. How could anyone like something with such a horrible name. :|

0:01 hiredman: ,((((uncurry +) 2) 3))

0:01 clojurebot: 5

0:01 Cark: hum i see

0:01 ,(((((uncurry +) 2) 3) 4))

0:01 clojurebot: 9

0:02 Cark: ,(-> (uncurry +) (apply 3) apply)

0:02 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer

0:02 Cark: ,(-> (uncurry +) (apply [3]) (apply []))

0:02 clojurebot: 3

0:02 hiredman: ,(doc call)

0:02 clojurebot: "([x & y]); (apply x y)"

0:03 Cark: ,(-> (uncurry +) (call 3) (call))

0:03 clojurebot: 3

0:03 Cark: ,(-> (uncurry +) (call 3) call)

0:03 clojurebot: 3

0:03 Cark: all right so what's a real world use of uncurry ?

0:05 man your pl macro is some hairy stuff

0:05 hiredman: ,(((((uncurry (flip map)) (range 3)) (range 3)) +))

0:05 clojurebot: (0 2 4)

0:10 Cark: nice library

0:10 hiredman: :)

0:11 it was fun

0:31 nzkoz: I feel like I'm missing something, but why does (rest []) return a not-a-vector (list?)

0:32 hiredman: most of the sequence handling functions call seq first

0:32 nzkoz: meant that my fancy ref to a vector turned into something else where conj put things on the front and my app stopped behaving. I'm clearly doing something wrong headed

0:33 hiredman: filter, map, etc

0:33 durka42: don't use rest anymore, use next

0:33 might do the same thing

0:33 ,(next [])

0:33 clojurebot: nil

0:33 durka42: ,(next [1])

0:33 clojurebot: nil

0:33 durka42: ,(next [1 2])

0:33 clojurebot: (2)

0:33 hiredman: ,(next [])

0:33 clojurebot: nil

0:33 hiredman: ,(rest [])

0:33 clojurebot: ()

0:34 nzkoz: cheers

0:35 hiredman: maybe contrib should have a vector map, filter, etc

0:35 * nzkoz is just tooling around

0:36 hiredman: ,(assoc [] 10 :a)

0:36 clojurebot: java.lang.IndexOutOfBoundsException

0:37 hiredman: ,(assoc [] 0 :a)

0:37 clojurebot: [:a]

0:37 hiredman: ,(assoc [:b] 1 :b)

0:37 clojurebot: [:b :b]

0:37 hiredman: ,(assoc [:a] 1 :b)

0:37 clojurebot: [:a :b]

0:37 hiredman: interesting

0:37 nzkoz: yeah, I basically just want to atomically pop and push from *something*

0:37 my java / ruby brain wants an array / queue with locks

0:38 durka42: use transactions instead

0:38 hiredman: or you can use your java brain and use a blocking queue

0:38 nzkoz: durka42: right, that's what I'm trying to do 'right'

0:39 http://gist.github.com/93459

0:39 I have that so far

0:39 works, but feels questionable

0:40 hiredman: blocking queues are threadsafe, so no locks anyway

0:40 durka42: ,(conj [1 2 3] 4)

0:40 clojurebot: [1 2 3 4]

0:40 durka42: ,(pop [1 2 3 4])

0:40 clojurebot: [1 2 3]

0:40 hiredman: well, BlockingQueue

0:41 durka42: ,(peek [1 2 3 4])

0:41 clojurebot: 4

0:41 nzkoz: so pop + peek should work too

0:41 durka42: just be careful they act different with different collection types

0:41 like conj

0:42 nzkoz: yeah, a little confusing I have to say

0:42 hiredman: do you really need indexed access?

0:43 nzkoz: not at all, just want to do add-foo and get-foo

0:44 with fifo

0:44 hiredman: you might use subvec instead of rest

0:44 ,(doc subvec)

0:44 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

0:47 nzkoz: raises for start > size, so would need a special case to handle empty

0:47 but that feels a little more natural

0:49 dakrone_hb: 7/clear

0:49 bah

0:50 ,(show-doc "xml")

0:50 clojurebot: [ 0] clojure.core/xml-seq [ 1] clojure.zip/xml-zip [ 2] clojure.xml/parse [ 3] hiredman.clojurebot.svn/summary

0:51 dakrone_hb: ,(show-doc "xml" 0)

0:51 clojurebot: ------------------------- clojure.core/xml-seq ([root]) A tree seq on the xml elements as per xml/parse

0:51 dakrone_hb: ,(show-doc "xml" 1)

0:51 clojurebot: ------------------------- clojure.zip/xml-zip ([root]) Returns a zipper for xml elements (as from xml/parse), given a root element

0:56 durka42: (doc show-doc)

0:56 clojurebot: excusez-moi

0:57 durka42: ,(doc show-doc)

0:57 clojurebot: "([re-string-or-pattern] [re-string-or-pattern index]); Based on find-doc and clojure.contrib.repl-utils/show. With one argument, prints a list of all vars whose documentation or name contains a match for re-string-or-pattern. Each var is listed with a number of it's index which can be used to print the documentation for that var."

1:08 dakrone_hb: I have been reading, and I still can't find where it's mentioned what the '^' in front of a hash-map does

1:08 ,^{:a 1}

1:08 clojurebot: nil

1:08 dakrone_hb: ,{:a 1}

1:08 clojurebot: {:a 1}

1:09 dakrone_hb: can someone explain what the ^ is used for?

1:09 hiredman: it is a reader macro

1:09 ,^{:a 1} 'a

1:09 clojurebot: nil

1:09 hiredman: ,#^{:a 1} 'a

1:09 clojurebot: a

1:10 hiredman: ,(meta #^{:a 1} 'a)

1:10 clojurebot: nil

1:10 hiredman: bah

1:10 dakrone_hb: err...

1:10 for reading metadata?

1:10 hiredman: for attaching metadata

1:11 oh

1:11 yeah

1:11 dakrone_hb: so is it for reading or attaching metadata?

1:11 or both?

1:11 hiredman: ^ is for reading

1:11 #^ is for attaching

1:12 ,^#^{:a 1} 'a)

1:12 clojurebot: nil

1:12 hiredman: ,(let [#^{:a 1} a 3] ^a)

1:12 clojurebot: nil

1:12 hiredman: ,^(with-meta 'a {:a 1})

1:12 clojurebot: {:a 1}

1:13 durka42: (doc with-meta)

1:13 clojurebot: Returns an object of the same type and value as obj, with map m as its metadata.; arglists ([obj m])

1:14 dakrone_hb: so you're associating metadata {:a 1} with the 'a' object, then reading it all out

1:14 ?

1:14 hiredman: yeah

1:14 dakrone_hb: does ^ read all the metadata, or just specific fields?

1:14 hiredman: all

1:14 the metadata is a single map

1:15 dakrone_hb: okay, so you could do (:a ^(with-meta 'b {:a 1}))

1:15 ,(:a ^(with-meta 'b {:a 1}))

1:15 clojurebot: 1

1:15 hiredman: I would use ^

1:15 dakrone_hb: neat

1:15 hiredman: er

1:15 wouldn't

1:15 dakrone_hb: oh, okay

1:15 hiredman: but I guess it is personal choice

1:15 I use (meta )

1:15 ,(macroexpand '^a)

1:15 clojurebot: (clojure.core/meta a)

1:15 hiredman: :P

1:16 dakrone_hb: okay, but it definitely helps for reading other people's code

1:16 ,(macroexpand '#^a)

1:16 clojurebot: Unmatched delimiter: )

1:16 hiredman: and I use vary-meta more then with-meta

1:16 ,(meta (vary-meta 'a assoc :a 1))

1:16 clojurebot: {:a 1}

1:16 dakrone_hb: is there a good reference for "shortcut operators" for Clojure anywhere?

1:17 since the clojure site won't let me search for '^', and it's not very google-friendly

1:17 hiredman: maybe the reader page on the website

1:17 durka42: "reader macro" is the googlable term you're looking for

1:17 dakrone_hb: there we go, there's the list

1:18 hiredman, thanks for the explaination, very helpful

2:41 msingh: why does having clojure written in clojure make it easier to port?

2:43 hiredman: it makes the part that needs to be ported smaller

2:44 if the data structures are written in clojure, then they don't need to be written for a non-java platform

2:44 msingh: oh i see

2:44 hiredman: etc

2:44 msingh: cool thanks that makes seense

2:44 lepassive: anyone using enclojure netbeans plugin with NetBeans 6.7 M3 ?

2:47 msingh: hiredman: so it there a well understood core of clojure that would need to be implemented in the native environment to host the rest of the portable clojure code?

2:48 hiredman: it depends

2:49 the self hosting aspect can be pushed pretty far

6:34 something: good morning.

6:35 I'm having trouble adding clojure-contrib to my .emacs. I did the following (setq swank-clojure-extra-classpaths (list "my-path-to-contrib-jar"))

6:36 am I missing something?

6:38 :w

11:32 digash: swank-clojure only read that variable once on the slime startup

11:34 try (setq slime-lisp-implementations (delete-if '(lambda (i) (eq (car i) 'clojure)) slime-lisp-implementations)

11:34 (add-to-list 'slime-lisp-implementations `(clojure ,(swank-clojure-cmd) :init swank-clojure-init) t)

11:34 or just restart emacs

16:42 blbrown_win: " kjsldjfsd ; kljsfksljdf" what is the split character in clojure to seperate based on a particular character

16:44 ,(.split "abc ; 123")

16:44 clojurebot: java.lang.IllegalArgumentException: No matching field found: split for class java.lang.String

16:44 durka42: ,(.split "abc ; 123" ";")

16:44 clojurebot: #<String[] [Ljava.lang.String;@12c61fe>

16:44 durka42: ,(dorun (map prn (.split "abc ; 123" ";")))

16:45 clojurebot: "abc " " 123"

16:45 blbrown_win: (map trim (.split "abc ; 123" ";"))

16:45 ,(map trim (.split "abc ; 123" ";"))

16:45 clojurebot: java.lang.Exception: Unable to resolve symbol: trim in this context

16:45 blbrown_win: ,(map .trim (.split "abc ; 123" ";"))

16:45 clojurebot: java.lang.Exception: Unable to resolve symbol: .trim in this context

16:46 durka42: (.trim " abc")

16:46 ,(.trim " abc")

16:46 clojurebot: "abc"

16:46 blbrown_win: ,(map (fn [a] (.trim a) (.split "abc ; 123" ";"))

16:46 clojurebot: EOF while reading

16:46 durka42: ,(map #(.trim %) (.split "abc ; 1 2 3" ";"))

16:46 clojurebot: ("abc" "1 2 3")

16:46 blbrown_win: ,(map (fn [a] (.trim a)) (.split "abc ; 123" ";"))

16:46 clojurebot: ("abc" "123")

16:46 blbrown_win: what is the '%' in your last example

16:47 durka42: my example is exactly equivalent to what you wrote right after it

16:47 % is the parameter in anonymous functions

16:47 ,(macroexpand #(.trim %))

16:47 clojurebot: #<sandbox$eval__2693$fn__2695 sandbox$eval__2693$fn__2695@ac087b>

16:47 durka42: er

16:47 ,(macroexpand '#(.trim %))

16:47 clojurebot: (fn* [p1__2699] (.trim p1__2699))

16:47 durka42: ,(macroexpand '#(+ %1 %2))

16:47 clojurebot: (fn* [p1__2703 p2__2704] (+ p1__2703 p2__2704))

16:47 blbrown_win: ah

16:48 nice

16:49 ,(map #(.trim %) (.split "abc ; 1 2 3 ;" ";"))

16:49 clojurebot: ("abc" "1 2 3")

16:49 dreish: For that matter, ,'#(+ %1 %2)

16:49 ,'#(+ %1 %2)

16:49 clojurebot: (fn* [p1__2715 p2__2716] (+ p1__2715 p2__2716))

16:49 blbrown_win: ,(map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";"))

16:49 clojurebot: ("abc" "1 2 3" "")

16:49 dreish: #() is expanded by the reader; it isn't a macro per se.

16:49 blbrown_win: ,(remove nil? (map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";")))

16:49 clojurebot: ("abc" "1 2 3" "")

16:49 blbrown_win: ,(remove empty? (map #(.trim %) (.split "abc ; 1 2 3 ; ;" ";")))

16:49 clojurebot: ("abc" "1 2 3")

16:49 blbrown_win: nice little one liner

16:50 ,(remove empty? (map #(.trim %) (.split "" ";")))

16:50 clojurebot: ()

16:50 blbrown_win: ,(remove empty? (map #(.trim %) (.split ";;;;;;" ";")))

16:50 clojurebot: ()

16:50 blbrown_win: I am unit testing with the bot

16:58 d2dchat: Do clj files have to be compiled before you can read them from other clj files?

16:58 I'm trying to namespace one of my libraries

16:58 and read from another clj file

16:58 and I'm having problems

17:30 blbrown_win: no they do not have to be compiled, can you post your code to the pastebin including the error

18:09 d2dchat: blbrown_win: sure hold on a sec

18:10 blbrown_win: http://pastie.org/443938

18:10 The weird thing is, I did the same thing independent of those two files in the same directory

18:10 and it seemed to work

18:14 durka42: d2dchat: what is $PWD then

18:15 d2dchat: echo $PWD is /Users/lancelotcarlson/Projects/clojure/redwine

18:15 durka42: ^

18:16 durka42: oh, i see, but it finds src/redwine/server.clj anyway so it should really find request.clj...

18:16 i'm not sure

18:16 d2dchat: it should find both

18:16 durka42: maybe if you put $PWD/src on the classpath?

18:16 d2dchat: well if finds server.clj because I specify in the run.sh file

18:16 BUT

18:16 it doesn't find request.clj

18:17 durka42: didn't work :(

18:18 I tried this:

18:18 java -DDEBUG -cp $PWD/src -Djava.ext.dirs=jars clojure.main src/redwine/server.clj -- $*

18:18 (ns redwine.server

18:18 (:use redwine.request)

18:18 (ns redwine.request)

18:18 durka42: meh

18:18 d2dchat: in the different files respectively^

18:18 durka42: i am stumped :(

18:18 and i have to run

18:18 sorry

18:18 d2dchat: haha

18:18 durka durka

18:18 :(

19:19 dmiles_afk: seem all languages on the JVM are plagued with a fixnums not being a primitive type.. some at least (does clojure?) at least try to use/reuse java's nullable version Integer?

19:20 gnuvince_: dmiles_afk: unless explicitly coerced, Clojure's ints are Java's Integers

19:21 dmiles_afk: which i guess is the best case anyways

19:21 gnuvince_: Almost; the really best case would be that you'd never need to know or care.

19:22 dmiles_afk: indeed

19:25 i am trying to figure out if it is going to be required in the long run to have primitive taking method signatures besides the nullable method singatures

19:26 it'd be such a pain to do.. in any compiler.. wondering if clojure has had to consider do this to speed up use of numbers

19:30 one jvm language started doing this, scala, they secretly add the same methods to things but that take primitives as well as their numberic datatypes

19:30 so that way there is never box/unbox/rebox/unbox etc

19:31 rhickey: dmiles_afk: something like this is on the drawing board

19:31 dmiles_afk: so it actualyl seemed worth it.. thats what i was wondering

19:35 one methodology that almost can make the path to doing this simplier.. is to go ahead and do what your already doing with java.lang.Integer.. then looking for the numberi operations from the bytecode level and replacing it with the same forms using primtives.. GJIT.. is an exmaple of such an aniomal that takes Groovy post compiled code.. then rewrites the bytecode to not use the expensive boxed versions of the operations

19:37 but its too easy to create barriers that GJIT wouldnt be able to do its smart stuff on.. so doing it in the intial phase when you can is always going to be the best

19:39 i am glad it's one the drawing board though

19:39 one/on

19:40 blbrown_win: what is the benefit of lazy sequences

19:41 clojurebot: do you ? what is the benefit of lazy sequences

19:41 clojurebot: c'est bon!

19:41 dmiles_afk: the same benefits as lazy lists

19:43 blbrown_win: what are the benefists of lazy lists

19:43 d2dchat: anyone know about require and use in clojure? I'm having all kinds of problems with use and getting files to load

19:43 http://pastie.org/443938

19:44 dmiles_afk: rhickey: my project is finally moving to useing Clojure on IKVM instead of DotLisp ;P

19:45 d2dchat: grr I've tried so many combinations with the java command and nothing seems to be working

19:47 dnolen: d2dchat: are you trying to load your own clj files?

19:47 d2dchat: dnolen: yes

19:47 dmiles_afk: the project hasnt had a lot of DotLisp code written by users so it's not going to be difficult changeover, but what was impressive was how many cloure features DotLisp had at the get go

19:47 rlb: blbrown_win: that's a pretty general question...

19:48 hiredman: d2dchat: I would not use ext.dirs

19:48 and it's the only one he hasble

19:48 d2dchat: hiredman: what should I use?

19:48 hiredman: ~jar directory

19:48 clojurebot: with java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"

19:49 d2dchat: hiredman: so I should use classpath exclusively?

19:49 hiredman: I think it is the most reliable option

19:49 also what directory are you running java in?

19:50 d2dchat: the path of the project

19:50 hiredman: is the directory containing the "src/" directory on the classpath?

19:50 d2dchat: I think si

19:50 so

19:51 hiredman: think?

19:51 rlb: blbrown_win: ...but in general, the laziness allows you to delay evaluation (computation, allocation, etc.) until it's actually required.

19:51 d2dchat: I'm changing stuff around right now

19:51 :)

19:51 dmiles_afk: blbrown_win: the benefits of lazy lists usually are that if the list contains evaluation to generate the full values of the list.. you are not penalized for head use operations

19:51 d2dchat: directories are split out with the colon character rght?

19:52 hiredman: on unix systems

19:52 on windows, semi-colon

19:52 rlb: ...also allows for infinite sequences, etc.

19:54 d2dchat: hiredman: ok this is what I'm running:

19:54 ./System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars:/Users/lancelotcarlson/Projects/clojure/redwine/src -DDEBUG clojure.main src/redwine/server.clj

19:54 and it's saying:

19:54 java.io.FileNotFoundException: Could not locate clj_html/core__init.class or clj_html/core.clj on classpath: (backtrace.clj:0)

19:55 hiredman: several things

19:55 /Users/lancelotcarlson/Projects/clojure/redwine/jars should be something like /Users/lancelotcarlson/Projects/clojure/redwine/jars/\*

19:55 /Users/lancelotcarlson/Projects/clojure/redwine/src should be /Users/lancelotcarlson/Projects/clojure/redwine/

19:56 just two things then

19:56 d2dchat: ah, separated by colons though

19:56 how do I do that?

19:56 right now it's running

19:57 ./System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-backtrace.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-html-helpers.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-html.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clj-unit.jar /Users/lancelotcarlson/Projects/clojure/redwine/jars/clojure-contrib.jar /Users/lancelotcarlson/Projects/c

19:57 lol

19:57 st3fan: is there someting like CLOS for Clojure?

19:57 d2dchat: after I added /\*

19:57 jars/\*

19:57 hiredman: d2dchat: pardon?

19:58 d2dchat: hiredman: http://pastie.org/443998

19:58 that is spitting out what is above

19:59 blbrown_win: dmiles_afk, aren't there timing issues with lazy operations. For example, if I need a set of sequences to be called in a set order and but the lazy operation is called whenever it is required, wouldn't that cause issues with your code

19:59 hiredman: ignore the run script

20:00 blbrown_win: dmiles_afk, but then again, if you are careful where you use lazy lists then I guess you are OK

20:00 hiredman: type in "java -cp $PWD/jars/\*:$PWD clojure.main src/redwine/server.clj"

20:00 rlb: st3fan: you mean something exactly like CLOS? Clojure has multimethods, etc., but they're a bit different.

20:01 dnolen: st3fan: no, however much of what you might want is available with multimethods and hierarchies. The main missing bit is inheritance of fields, though this isn't too difficult to implement.

20:01 st3fan: i'm not sure what i mean :-)

20:01 dmiles_afk: blbrown_win: right .. just have to decide when they are apropriate

20:01 blbrown_win: dmiles_afk, cool

20:02 st3fan: i would like to write some OO code with clojure, or is that the wrong approach?

20:02 dnolen: stefan: do you need field inheritance?

20:02 st3fan: dunno, i can probably do without

20:02 hiredman: what is OO to you?

20:03 dnolen: then just use multimethods, and ad hoc types

20:03 dmiles_afk: blbrown_win: but in the first case you cited.. you can always copy it into a new list evaled element by evaled element with the new list/seq not lazy

20:03 blbrown_win: dmiles_afk, but personally, I wish that the api would explicty tag lazy operations. For example, I think 'for' uses lazy lists now with the 200903 release. Wish it were called lazy-for or something

20:03 rlb: st3fan: I would take a look at what clojure already has -- it's very powerful, and if you know CLOS, less surprising that if you only knew Java/C++/...

20:03 st3fan: hiredman: class hierarchy ctually

20:03 dnolen: stefan: http://clojure.org/multimethods

20:03 rlb: s/that if/than if/

20:03 hiredman: st3fan: well, clojure has heirachies

20:04 blbrown_win: dmiles_afk, yea, I use 'for' a lot and I have to get used to the new lazy approach to i

20:04 st3fan: i have a lot to read i guess

20:04 blbrown_win: it

20:04 rlb: blbrown_win: I would suspect that if the order is critical, then you should be forcing the order anyway.

20:05 dnolen: st3fan: unfortunately there are a few undocumented things, Rich recently added a handy feature where you can get the specific method for a particular dispatch type. but yeah, there's a little bit to read, but it's not a big topic.

20:05 dmiles_afk: rlb, blbrown_win: the 'for' would enforce some order already right?

20:05 rlb: (i.e. doall)

20:06 blbrown_win: dmiles_afk, it enforces order, but I believe the list that you build won't get built until you need it. And I am guessing it didn't work this way with the older clojure release

20:06 rlb: I suppose I shouldn't have said order -- I really meant "timing".

20:06 d2dchat: hiredman: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp /Users/lancelotcarlson/Projects/clojure/redwine/jars/*:/Users/lancelotcarlson/Projects/clojure/redwine -DDEBUG clojure.main src/redwine/server.clj

20:06 java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (str_utils.clj:38)

20:06 clojurebot: ?

20:06 hiredman: ah

20:06 now we are getting somewhere

20:07 blbrown_win: rlb, dmiles_afk I am not concerned or anything or have any issues. I think it is a cool feature. For me though, I have to get used to lazy operations in a language, especially as it relates to debugging

20:07 hiredman: d2dchat: do you have the latest versions of everything?

20:08 d2dchat: hiredman: yea, when I had the ext.lib thing pointing to the jars path.. everything was working EXCEPT for my extra .clj file I was trying to include

20:08 blbrown_win: dmiles_afk, I could be wrong, but I couldn't want to use lazy lists and database operations together

20:08 hiredman: d2dchat: well, if you want to go back to that, the problem was the "src" at the end of your classpath

20:09 dmiles_afk: i am new to clojure myself but i assume there was something you can wrap a list in. a memoizer that on first use walks the list on first use

20:09 hiredman: your namespaces all start with src.* so src needs to be in soemthing on the classpath, but not on the classpath

20:09 d2dchat: hiredman: if we can get this classpath method to work, then I'm all for it

20:09 blbrown_win: dmiles_afk, I don't know. I was using 'for' as my example. Maybe somone else knows

20:09 hiredman: dmiles_afk: lazy-seqs cache their results

20:10 blbrown_win: ,(doc lazy-seqs)

20:10 clojurebot: java.lang.Exception: Unable to resolve var: lazy-seqs in this context

20:10 hiredman: each part computation for an element in a lazy-seq is done once

20:10 clojurebot: for is a loop...in Java

20:10 hiredman: ,(doc lazy-seq)

20:10 clojurebot: "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls. Any closed over locals will be cleared prior to the tail call of body."

20:10 hiredman: all the clojure functions that deal with seqs that can be lazy are

20:11 d2dchat: hiredman: I'm not so sure that the jars/* is working as it should

20:11 dmiles_afk: that is a good default

20:11 hiredman: d2dchat: I am sure it is, that str_utils exception is something I have seen before, but I forget exactly the circumstances

20:12 I think it was something to do with clj-html

20:12 blbrown_win: dmiles_afk, do you work with haskell? is that the approach the haskell uses

20:12 d2dchat: hiredman: well I imported all of the deps for the ring project

20:12 all of the jars that it uses is on the repo

20:12 and stuck them inside of the jars folder

20:13 hiredman: I think clj-html has it's own git repo, which may be newer then whatever ships with ring

20:13 dmiles_afk: blbrown_win: i am a lzay list prolog programmer.. dont know haskell yet.. but i thought haskell assumes the evaluation is not cachabel ussually.. so if you broke into a debugger.. every inspection might trigger the call again?

20:13 d2dchat: hiredman: I don't necessarily want new.. just whatever works with ring

20:14 dmiles_afk: cachabel/cachable

20:14 hiredman: d2dchat: that is the thing, I think the clj-html that comes with ring doesn't work

20:14 d2dchat: haha gotcha

20:14 :(

20:14 although it wasn't complaining before..

20:15 hiredman: I forget exactly because it was something like a month ago when I ran into this

20:16 d2dchat: hiredman: I'm not even using html in my code :(

20:16 hiredman: d2dchat: if you want to go back to ext, go ahead, the problem with you classpath is the "src" at the end

20:16 dmiles_afk: blbrown_win: my assumptionm to haskell not caching it is that good haskell code .. knows how to 'undo side effects' .. so caching would be only an optimization.. not for cleanliness

20:16 blbrown_win: dmiles_afk, shrug, I remember there might issues with the haskell approach as lazy by defult for most sequence operations and can cause memory problems. But this is coming froma a person that doesn't understand it all

20:16 hiredman: ~lazy

20:16 clojurebot: lazy is hard

20:18 dmiles_afk: clojure would be caching the evaluations for cleanliness .. so side effects only trigger when they should (is that one reason?)

20:18 blbrown_win: ask rhickey_

20:18 hiredman: dmiles_afk: the operations that generate you lazy-seq are not free

20:18 better to just do it once, instead of everytime you walk a seq

20:19 blbrown_win: dmiles_afk, at least with the jvm, there are better tools to monitor memory/heap usage and other tools for tracing operations...compared to haskell. So it would be an interesting expirement

20:20 hiredman: there is a branch in svn of work on "streams" which are like non-caching lazy-seqs

20:22 dmiles_afk: someone wrote a JVM in prolog.. it had the ability to run bytecode forward and backward

20:22 hiredman: nice

20:22 blbrown_win: do you mean a VM?

20:22 hiredman: maybe someone shoudl write a jvm in clojure

20:23 dmiles_afk: a java bytecode interpreter

20:23 hiredman: I heard you like clojure so I wrote your jvm in clojure so you can run clojure in clojure while you run clojure

20:24 durka42: what happens when you run bytecode backwards?

20:24 hiredman: you gain memory

20:24 :P

20:24 dreish: Sun's stock goes up.

20:24 dmiles_afk: that was true

20:24 hiredman: ha ha

20:24 ~ticker JAVA

20:24 clojurebot: JAVA; +0.02

20:25 blbrown_win: I guess it is kind of like call with current with continuations, only a relic of scheme apparently

20:29 d2dchat: hiredman: btw I think this is better:

20:29 EXT="$(find $PWD/jars -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)"

20:29 hiredman: still having problems, but same error

20:33 blbrown_win: I guess I work for a big company and use clojure, maybe I should market my clojure use...naah

20:35 dmiles_afk: i am working on a secondlife bot that is programable in clojure

20:36 blbrown_win: nice

20:37 http://code.google.com/p/lighttexteditor/ I have written and rewritten this for the last 6-7 months

20:37 hiredman: dmiles_afk: oooo

20:38 blbrown_win: I am starting to use George Bush terminology. But at least I am drinking right now

20:38 dmiles_afk: hiredman: http://code.google.com/p/opensim4opencog/source/browse/trunk/bin/cogbot.lisp (we naming them lisp becasue it it's Cojure's anccestor DotLisp)

20:38 *Clojure's

20:39 blbrown_win: dmiles_afk, do you like second life

20:39 d2dchat: arg this dependency hell is frustrating

20:39 hiredman: clojurebot should totally hang out is second life

20:39 in

20:40 blbrown_win: d2dchat, no offense, but it isn't that hard. I have found the clojure namespace system to be pretty good

20:40 dmiles_afk: nope, but SL provides a place to runs bots with real people

20:40 d2dchat: blbrown_win: IT IS easy.. if it worked...

20:40 hiredman: d2dchat: are you still getting that str-utils exception?

20:40 d2dchat: hiredman: yes

20:41 hiredman: I would pull the latest clj-html from github and try it

20:41 d2dchat: hiredman: and I copied over the clj-html jars I generated from the git repo

20:41 hiredman: ~google clj-html

20:41 clojurebot: First, out of 58700 results is:

20:41 mmcgrana&#39;s clj-html at master - GitHub

20:41 http://github.com/mmcgrana/clj-html/tree/master

20:41 d2dchat: hiredman: tried that already

20:41 hiredman: hmmm

20:42 dmiles_afk: LTEC looks pretty good

20:42 blbrown_win: dmiles_afk, ahh?? C# ...just kidding

20:42 pjstadig: ,(type (into-array [1 2 3]))

20:42 clojurebot: [Ljava.lang.Integer;

20:42 dmiles_afk: blbrown_win: clojure runes very well on IKVM recently

20:43 runs

20:43 hiredman: clojurebot: would you like to hang out in second life?

20:43 clojurebot: Pardon?

20:43 pjstadig: how would i find the type of an array's elements?

20:43 hiredman: class?

20:43 or type I guess

20:43 pjstadig: ,(class (into-array [1 2 3]))

20:43 clojurebot: [Ljava.lang.Integer;

20:43 pjstadig: no i want it to return Integer

20:43 hiredman: on the first element

20:44 dmiles_afk: IKVM = .NET JVM.. you get to write implmentations in C#,J#,Java,VB,etc

20:44 pjstadig: oh

20:44 hmm

20:44 hiredman: ~javadoc java.utils.Array

20:44 d2dchat: blbrown_win: it's not as if dependencies in clojure or any language aren't a problem.. I'm not only relying on my stuff to work.. but other's :-P

20:44 hiredman: bah

20:44 ~javadoc java.util.Array

20:44 blbrown_win: dmiles_afk, would be another interesting project to port clojure to llm

20:45 llvm

20:45 hiredman: where is the array utility stuff?

20:45 durka42: ~javadoc java.util.Arrays

20:46 blbrown_win: d2dchat, I was just kidding, I wasn't really look at the problem, all I know I have always used ns, :use, :import without any problems for multiple files, projects and dependencies

20:47 hiredman: ~google clojure ring

20:47 clojurebot: http://lmgtfy.com/?q=clojure+ring

20:47 hiredman: Thanks

20:48 ~google clojure ring

20:48 clojurebot: First, out of 3110 results is:

20:48 Ring: A Web application library for Clojure. - Clojure | Google Groups

20:48 http://groups.google.com/group/clojure/browse_thread/thread/bbc9fd453667d953/0214afdf2da814cd?show_docid=0214afdf2da814cd

20:54 hiredman: fresh ring checkout works fine here

20:55 java -cp $PWD/jars/\* clojure.main src/ring/examples/wrapping.clj

21:04 d2dchat: blbrown_win: it does work.. the problem are the jars I'm pulling now :(

21:04 something: (setq swank-clojure-extra-classpaths (list "path/to/my/clojure-contrib.jar") is what I need to do to setup clojure contrib in my.emacs?

21:05 because it's not working for me.

21:05 hiredman: ~jar directory

21:05 clojurebot: with java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"

21:05 d2dchat: I think.. but all of the jars *were* working when I used -Djava.ext.lib=

21:05 which is weird..

21:06 durka42: yes, extdirs and classpath act differently

21:06 d2dchat: durka42: bah! Now I have to go

21:07 durka42: such is life

21:07 ~life

21:07 clojurebot: meaning of life is to become one with Lisp

21:07 d2dchat: durka42: pastie before I leave:

21:07 http://pastie.org/444046

21:07 durka42: old clojure version

21:07 d2dchat: durka42: bah.. really?

21:07 lol

21:07 durka42: do you have the one from before lazy was introduced?

21:08 old clojure and latest contrib generally do not play nice

21:08 d2dchat: durka42: I'm using the version that was included with ring

21:08 durka42: hmm, could be the issue

21:08 * durka42 hasn't used ring

21:09 hiredman: ring works fine with the jars it comes with here

21:09 d2dchat: hiredman: it works fine when I use ext.lib

21:09 ext.dir

21:09 or whatever

21:09 never remember what it was

21:10 hiredman: then use that

21:10 d2dchat: lol

22:01 aCogCorroded: Hey, guys. I am trying to install clojure. I am not much of a java programmer, and not much of a programmer at all at the moment. So this is probably a simple mistake on my part. So I put the jline jar file in my clojure directory, then run "java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl" and get "Could not find the main class: jline.ConsoleRunner." What am I doing wrong?

22:03 hiredman: my guess is an extra "." after jline.ConsoleRunner

22:03 cconstantine: aCogCorroded: not sure

22:04 hiredman: I recommend rlwrap instead of jline

22:04 aCogCorroded: Okay, I will look up rlwrap.

22:04 hiredman: jline has some mangling issues with unicode

22:05 aCogCorroded: does clojure.lang.Repl work without jline?

22:06 aCogCorroded: hiredman, I'll check

22:06 it works with "java -cp clojure.jar clojure.lang.Repl"

22:07 I am actually slowly moving over to vim from IDEs, could I just start with that?

22:08 hiredman: it works, but you don't get history, and up arrow and stuff

22:09 aCogCorroded: Ah. I will continue to explore. Thanks for the help.

22:11 hiredman: crazy

22:12 aCogCorroded: ?

22:14 hiredman: I built a desk today, and just borrowed a level, and it is almost dead level

22:14 dreish: aCogCorroded: He was not calling you crazy.

22:16 aCogCorroded: Wait. I'm not sure I understand exactly what these programs do. A readline wrapper. I am a windows user. I don't know if that makes a difference, but the concept is new to me.

22:17 dreish, ah. Now I get it. And hiredman, that is crazy.

22:18 dreish: aCogCorroded: If you're on Windows, and don't want to spend hours ramming your head into one wall after another, my recommendation (without having tried it since I'm not on Windows) is Clojure Box: http://clojure.bighugh.com/

22:20 aCogCorroded: Thanks. I will have a look.

22:21 That looks perfect. Thanks.

22:42 Wow, Clojure Box looks pretty awesome, though I know nothing of emacs, but using it for clojure seems simple enough.

23:03 gnuvince_: I just wrote a super simple recursive dirtree with indentation in C, Clojure, Python and Haskell. The Clojure version is the shortest one. Funnily enough, I had more difficulties with the Haskell one than the the C one; all that monadic IO is nice in theory, but is really a pain in the ass otherwise

23:05 dakrone_hb: gnuvince_, how's the performance of the 4?

23:07 gnuvince_: Pretty much the same, Clojure takes the most time to start.

23:07 It's REALLY simple

23:07 dirtree /path/to/dir

23:07 and it outputs the directory structure

23:07 dakrone_hb: as a hash-map? array?

23:08 gnuvince_: array

23:08 (.listFiles path)

23:08 Then a doseq over that

23:08 check if .isDirectory

23:08 really, really simple

23:08 Anyway, just thought it was nice that Clojure was even a little more concise than Python

23:09 dakrone_hb: neat

23:09 gnuvince_: And that Haskell wasn't so nice, unfortunately.

23:09 ice_four: Is there an equivalent to return in clojure?

23:20 cp2: gnuvince_: can you paste the source? i would like to see how you implemented it

23:22 lisppaste8: gnuvince pasted "dirtree" at http://paste.lisp.org/display/78433

Logging service provided by n01se.net