#clojure log - Feb 03 2009

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

0:39 durka42: so -- what is a "logical collection"?

0:39 is it different from "a seq or nil"

0:40 or is it just a duck that promises to turn into a seq or nil when you call seq on it

0:55 gordongecko: could a reader macro allow something like ([1][1,2,3]) -> 2

0:55 could a reader macro allow something like (#[1][1,2,3]) -> 2

0:55 could a reader macro allow something like (#[1:3][1,2,3,4,5]) -> [2,3]

0:58 durka42: no, probably, and probably

0:58 but clojure doesn't have reader macros

0:59 gordongecko: is there a slice function?

0:59 durka42: subvec

0:59 (doc subvec)

0:59 clojurebot: 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.; arglists ([v start] [v start end])

1:00 durka42: ,(subvec [1 2 3 4 5] 2 3)

1:00 clojurebot: [3]

1:00 durka42: ,(subvec [1 2 3 4 5] 1 3)

1:00 clojurebot: [2 3]

1:00 durka42: also

1:00 ,(range 5)

1:00 clojurebot: (0 1 2 3 4)

1:00 durka42: ,(range 3 700 50)

1:00 clojurebot: (3 53 103 153 203 253 303 353 403 453 503 553 603 653)

1:15 hiredman: ,(use '(clojure.contrib.repl-utils))

1:15 clojurebot: nil

1:15 hiredman: ,show

1:15 clojurebot: java.lang.Exception: Unable to resolve symbol: show in this context

1:15 hiredman: ,(use 'clojure.contrib.repl-utils)

1:15 clojurebot: nil

1:15 hiredman: ,show

1:16 clojurebot: #<repl_utils$show__1120 clojure.contrib.repl_utils$show__1120@688954>

1:16 hiredman: ,(source for)

1:16 clojurebot: Source not found

1:16 hiredman: :(

1:18 durka42: ,(source subvec)

1:18 clojurebot: Source not found

1:18 durka42: it does that if you've updated clojure.jar out from under the running program

1:19 hiredman: hmm

1:19 I have not

1:19 durka42: hmm

1:19 security crap preventing it from opening files?

1:19 hiredman: ah

1:19 Yes

1:20 durka42: ,(File. "/")

1:20 clojurebot: java.lang.IllegalArgumentException: Unable to resolve classname: File

1:20 durka42: ,(java.io.File. "/")

1:20 clojurebot: #<File />

1:21 durka42: ,(.listFiles (File. "/"))

1:21 clojurebot: java.lang.IllegalArgumentException: Unable to resolve classname: File

1:21 durka42: ,(.listFiles (java.io.File. "/"))

1:21 clojurebot: java.security.AccessControlException: access denied (java.io.FilePermission / read)

1:21 durka42: good

1:24 hiredman: hmmm

1:24 the sandbox should really be using java.util.concurrent.Executors

1:29 gordongecko: im gonna sin

1:30 durka42: are you asking forgiveness? :p

1:36 gordongecko: im gonna go !

1:36 for-loops naturally encourage sideeffects

1:36 im tryong to translate gaussjordan elimination from python to clojure

1:38 hiredman: ,(doc dotimes)

1:38 clojurebot: "([bindings & body]); bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1."

1:38 hiredman: ,(doc doseq)

1:38 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

2:25 lisppaste8: gekko pasted "gauss jordan elimination" at http://paste.lisp.org/display/74770

2:25 gordongecko: anyone could take a look at that and point me to the right direction? this is typical for the problems i have with functional langs

2:26 it uses a lot of for loops at state and it alwyas becomes so messy when doing in a pure way

2:43 Lau_of_DK: Good morning everyone

2:48 knapr: how do you nest loop/recur? does recur always recur to the closest loop? there is no magic there?

2:49 Lau_of_DK: I believe it always recurs to the closet loop

2:50 hiredman: knapr: recur always recurs to the closest frame

2:50 which maybe a loop or a fn

2:50 if you use a macro that makes fns around statements this can lead to unpredictable results

2:52 knapr: is there no function-global def?

2:52 hiredman: huh?

2:53 Lau_of_DK: def is global

2:53 knapr: i want to use def inside a function, can prevent that variable form becoming global to the program?

2:53 hiredman: nope

2:53 def != schemes define

2:54 you can sometimes emulate that behaviour with let

2:57 Lau_of_DK: hiredman: He left before you answered :)

2:57 hiredman: so he did

2:57 Lau_of_DK: For local-scope defs he should probably use defn- from contrib

2:57 hiredman: erm

2:58 gordongecko: i thought defn- was in core

2:58 hiredman: defn- is not from contrib

2:58 Lau_of_DK: Fair enough, but you get the picture

2:58 I think defn- originated from contrib

2:59 hiredman: defn- is not local

2:59 it is private

2:59 Lau_of_DK: oh, thats not quite the same

2:59 gordongecko: yes

2:59 Lau_of_DK: Then his option is using bindings ?

2:59 hiredman: nah

2:59 let

3:00 and the fn in defn closes over what is bound with let

3:01 Lau_of_DK: Ok, I see that binding is primarily for redefining something which is already bound to a value

3:01 hiredman: ...

3:03 ,(.codePointAt "..." 0)

3:03 clojurebot: 8230

3:03 hiredman: ,(int \...)

3:03 clojurebot: 8230

3:06 hiredman: ,(short \...)

3:06 clojurebot: java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number

3:06 hiredman: hmmm

3:45 AWizzArd: Hi

3:48 Lau_of_DK: Hey AWA

3:53 AWizzArd: clojurebot: max people

3:53 clojurebot: max people is 137

3:53 AWizzArd: uh :-)

3:53 hi cg

3:53 cgrand: hi!

4:26 newb12345: how good is clojure for real world computing? stuff like parsing html files

4:33 cgrand: newb12345: at least as good as Java :-) for parsing html you can use TagSoup for example. In the mailing list, there are examples of integrating TagSoup + zippers

4:36 newb12345: zippers? as in haskell/functional zippers?

4:38 cgrand: I'm not an Haskeller, but zippers as in functional artifacts to navigate/mutate trees

4:38 newb12345: whoa

4:39 so clojure is elegant like lisp, but practical like java?

4:39 AWizzArd: indeed

4:39 newb12345: to play devil's advocate

4:40 why hasn't it taken over the world yet?

4:40 AWizzArd: because Clojure 1.0 is not published.

4:40 In October there were around 70-80 people in this room.

4:40 clojurebot: max people

4:40 clojurebot: max people is 137

4:40 newb12345: how do i get the size of a channel?

4:40 AWizzArd: with about 750 members in the Google Group

4:40 metaperl: when using 'ant' to build Clojure, what advantage does that give you? I dont have much java background.

4:41 AWizzArd: newb12345: depends on your irc-client

4:41 newb12345: for yours, what is it?

4:41 i'll just try it in mine

4:42 AWizzArd: metaperl: in a project of 619 files you won't need to type 619x javac, but only one time ant.

4:42 And don't forget dependencies.

4:42 metaperl: does it make it easier to use clojure from the command line?

4:43 right now, I downloaded clojure to a temp directory and run the REPL from there... I'm wondering if using 'ant' will perform a 'system install' and make clojure available from any directory.

4:44 AWizzArd: metaperl: http://www.google.com/search?q=ant

4:44 cgrand: metaperl: ant is make for java

4:48 Lau_of_DK: <newb12345> how good is clojure for real world computing? stuff like parsing html files

4:48 This is a classic quote :)

4:48 cgrand: Why are you always pushing SoupBox, did you make it?

4:50 cgrand: no Mr Lau, it's just my reflex answer to "how to parse html in javaland"

4:51 and its author created this irc channel :-)

4:52 * cgrand discovers git-svn

4:53 Lau_of_DK: uuuh :)

4:54 Still funny: real world computing = parsing html

4:55 gregh: you never know when you're going to be walking down the street and trip over some unclosed tags!

4:55 Lau_of_DK: thats certainly true

4:55 cgrand: And you primarily a Git man, or an Svn girl ?

4:58 cgrand: Lau_of_DK: I'm agnostic

4:59 Lau_of_DK: Thats odd

5:01 cgrand: plus, I don't answer sexist questions :-)

5:02 Lau_of_DK: oh man, you really are french!

5:03 cgrand: warum?

5:03 Lau_of_DK: hehe, Im not german. It just matched my stereotype of a french person, react that way to a git/svn joke :)

5:04 * cgrand wanted to type why and typed warum... need coffee

5:07 cgrand: Seriously, having to work crossplatform, I tried hg two years ago but it's quite recently that I tried git again

5:22 Lau_of_DK: cgrand: Git is pretty well supported for Windows isnt it?

5:23 cgrand: Lau_of_DK: except git-svn, it seems to work well

5:24 (but cygwin/git-svn works ok)

5:30 Lau_of_DK: Ah ok

5:39 cgrand: But to me its primarily a business case: Which gives minimal overhead without loss of relevant features? Git was a clear winner, and since our migration at the company, the feedback has been 100% positive

5:41 gordongecko: is there a function to update a vector at a specific pos?

5:42 cgrand: gordongecko: assoc

5:42 gordongecko: ah assoc works there too

6:00 lisppaste8: gordongecko pasted "matrix update" at http://paste.lisp.org/display/74776

6:00 gordongecko: can ^^ be improved to something shorter and more clear?

6:02 Chousuke: is your matrix a vector of vectors?

6:02 if so, use assoc-in

6:03 ,(assoc-in [[1 2 3] [4 5 6]] [1 1] :a)

6:03 clojurebot: [[1 2 3] [4 :a 6]]

6:03 gordongecko: ok

6:03 is assoc O(1) ? so if i want to make a matrix it is efficient to sue evctirs?

6:03 vectors

6:03 Chousuke: the performance of assoc depends on the data structure.

6:04 vectors might not be the most efficient matrix representation, at least for large matrices.

6:05 gordongecko: wellf or sparse amtrices i guess id use a hashmap but for dense ones?

6:05 Chousuke: assoc is not O(1) for vectors, but close enough.

6:06 log32 or something. :)

6:08 gordongecko: how would you do the equivalent of: a={} for r in rows: for c in cols: a.update{(r,c): 0} ?

6:09 ie nest for loops and accumulate to a variable that is global in the function

6:12 Chousuke: you want to zero the array? :/

6:13 that doesn't really make sense in clojure, unless you're dealing with mutable data.

6:16 gordongecko: you could simply define A to be full of zeros to begin with, for example, (vec (take rows (repeat (vec (take cols (repeat 0))))))

6:17 AWizzArd: in Clojure in principle evrything are constants

6:18 Chousuke: compared to traditional languages, I suppose.

6:18 AWizzArd: yes

6:18 Chousuke: in clojure a constant would be a name that always is bound to the same value.

6:19 AWizzArd: you mean that the value is bound to the name?

6:19 Chousuke: or that.

6:19 AWizzArd: ;-)

6:21 Chousuke: gordongecko: it's important to keep in mind that once you have a value, there's *no way* to change it, if it is one of the clojure basic data types (and not some java stuff). You can only create *new* values based on the old one.

6:34 knapr: i want to generate all pair-combinations of 2 ranges, like (range 1) (range 1), should gen [0 0] [0 1] [1 0] [1 1]

6:37 AWizzArd: knapr: (for [a (range 2) b (range 2)] ...)

6:38 (for [a (range 2) b (range 2)] [a b])

6:45 knapr: can you map over a hashmap somehow?

6:45 do soemthing to eahc value i mean

6:48 Chousuke: yeah

6:48 just use map

6:48 each key-value pair will be given to your function as a [k v] vector

6:50 AWizzArd: knapr: you can map over (vals your-map)

6:51 Chousuke: ,(apply hash-map (map (fn [[k v]] [v k]) {:a 1 :b 2}))

6:51 clojurebot: {[1 :a] [2 :b]}

6:51 Chousuke: hm

6:51 not quite :/

6:51 AWizzArd: (map #(+ 7 %) (vals my-mep))

6:52 Cark: awizzard : been reading cll again, i think trampolines are just perfect, the parser combinator think mentioned by JH makes no sense, the user of your library would of course need to adapt his programing style to use trampolines as well

6:52 Chousuke: ,(int0 {} (map (fn [[k v]] [v k]) {:a 1 :b 2}))

6:52 clojurebot: java.lang.Exception: Unable to resolve symbol: int0 in this context

6:52 Chousuke: gah

6:52 ,(into {} (map (fn [[k v]] [v k]) {:a 1 :b 2}))

6:52 clojurebot: {2 :b, 1 :a}

6:53 AWizzArd: Cark: yes, for nearly (and maybe all) practical cases Trampolines should be enough.

6:58 newb12345: I use irssi, and for me the command is /names

7:15 gordongecko: but lets say i want to keep some metadata like rows and cols to make some calcs faster, how would you do that? pass that along a s a struct or can you have metadata ona hashmap?

7:16 AWizzArd: you should not put cache data into the metadata

7:17 instead you can memoize your function

7:17 gordongecko: yes but for a matrix it makes sens e to just pass around the matrix-hashmap and rows and cols

7:17 asa struct

7:17 no?

7:17 Lau_of_DK: gordongecko: I would say so

7:39 gordongecko: does clojure have something like haskells show?

7:40 AWizzArd: gordongecko: (str your-object)

7:40 (str 10) ==> "10"

7:41 ,(str {"key" 'value})

7:41 clojurebot: "{\"key\" value}"

7:41 gordongecko: how can I map println without nil?

7:42 AWizzArd: gordongecko: don't use map for side-effects. Use (doseq [obj collection] (println obj))

7:43 gordongecko: hmm?

7:43 (doseq println [[1 2 3] [4 5 6] [7 8 9]])

7:43 ah

7:44 Lau_of_DK: ,(doseq [idx (range 10)] (println idx))

7:44 clojurebot: 0 1 2 3 4 5 6 7 8 9

7:55 svn rev 1248; [lazy] added sequence?

7:56 gordongecko: does clojure have something like haskell's show? so if i have a struct X i can write a function show for it so when you do x int he repl it shows not X but some other version of X, a prettyprinted one?

7:57 AWizzArd: you mean you want your own printed representation of an object?

7:57 durka42: gordongecko: print-method is a multimethod that dispatches on class

8:01 see Chouser's recent patch: http://clojure.googlecode.com/issues/attachment?aid=3251654005916676481&name=print-iref.patch

8:07 Cark: with the upcoming changes regarding nil punning, would it be safer to use the empty? predicate to test if a collection is empty ?

8:07 or take the doc advice of using seq instead

8:08 rhickey: Cark: please no! empty? is still defined as (not (seq x)), and the preferred Clojure idiom is still (when (seq coll) ...)

8:09 Cark: thank you rhikey

8:09 * rhickey hates (if (not (empty? coll)) ...)

8:09 * Cark hides in a corner

8:11 Cark: see i have this trie library, and sometimes need to use the data as a seq, using the high order functions and lazy-cons is 10x slower than using loop recur to build a vector

8:11 actually no, it's 5 times slower

8:11 but still =/

8:13 rhickey: but if you are a die-hard Schemer or prefer termination conditions first, you can (cond (empty? x) foo :else bar), but not my preference

8:13 I am interested in reports of actual nil puns in the field broken by the lazy branch

8:14 AWizzArd: rhickey: so concat now has the role of lazy-cat?

8:14 bakkdoor: hi

8:15 AWizzArd: hey bak

8:15 rhickey: AWizzArd: lazy-cat still exists, because, as a macro it suspended the entire argument expressions, but if those expressions are just other sequence calls, there's no need for lazy-cat, just use concat

8:16 bakkdoor: i'm somehow having a problem with the clojure-contrib.jar. it doesnt show up within my repl in emacs, i mean the namespace doesnt. do i need to tell it somehow to load it? i use jline, have that installed and have the clojure.conf in my home folder as described in the tutorial. i also have the clojure-contrib.jar in ~/.clojure (with my jline.jar) and loading clojure with jline seems to work

8:16 rhickey: user=> (macroexpand '(lazy-cat xs ys zs))

8:16 (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))

8:17 AWizzArd: ah okay, so lazy-cat was also adopted to the new lazyness

8:17 rhickey: so if xs ys and zs are already sequence calls, they're already fully lazy and lazy-cat is redundant

8:17 gordongecko: is ther eno function forturning a vector into a hashmap?

8:17 ayrnieu: bakkdoor - (.contains (System/getProperty "java.class.path") "clojure-contrib.jar") ?

8:17 AWizzArd: gordongecko: with keeping all indexes?

8:18 bakkdoor: => true

8:18 ayrnieu: => true

8:19 gordongecko: if i have this common idiom in my functions for (defstruct matrix :repr :rows :cols) where i take the repr, do soemthing ot it, then do (struct matrix new-repr (m :repr) (m :cols)), could i abstract that out? with -> perhaps?

8:19 ayrnieu: (use 'clojure.contrib.javadoc) (javadoc String) ?

8:19 bakkdoor: this is my classpath: "/home/bakkdoor/opt/clojure/clojure.jar:/home/bakkdoor/.clojure/clojure-contrib.jar:/home/bakkdoor/.clojure/jline.jar"

8:20 hm works, opens my browser

8:20 ayrnieu: so what are you trying that doesn't work?

8:20 AWizzArd: gordongecko: if you do this often you could think about having a ref/agent/atom on your structured-map

8:20 bakkdoor: now it also shows the clojure.contrib.javadoc.browser and hell-out when tab-completing

8:21 gordongecko: AWizzArd: well then i make it mutable, thats not what iw ant

8:21 AWizzArd: the map is still immutable

8:21 only the ref is mutable

8:22 bakkdoor: ayrnieu: i wanted to use clojure.contrib.math.expt.. but after doing (use 'clojure.contrib.math) it now works.. hmm so is there a way to also load the stuff in clojure.contrib to be displayed with tab completion like the clojure.jar stuff is by default?

8:25 ayrnieu: bakkdoor - you could cache tab-completion emacs-side; you could load all of the contrib modules.

8:27 bakkdoor: where would i put this? will it check for a .clojurerc file in my home directory or something where i can put some code i want it always to run when starting?

8:28 ayrnieu: you can have your 'clj' script load ~/.clojurecl if it exists: http://aur.archlinux.org/packages/clojure-svn/clojure-svn/clj

8:28 ~/.clojure.clj , there

8:28 clojurebot: clojure is the bestest programming language available.

8:29 bakkdoor: ah alright, thanks ;)

8:40 clojurebot: svn rev 1249; [lazy] restore step fns in filter/drop

8:42 leafw: is there any clojure contrib in git, officially endorsed

8:42 kevin oneil's doesn't load.

9:03 cemerick: Good morning, all. I've been away for a while. I was hoping someone could clue me in on the latest "stable" rev in svn (e.g. the lastest prior to any experimental additions rolling in)...?

9:05 ayrnieu: clojurebot: latest

9:05 clojurebot: latest is 1249

9:05 ayrnieu: the eperimental additions are rolling into the lazy branch.

9:07 cemerick: wow, branches in a clojure svn? Shocked, I am! ;-)

9:07 * rhickey may need help moving them into trunk when the time comes :)

9:09 Lau_of_DK: rhickey: Did you get that pic I sent you regarding the trunk ?

9:09 rhickey: Lau_of_DK: no - where?

9:09 cemerick: rhickey: I may have forgotten all of my svn-foo by then. ;-) We moved to git over the holidays, despite all of my anti-git agitations.

9:10 Lau_of_DK: hang on

9:10 rhickey: http://images.nonexiste.net/irc/2008/10/13/git_two.jpg

9:11 danlarkin: Lau_of_DK: I don't get it?

9:11 Lau_of_DK: you dont? Git has no trunk, SVN has everything in trunk...

9:11 danlarkin: oh.... :-/

9:11 ayrnieu: (what you gon' do with all that origin? All that junk inside your origin?)

9:20 Lau_of_DK: rhickey: I take it you dont appreciate that kind of humor?

9:22 rhickey: Lau_of_DK: I don't git it at all

9:22 Raynes: Lol'd.

9:30 clojurebot: svn rev 1250; [lazy] more returns Sequence

9:31 rhickey: http://clojure.org/lazier enhanced - feedback wanted, it is making sense?

9:51 cgrand: rhickey: what is the problem with loop in filter/drop?

9:51 rhickey: cgrand: consumes memory while skipping

9:54 cgrand: rhickey: ah yes, thanks!

9:54 LordOfTheNoobs: Would it be odd for `if' to call `seq' on any `(sequence? x)'? Conditionals would then consume at least one item from any sequence submitted to them, `(when (filter pred coll) foo) would consume coll until pred, etc. That would restore nil punning, no? Testing to see if our collection is populated rather than that we have a lazy collection that is potentially populated seems the better default. Maybe that is just me. (when (seq

9:54 (filter pred coll)) foo) seems likely to introduce errors, and is, to me, somewhat unintuitive.

9:55 rhickey: cgrand: I explain the new closed-over clearing at the bottom of: http://clojure.org/lazier

9:55 * LordOfTheNoobs probably missed a discussion wherein these things were already thought out.

9:56 rhickey: LordOfTheNoobs: adding any overhead to something as primitive as 'if' would be unacceptable

9:58 LordOfTheNoobs: also would mess with your ability to distinguish something empty from nothing

9:58 cemerick: rhickey: I just finished a first read/skim of /lazier and /streams. Looks nifty, and I don't have much to add. FWIW, it seems like we're almost to #t and #f for truthiness.

9:59 ...which I'm mostly neutral about, so it's a wash for me for the most part

10:01 rhickey: cemerick: It may seem so on the surface, but there is still quite a bit of leverage to nil, using whens as seq bodies, when-first et al

10:02 cemerick: seq/nil much more useful than #t/#f

10:03 cemerick: rhickey: yeah, I'm sure there's a lot of formal advantages to it. Of course, I'm one of those who like to have termination conditions first, so I do a bunch of (if-not ...) anyway, which I know you hate :-P

10:04 rhickey: cemerick: eah, I much prefer (when something-to-do do-it)

10:04 cemerick: I certainly will miss the current behaviour, just from a syntax/usability perspective. Python introduced me to empty-is-false, and I'll miss it.

10:05 rhickey: well, I'm not much of a programmer, so don't pay any attention to me

10:05 rhickey: cemerick: 'empty' is false still for seqs, were you doing much (if (filter foo) ...)?

10:05 ayrnieu: (defn only-for-vecs ":(" ([[]] 0) ([_ & xs] (+ 1 (only-for-vecs xs))))

10:06 Chouser: ayrnieu: trying to do pattern matching?

10:06 cemerick: rhickey: I can't say one way or the other right this minute. I've been away from programming for a solid month, so I can't even remember where I put my keyboard.

10:09 ayrnieu: Chouser - I was trying to show that destructuring isn't seq-agnostic, but that example fails for other reasons.

10:13 (defmulti length empty?) (defmethod length true [_] 0) (defmethod length false [[_ & xs]] (+ 1 (length xs)))

10:16 Chousuke: ayrnieu: I'd call that abuse of multimethods :P

10:17 Chouser: or clever

10:17 ayrnieu: well, enjoy rewriting your less-robust code when lazy hits :-)

10:18 Chouser: ayrnieu: I'm still not sure what you're trying to show there.

10:18 ayrnieu: how would you write that for a PersistentList?

10:19 Chouser: (length '(a b c)) returns 3 for me on trunk

10:19 does it not on lazy?

10:21 ayrnieu: huh. OK, nevermind.

10:27 jkantz: anyone have an example use-case for with-local-vars?

10:29 ayrnieu: http://github.com/search?language=clojure&q=with-local-vars

10:30 cgrand: rhickey: hmm since LazySeq extends AFn can we have named lazy-seqs? (defn cycle[coll] (lazy-seq this (concat coll this))) :-)

10:34 lisppaste8: ayrnieu pasted "named lazy-seq" at http://paste.lisp.org/display/74786

10:37 cemerick: Given an class with static members (e.g. an enum), referring to a non-existent member ends up throwing a "No such namespace" error. I understand that the Classname/Membername syntax has to fall back to checking for namespace/var-name, but it seems like if a class with the given name is in scope, an error message should be emitted that assumes that the code was referring to the imported class.

10:37 Chousuke: not just (defn cycle [coll] (lazy-seq (concat coll (cycle coll)))) or something?

10:37 jkantz: so when using with-local-vars are is closing over the local vars disallowed?

10:37 Chousuke: I think rhickey demonstrated something like that earlier.

10:38 I guess the name makes it a bit simpler :/

10:52 rhickey: cgrand: I'm not promising that derivation (from AFn)

10:53 just an allocation optimization right now

10:54 LordOfTheNoobs: During a break I switched some personal code ( a parser combinator ) to use the lazy branch. The inability to nil pun isn't much fun in `if-let's and recursive function application through nested lazy sequences. :p

10:57 rhickey: LordOfTheNoobs: any examples of changes you had to make that you could paste?

11:00 jayfields: has anyone use clojure to generate JUnit tests? I can't find anything on the web.

11:00 (other than an old edition of Stu's book which has a gen-and-save-class example, but I was looking for something more dynamic)

11:21 gordongecko: how do i throw an exception?

11:21 cooldude127: gordongecko: (throw (Exception. "blah"))

11:22 AWizzArd: It seems gordongecko is about to learn all of Clojure within 1 or 2 days...

11:23 LordOfTheNoobs: rhickey: I was on a break at the time, sorry for the delay. I've github'd the code for the curious. Most `problems` will be easily solved when lazy merges. I'll just code some `if-seq-let` type functions.

11:23 http://github.com/knome/clojure-parser-combinator/blob/39604ab7f0a24f442da1b6ef40caebce544eea9e/parser.clj

11:25 gordongecko: gordongecko is out of jail for inside trading ready to take over the world

11:40 paramond: Hi! Does anybody know how to load a Java class file at the repl? Something like (load-class "MyJavaClass.class")

11:41 Chousuke: paramond: you can't load class files directly, but you can add directories and jars to the classpath

11:41 (doc add-classpath)

11:41 clojurebot: Adds the url (String or URL object) to the classpath per URLClassLoader.addURL; arglists ([url])

11:41 Chousuke: Though I guess that could work for class files directly too :/

11:42 paramond: Thanks, i will try that out.

11:43 cooldude127: is there a way to split a namespace into multiple files?

11:45 jayfields: how do I get an environment variable? (the equivalent of System.getenv("USERNAME"))

11:46 Chousuke: cooldude127: sure; you can just declare the namespace in a master file and use (load-file)

11:46 cooldude127: Chousuke: ok thank you, my file is getting big but i don't want to split the namespace

11:46 Chousuke: cooldude127: load-file is like include I suppose :)

11:48 rhickey: cooldude127: look at the end of core.clj where it loads the proxy/print and genclass stuff

11:48 cooldude127: ok

11:48 Chousuke: jayfields: System/getenv; though apparently that's deprecated.

11:48 cooldude127: how is that deprecated?

11:48 Chousuke: it says in the docs you should instead use properties

11:49 jayfields: thanks

11:49 cooldude127: oh lamer

11:49 *lame

11:49 Chousuke: well, it's more portable I guess.

11:49 cooldude127: eh, since when does java care about portability ;)

11:49 Chousuke: :P

11:52 shoover: paramond: you will need your class's directory on the classpath and then call import to get the class. at the REPL: (import '(my.package MyJavaClass)), where the parent of directory my/package is on the cp

12:08 paramond: shoover: should i left my.package out if i didn't declare MyJavaClass in a package?

12:09 Chousuke: paramond: you need to declare it in a package I think

12:10 paramond: paramond: but isn't there something like an unnamed package in java?

12:10 shoover: but isn't there something like an unnamed package in java?

12:13 kotarak: which is discouraged to be used in java land....

12:14 paramond: of course

12:14 duck1123: Won't it end up in some default package? like 'user or some such.

12:14 or is that only in a repl

12:14 nsinghal: I have classpath with "classes" and "src" directory of a java project in that order. When i do (require :reload-all 'org.cc.file) - it is not reevaluating the changed clj file. If i delete the classes files (file__init.class) than the new clj is getting loaded.

12:15 gordongecko: java.lang.IllegalStateException: No transaction running (NO_SOURCE_FILE:0)

12:15 why not?

12:15 duck1123: is the clj file newer than the classes?

12:16 nsinghal: yes

12:16 kotarak: nsinghal: this is a known issue.

12:16 cooldude127: gordongecko: if you're doing something that needs a transaction, you probably need to wrap it in (dosync ...)

12:17 nsinghal: kotarak: thanks. is it being considered for fix?

12:17 kotarak: nsinghal: it's in the tracker: http://code.google.com/p/clojure/issues/detail?id=38

12:19 nsinghal: so that tracker mainly consists of issues approved by rhickey it's probably fix at some point.

12:19 nsinghal: kotarak: thanks again. i will keep an eye on it

12:19 * kotarak signs up for another english course -.-

12:22 * durka42 thinks kotarak's english is pretty good

12:22 kotarak: But probably not after a working day...

12:24 gordongecko: if im nesting 3 for loops fo i need to dorun on all?

12:25 kotarak: gordongecko: for is not a loop. If you do this for side effects use doseq

12:26 gordongecko: if you are interested in the results and still need side-effects, wrap the for in a doall.

12:27 Chousuke: does doall realise the seqs recursively?

12:27 for somewhat unfortunate naming; but if you ask me, it's C that uses the name "for" wrong :P

12:27 kotarak: hehe

12:28 gnuvince: Chousuke: more succinctly: C is wrong.

12:28 ;)

12:28 kotarak: gordongecko: do you have some code?

12:28 Chousuke: nah

12:28 kotarak: lisppaste8: url

12:28 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

12:28 Chousuke: C is nice.

12:28 C++ is wrong :(

12:28 kotarak: here's a place to put it. Looking at an example might help to help you.

12:29 gnuvince: Chousuke: I guess that's subjective, but there are a lot of things wrong with C.

12:30 Chousuke: Well, yeah

12:30 replaca: C is a very nice portable assembly language

12:30 Chousuke: but if you keep it simple, it does the job it's supposed to.

12:30 kotarak: Chousuke: I think it depends on how the for's are nested. if the inner for produces a seq for the outer for it's evaluated I think. If the outer for generates a seq containing the inner for as elements....

12:32 lisppaste8: gekko pasted "sideeffecting problem" at http://paste.lisp.org/display/74798

12:32 gekko annotated #74798 with "untitled" at http://paste.lisp.org/display/74798#1

12:32 kotarak: gordongecko: you want doseq instead of for

12:33 Chousuke: using a ref like that looks wrong.

12:33 gordongecko: anyone could take a look at that? i thnk imdoing the same as the java-code

12:33 Chousuke: it's simulating mutation; you need to figure out a more functional way to do it.

12:34 gordongecko: yes but it should work anyway right?

12:34 kotarak: gordongecko: as I wrote, you want doseq instead of for

12:35 gordongecko: yes i mgihtn want that but what im saying it should work like this too no?

12:36 Chousuke: it should, I guess.

12:36 assuming assoc-inc is just a typo in the paste :)

12:37 but that's really not a good way of doing it.

12:39 lisppaste8: gekko annotated #74798 with "untitled" at http://paste.lisp.org/display/74798#2

12:39 gordongecko: http://paste.lisp.org/display/74798#2

12:39 assoc-inc is my own fucntion

12:40 kotarak: gordongecko: I suspect get-at also

12:41 cooldude127: gordongecko: funny, i'm also working matrices in clojure :)

12:41 except it's all functional. no refs or any mutation at all

12:42 gordongecko: im only using mutation here

12:42 i wrote the damn thing in haskell first

12:42 worked nicely

12:43 u know there is colt(java lib) for hardcore matrix stuff right?

12:43 both sparse and dense

12:43 cooldude127: no i didn't, but part of the reason i'm writing it is educational

12:43 help myself learn the stuff i'm doing in my calc 3 class

12:44 just coded up some really shitty row reduction code

12:44 but i need to go, i'll be back on soon

12:45 gordongecko: calc uni or hs?

12:58 Chousuke: gah, I can never quite remember how matrix multiplication works :(

13:00 I always get confused about the order in which to multiply the component vectors :/

13:09 durka42: doesn't seem like you should need side effects for matrix multiplication

13:21 jbondeson: the more code i write in C# the more i love immutable datatypes

13:21 Nafai: jbondeson: Why do you say that? I'm not closely familiar with C#

13:23 jbondeson: just happen to be writing a new datatype and keeping track of data changing is a bitch. soooo much cleaner when your enclosed type can't change.

13:23 gnuvince: Either he uses mutable data structures which cause him endless problems, or he uses immutable data structures which don't give him nearly as many problems.

13:24 Nafai: Heh

13:25 jbondeson: what's really annoying is having to realize that structs and classes are treated so much differently by the CLR, not to mention that sometimes structs are immutable in the BCL, and sometimes mutable.

13:26 makes you want to throw your hands up in despair and just code some more clojure

13:27 cooldude127: jbondeson: clojure is my relief from my data structures class in java

13:27 i wrote a b-tree, then did some clojure code to make me feel better

13:27 jbondeson: heh

13:29 cooldude127: i think i just made myself a lot more productive in emacs by simply switching to the bar cursor instead of a box

13:30 apparently i spent a lot of time wondering what stuff was underneath my cursor

13:30 technomancy: you can't see through it?

13:30 cooldude127: no, i guess my theme doesn't have it that way

13:30 jbondeson: The box is more explicit for me, especially in insert mode

13:30 technomancy: maybe your graphics card doesn't have enough transparency support

13:32 cooldude127: technomancy: i doubt that

13:32 jbondeson: insert mode?

13:33 i used to be able to see through it, not sure when that stopped happening. i like the bar anyway tho

13:41 Lau_of_DK: Good evening gents

13:42 cooldude127: good afternoon lau

13:42 duck1123: I used to use the bar cursor, but I lost it a couple revisions ago when I was cleaning up my .emacs

13:44 cgrand1: good evening Mr of_DK

13:44 Lau_of_DK: :)

13:44 jbondeson: cooldude127: sorry, in emacs it's "Overwrite" mode

13:44 as in after you hit the "INS" key

13:44 cooldude127: jbondeson: oh, that. never used it :)

13:44 duck1123: I've disabled it

13:44 jbondeson: hah

13:45 cooldude127: mac doesn't even have an ins key, so i forgot about it

13:45 jbondeson: i use it for correcting capitalization, which as you can tell my my dislike of the shift key, happens quite a bit

13:45 duck1123: (put 'overwrite-mode 'disabled t)

14:08 jayfields: is there a target date for Clojure 1.0?

14:09 cooldude127: technomancy: wooo! my clojure-update function actually did its job! i just got some updated slime

14:10 gnuvince: cooldude127: what function?

14:10 durka42: slimier than ever!

14:10 danlarkin: jayfields: no

14:10 cooldude127: gnuvince: an emacs function to complement technomancy's clojure-install function

14:10 technomancy: cooldude127: high-five!

14:10 cooldude127: updates your copies of clojure, clojure-contrib, swank-clojure, and slime

14:10 technomancy: I committed it to clojure-mode btw

14:10 gnuvince: nice

14:11 cooldude127: oh and recompiles clojure

14:11 technomancy: cool

14:11 gnuvince: I got a python script to update swank-clojure, slime and clojure-mode and I do clojure and clojure-contrib by hand.

14:11 technomancy: cooldude127: I took out the part that runs ant in clojure-contrib though since I realized it's unnecessary; just add clojure-contrib/src/ to the classpath instead.

14:11 cooldude127: technomancy: does clojure-slime-config take care of that?

14:11 technomancy: yups

14:11 cooldude127: cool

14:12 technomancy: i notice you haven't pushed that yet

14:12 technomancy: cooldude127: not to master, no

14:12 cooldude127: technomancy: installer on github doesn't include it either

14:12 technomancy: oh crap

14:12 you are correct

14:12 done

14:14 cooldude127: technomancy: i think i spot an erro

14:14 r

14:14 (concat clojure-src-root "/clojure-contrib/clojure-contrib/src/")

14:15 why two clojure-contribs?

14:15 i only have one in my checkout

14:15 technomancy: you are right

14:15 cooldude127: wooo i'm on a roll today

14:15 technomancy: that's one way to think of it.

14:15 (the other being that I'm losing it.)

14:15 cooldude127: lol

14:16 technomancy: you are really quick

14:16 technomancy: it's not a hard fix. =)

14:17 cooldude127: true

14:17 technomancy: i was going to ask why clojure-update didn't get an autoload, but then i realized that if you're using clojure-update, you probably already called clojure-slime-config

14:18 technomancy: aye

14:21 cooldude127: technomancy: you killed off the save-window-excursion part tho

14:22 technomancy: cooldude127: oh dang; I was playing around with it and forgot it

14:22 cooldude127: lol

14:22 technomancy: you had it around the compilation part, right?

14:22 cooldude127: yeah

14:22 in the normal case, the update part doesn't need it, they are one-liners

14:22 technomancy: will put that back in

14:22 cooldude127: cool

14:29 got the fix

14:39 BigTom: Where can I get a gentle intro into swank/slime etc?

14:39 I seem to spend all me time lookin for how to do things rather than doing Clojure

14:39 so I'm back to JEdit and a REPL again

14:41 I had more luck with Erlang so I don't think its Emacs (though I stumble around with that to some extent)

14:41 cooldude127: BigTom: what's going wrong for you?

14:42 BigTom: Its not 'going wrong' as such, I just cannot seem to get anything going I'm trying clojure box so It should have installed ok

14:43 cooldude127: BigTom: you on windows i figure if you're doing clojurebox?

14:43 BigTom: yup

14:43 my work machine

14:44 cooldude127: i probably won't be too much help, but technomancy's clojure-mode fork has some good support for installing and setting up clojure and slime. don't think it will work well on windows tho

14:45 BigTom: maybe I'll try it on my linux box

14:45 Once I get over this hump

14:45 cooldude127: well i g2g

14:46 technomancy: BigTom: let me know if it works for you

14:46 BigTom: I have a bad habit of pissing time away on dev environments rather than learning the language so I am being a bit conservative

14:46 technomancy: if you can get it working on w32 I'd take some patches, but I don't think I could help much with it myself

14:46 BigTom: technomancy: thanks

14:46 jbondeson: BigTom: http://www.pchristensen.com/slimecommands.pdf

14:46 technomancy: BigTom: well this should be a single command, so it shouldn't take long to see if it works or not

14:47 BigTom: jbondeson: that looks good

14:48 jbondeson: C-c C-l is the big one, it load and evaluates a file

14:48 C-c C-c evaluates a form

14:48 if you just changed on form

14:49 one thing to realize is that you need to save your file before C-c C-l

14:49 also some of those commands may not be available with swank-clojure

14:52 technomancy: jbondeson: there's another command that just loads w/o prompting you like C-c C-l

14:53 jbondeson: yeah, C-c C-k

14:54 BigTom: ok, I have clojurebox slime running, I have loaded a file and load it (C-c C-l)

14:54 Then I display the REPL

14:54 jbondeson: also, i don't know how clojure-box comes set up, but you can split a window horizontally with C-x 3, and vertically with C-x 2

14:55 BigTom: how do I get the REPL to execute? It just gives me a new line.

14:55 jbondeson: depending if you have a namespace defined, you may have to do a (in-ns) at the repl

14:55 * BigTom Thinks, do I sound whiney?

14:55 jbondeson: you're not getting results?

14:56 BigTom: no, just working my way down the REPL

14:58 jbondeson: when you type in a form it's not displaying the results?

14:58 BigTom: nope

14:58 jbondeson: o_O

14:58 what does your repl say?

14:59 BigTom: A new 'unloaded' REPL works

14:59 jbondeson: I'm not quite following you.

15:00 BigTom: Does clojurebox have its own Clojure.jar?

15:00 jbondeson: I believe clojure-box comes with a clojure.jar and clojure-contrib.jar

15:01 * jbondeson doesn't use clojure-box, however

15:01 BigTom: jbondeson: First time round the REPL was a bit dead, seems healthier now

15:01 (after restart)

15:01 I am going to have to replace the clojure jars, I need the new watchers

15:02 jbondeson: you can open up the .emacs file and change the location

15:02 BigTom: jbondeson: Ah, thanks

15:02 shoover: BigTom: how old is your clojure box? the one on the site matches clojure svn r1235

15:03 BigTom: shoover, I think I grabbed it a couple of days back

15:03 jbondson: I take it I need my own .emacs, I don't have one yet, hang on

15:04 shoover: I would recommend grabbing again. I just uploaded yesterday

15:04 BigTom: ah, will do

15:04 shoover: you don't need .emacs. clojure box handles the initialization. but if you do have .emacs, it could mess up clojure box

15:04 (if you change settings it wants a certain way)

15:04 hiredman: hmmm

15:05 someone renamed the google map

15:05 BigTom: shoover: ok

15:05 jbondeson: BigTom: Sorry, I thought it simply came with a preconfigured .emacs file.

15:05 hiredman: the clojure google map has been renamed to "William Hidden"

15:05 shoover: it comes with a preconfigured default.el in the site-start directory

15:05 BigTom: shoover: I got it from bighugh, is that the right place?

15:06 shoover: BigTom: yes

15:06 * hiredman renames it to Clojure

15:06 shoover: hiredman: I don't blame that person... adding a point is hard to figure out

15:06 hiredman: yeah

15:07 * BigTom is busy for 5 minutes

15:18 BigTom: shoover: Hi again

15:18 shoover: and?

15:19 BigTom: shoover: I have the latest and it compiles stuff and the REPL works out of the box

15:20 shoover: good

15:20 BigTom: The current problem is that I cannot run expressions from a file I have loaded (Unable to resolve symbol)

15:20 shoover: hmm, I just did a C-c C-l on fnparse and it resolved ok

15:20 cooldude127: BigTom: using clojurebox?

15:20 BigTom: how do I sort the classpath out?

15:21 cooldudel27: yes

15:21 hiredman: does the file declare a namespace at the top? are you in the namespace declared by the file?

15:21 cooldude127: oh

15:21 BigTom: hiredman: yes

15:21 hiredman: yes to both?

15:22 BigTom: clojurebox and namespace in file

15:22 filename euler.clj namespace euler

15:22 cooldude127: BigTom: and it does (ns euler) at the top?

15:23 BigTom: coldudel27: yes (ns euler)

15:23 cooldude127: hmm

15:23 BigTom: how do I work out "where" the REPL thinks it is?

15:24 shoover: run ProcMon :)

15:24 Chousuke: hmm

15:24 there was some java property

15:24 maybe user.dir

15:25 cooldude127: BigTom: like what directory?

15:25 cuz that shouldn't matter in this case

15:25 BigTom: cooldudel27: ok, thanks, so the file location doesn't matter?

15:26 shoover: I can access symbols with a namespace-qualified name, but I can't use or require the namespace

15:27 BigTom: everything I do with my code gets ; Evaluation aborted

15:27 shoover: BigTom: how are you trying to access the symbols from the loaded file? use? require? fully-qualified?

15:28 hiredman: clojurebot: what do you think of emacs?

15:28 clojurebot: "Learning Emacs and SLIME was just about the most painful computer experience I've ever been through."

15:28 BigTom: I've tried (use 'euler) and (euler-euler-1 100)

15:28 shoover: euler/euler-1

15:29 cooldude127: yeah

15:29 BigTom: I mean(euler.euler-1 1--)

15:29 shoover: use a /

15:29 or you can (do (refer 'euler) (euler-1 100))

15:29 BigTom: shoover: Doh!

15:29 Ariens: clojurebot: what do you think of textmate?

15:29 clojurebot: Huh?

15:29 BigTom: (euler/euler-1 100) worked

15:29 hiredman: ,(.codePointAt "..." 0)

15:29 clojurebot: 8230

15:30 shoover: for use and require, you will have to (add-classpath "file:///path/to/eulers/parent")

15:30 cooldude127: BigTom: apparently you just had the wrong namespace separator

15:30 hiredman: clojurebot: how about that add-classpath?

15:30 clojurebot: classpath is (System/getProperty "java.class.path")

15:30 hiredman: clojurebot: add-classpath?

15:30 clojurebot: add-classpath is bad, avoid it. I mean it!

15:30 shoover: clojurebot: why?

15:30 clojurebot: why not?

15:30 BigTom: cooldudel27: at the end, I think the add-classpath will be the trick

15:31 hiredman: is that bad then?

15:31 hiredman: BigTom: it is unreliable

15:31 cooldude127: BigTom: but really, if this is your own code, with slime you just load the file with your code, and run C-c C-k which compiles all your code into the repl

15:31 i've never once used add-classpath

15:33 BigTom: cooldude127: How do you invoke your expressions?

15:34 cooldude127: BigTom: when i first load slime, i run C-c C-k to load a file for the first time. after that, when i change a function, i run C-c C-c to compile just that function (or macro or any other toplevel expression)

15:35 BigTom: cooldude127: when you are testing them do you call them from the REPL with fully qualified names?

15:36 shoover: BigTom: try (refer 'euler). Normally that would be done as part of the ns at the top, but from the REPL refer should work after C-c C-k

15:36 cooldude127: BigTom: no, i usually change into the namespace they are in with ,!p

15:36 comma performs slime commands

15:36 !p is an abbreviation for change-package

15:37 BigTom: cooldude127: that got it, thanks

15:37 cooldude127: cool

15:37 BigTom: cooldude127: when yoy say it would normally be done as part of the ns, am I missing something?

15:37 cooldude127: in my code?

15:38 cooldude127: well shoover said that, but he means in code, you wouldn't use (refer blah), as that would be done in your (ns) declaration at the top. but for the repl, you don't have one, so (refer) is ok

15:39 BigTom: cooldude127: thnaks

15:39 cooldude127: no problem

15:39 technomancy: you can call ns in the repl

15:39 BigTom: One last question, if I want to load a load of dependent jars (I am playing with compojure) what is the most convenient way?

15:39 technomancy: but if you'd rather not; yeah just call use or refer etc.

15:40 cooldude127: technomancy: you can, but it's usually easier to use the others if you're just messing around in user

15:40 technomancy: BigTom: I add them to swank-clojure-extra-classpaths before launching slime

15:40 cooldude127: BigTom: configure swank-clojure-extra-jars

15:40 BigTom: listen to technomancy, i was guessing

15:41 technomancy: cooldude127: the advantage of running IRC in Emacs is you can type swank-clojure- followed by M-/, and it will autocomplete from all loaded lisp symbols. =)

15:42 cooldude127: technomancy: you're right, the thought to do that didn't even occur to me :)

15:42 BigTom: technomancy: that's in swank-clojure.el?

15:42 cooldude127: yes

15:42 technomancy: it's called intelligence augmentation. =) some of us need a little more help than others.

15:43 cooldude127: technomancy: apparently today you do ;)

15:43 technomancy: "I'm not... normally like this..."

15:43 cooldude127: lol

15:43 i have my own problems today

15:43 BigTom: And on that note I will go and do family stuff

15:43 cooldude127: i have no idea why my code to compute matrix inverses isn't correct, but i do know it's wrong

15:44 BigTom: Thanks everyone for all the help

15:44 cooldude127: no problem

15:44 shoover: BigTom: you're welcome. Read the README.rtf in c:\program files\clojure box for how to customize that variable

15:45 jbondeson: cooldude127: because computing the inverse of matricies is friggin' evil.

15:45 ayrnieu: really? I don't know how anyone could find http://mathworld.wolfram.com/MatrixInverse.html unclear.

15:46 cooldude127: jbondeson: i have two ways of doing them, and one of them is very wrong for anything more than 3x3

15:46 but then apparently that method doesn't work for that

15:47 which i didn't know

15:47 jbondeson: anything over 3x3 (which mean 99.999% of the time) needs to use more advanced linear algebraic methods.

15:48 friggin' LU Decomposition

15:48 cooldude127: jbondeson: i have LU sort of working

15:48 it doesn't handle the bad cases well tho

15:48 0's kind of trip it up

15:49 stupid row reduction

15:50 ryszard_szopa: I already know add-classpath is evil. Can anybody explain me why? (apart from the fact that it doesn't seem to work;))

15:50 cooldude127: ryszard_szopa: that's probably it

15:50 jbondeson: that would probably be a good reason it's evil...

15:51 ryszard_szopa: well, I guessed that if that was it I would see people complaining and other fixing stuff...

15:52 *other people

15:52 cooldude127: ryszard_szopa: naw, we just ignore it

15:52 pretend it's not there ;)

15:54 jbondeson: it's useful at the repl, but otherwise should be treated like a leper at a party: kept away from the chip bowl

15:55 technomancy: ryszard_szopa: apparently the JVM makes it impossible to implement correctly

15:55 I think that's the Official Story

15:55 even though somehow JRuby manages it...

15:55 jbondeson: ruby involves deep magic... best not dwell upon it

15:56 cooldude127: i believe the underlying philosophy of ruby is magic

15:57 technomancy: the underlying philosophy of Ruby is "you can do it at runtime"... which can often mean magic. =)

15:57 cooldude127: lol

15:57 hiredman: jruby most likely has more layers of indirection between it and the jvm, so it has room to shuffle stuff around

15:58 ryszard_szopa: well, I know next to nothing about Java (I have mainly Common Lisp and Python experience), and being able to poke around and see how some Java libraries work would probably help me a lot.

15:58 technomancy: whereas with Java it's like, "What do you mean you don't know your classpath at boot time? Haven't you held the requisite planning meetings to decide what jars you're going to use?"

15:58 jbondeson: it still kills me that ruby on the jvm is faster in many cases than ruby on it's own vm

15:58 technomancy: jbondeson: that was true two days ago... =)

15:58 cooldude127: technomancy: lol

15:58 technomancy: jbondeson: before Ruby had its own VM. now with its own VM it's usually faster than JRuby

15:59 ryszard_szopa: the present implementation of add-classpath is around 6 lines long

15:59 do you think it is really that hard to fix?

15:59 hiredman: the jvm is pretty cool and my respect for all the tools in the java runtime grows and grows

15:59 jbondeson: technomancy: ruby: when you're starting to look bad, make some breaking change that'll slow down the opposition?

16:00 technomancy: hehe

16:00 hiredman: ryszard_szopa: it doesn't seem to bother people enough to try and fix it

16:02 jbondeson: i just avoid the whole problem by rolling one nice big jar with clojure and contrib in it (for my own stuff, no distribution)

16:03 kotarak: clojurebot: macro

16:03 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

16:08 ryszard_szopa: OK, so how can I check what is the current classpath, ie. if add-class has worked?

16:08 ayrnieu: ,(System/getProperty "java.class.path")

16:08 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)

16:08 ryszard_szopa: (. System (getProperty "java.class.path")) seems to show me what was specified at the command line

16:09 technomancy: ayrnieu: that only gives you the boot classpath

16:09 ryszard_szopa: AFAIK there's no way to get anything other than the boot classpath

16:09 sad but true

16:10 ryszard_szopa: technomancy: does this mean there's no way of checking if add-classpath has succeeded?

16:10 technomancy: ryszard_szopa: apart from trying an "import" and seeing if it fails, no

16:11 ryszard_szopa: it sucks to maintain your classpath list manually... the best I've been able to come up with is to have a jars directory and construct your classpath dynamically from its contents.

16:11 but AFAIK there's no getting around restarting the JVM. which is sad.

16:11 ayrnieu: the jars directory is what I do. CLASSPATH is not unlike C's LD_LIBRARY_PATH , ldconfig , etc.

16:12 technomancy: I've fought this fight... it's not worth it. accept the annoyance and move on; you'll have more fun.

16:12 ayrnieu: it's just that the small bit of architecturing you have to do for CLASSPATH, your OS already does for C.

16:12 and perhaps your expectations are higher. Of *course* C doesn't let you switch between clojure-trunk and clojure-lazy at runtime.

16:13 technomancy: ayrnieu: I've been spoiled by other lisps.

16:13 Raynes: Is there a function to get Console input in Clojure?

16:13 ryszard_szopa: does writing a shell script to maintain a sane classpath count as fighting the system? ;-)

16:13 ayrnieu: well, let the advantages of jars spoil these other lisps for you in other respects :-) Then you'll be too bitter to use anything.

16:13 technomancy: ryszard_szopa: btw, I *think* the problems with add-classpath only apply to jars that contain java... it might be fine to use it with directories full of clj files.

16:14 ryszard_szopa: and, are there any drawbacks of having a large classpath?

16:14 rhickey: technomancy: do you know about java.ext.dirs?

16:14 durka42: ,(.. clojure.lang.RT getRootClassLoader getURLs)

16:14 clojurebot: #<URL[] [Ljava.net.URL;@77a748>

16:14 durka42: ,(map prn (.. clojure.lang.RT getRootClassLoader getURLs))

16:14 clojurebot: nil

16:14 durka42: the above is not a stable API

16:14 technomancy: ryszard_szopa: as long as your shell script doesn't enumerate each jar but builds it up from a glob, I'd say you're good

16:14 durka42: but that is where add-classpaths go

16:14 ayrnieu: ryszard, I have eight lines of CLASSPATH in my ~/.zshrc, and three add every .jar in a specific directory to it. I also have a Makefile that I say 'make lazy' 'make trunk' to, to swap out .jars

16:15 technomancy: rhickey: have read about it but haven't used it yet. does it allow you to add in a jar after the JVM has booted?

16:15 vs building a static list at boot time

16:16 AWizzArd: where again can I find the roadmap for Clojure?

16:17 ayrnieu: java -Djava.ext.dirs=/directory/of/jars ...

16:17 StartsWithK: why not java -cp "lib/*" clojure.lang.Repl

16:18 loads all jars under lib/

16:18 durka42: so only specifically mentioned (or globbed) jars are added to the classpath, but everything in the extdirs?

16:18 technomancy: StartsWithK: right, but you can't add anything after you've booted

16:19 if java.ext.dirs allows for that, then that would pretty much take care of my issues

16:19 it's a little inside-out from what I'm used to, but it'd still allow for what you need.

16:21 Chouser: I think people have had some issues with java.ext.dirs. something about it being meant for extensions (native libs?) not regular .jars.

16:22 rhickey: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html#deployment

16:23 ryszard_szopa: ayrnieu: do you think that generating my classpath with something like `mdfind -onlyin /usr/ "kind:jar"` would be overkill? ;-)

16:24 rhickey: Chouser: I think it is specifically for the kind of "installed on my machine" use you always wanted

16:24 with a single indirection

16:24 vs a true global install

16:31 Chouser: This is the message I was thinking of: http://groups.google.com/group/clojure/msg/7f0c9775ba70d169

16:32 or perhaps this one: http://groups.google.com/group/clojure/msg/f65dd874f779b15c

16:32 in which case the only issue may be if your OS is already assuming (or has set) a java.ext.dir for you.

16:33 in which case it might be better to simply install your jars there instead of resetting java.ext.dir

16:43 hiredman: does import not work with classes in jars added with add-classpath?

17:01 lisppaste8: ryszard_szopa pasted "memfn for static methods?" at http://paste.lisp.org/display/74820

17:01 ryszard_szopa: is there something like memfn for static methods?

17:03 Chouser: ryszard_szopa: that last example is what I always do

17:06 ryszard_szopa: Chouser: well, it works, but somehow it doesn't seem "right". otoh from the character count point of view #(Foo/bar %) may be optimal...

17:08 Chouser: I think it should be possible for the compiler to recognize a static method reference in a value position and generate a little fn wrapper on the fly.

17:08 dunno if rhickey would take a patch for that or not.

17:08 hm, seems plausible that it could even recognize the .foo syntax and write #(.foo %) for you, though I guess that's a rather less common scenario

17:10 Chousuke: I think he mentioned possibly auto-memfn:ing java methods in value position once.

17:12 Chouser: http://clojure-log.n01se.net/date/2008-11-19.html#21:00a-21:04

17:16 rhickey: Chouser: the problem with the auto-memfning is overloads, once you need to distinguish #() wins

17:19 Chouser: arity overloading, right?

17:19 durka42: couldn't overloads be handled as normal?

17:20 ,(map #(Math/ulp %) [(float 1.23) (double 1.23)])

17:20 clojurebot: (1.1920929E-7 2.220446049250313E-16)

17:20 Chouser: because it's unlikely that you'd be able to avoid reflection anyway

17:23 rhickey: Chouser: you can type-hint %

17:23 Chouser: right, but you'd have to do it explicitly on the arg.

17:23 rhickey: ?

17:23 user=> (set! *warn-on-reflection* true)

17:23 true

17:23 user=> #(Math/ulp %)

17:23 Reflection warning, line: 9 - call to ulp can't be resolved.

17:23 #<user$eval__29$fn__31 user$eval__29$fn__31@2db45934>

17:23 user=> #(Math/ulp (float %))

17:24 #<user$eval__36$fn__38 user$eval__36$fn__38@7be4d80b>

17:24 Chouser: the compiler's not going to infer the type for the arg based on the seq passed to 'map', for example.

17:24 rhickey: that doesn't mean reflection is unavoidable

17:25 you can pick the overload with the type hint

17:25 Chouser: yes, I was too vague

17:27 I just meant that #(Math/ulp %) by itself would use reflection. You have to add something to that expression itself to avoid the reflection.

17:28 So is the occasional need for #(Math/ulp (float %)) a good enough reason to never allow Math/ulp by itself?

17:29 rhickey: Chouser: I came to that conclusion

17:30 putting in un-hintable reflective sugar seems a false benefit

17:30 I guess the sugar could reject type-overloaded methods

17:30 Chouser: even if someone else wrote the patch for you? :-)

17:31 rhickey: will the patch author answer all 'how do I speed up (map Math/udp ...) questions? :)

17:32 I had worked on this, including gen-class style Math/udp-float discrimination syntax

17:33 Chouser: oh. ew.

17:33 rhickey: well, without that or a prohibition on type-overloaded methods I think it's a non-starter

17:34 Chouser: It seems to me the transition from Math/ulp to #(Math/ulp (float %)) is not that much bigger a hurdle than from #(Math/ulp)

17:34 rhickey: by the time you are mapping a method you are atthe point where you are calling it often enough to care about the reflection costs

17:34 Chouser: either way you have to be thinking about reflection and type hints

17:35 rhickey: maybe so

17:35 Chouser: But (map Integer. (line-seq my-file)) is so pretty.

17:35 rhickey: #(Math/ulp #^Float %) works too, less of a change if you were doing #(Math/ulp %) already

17:36 Chouser: I agree completely about the prettiness, but there are limits to pretending a thing (method) is something it's not (a fn)

17:36 * Chouser nods

17:37 rhickey: I just though it would encourage a lot of inefficiency, and that seems to be a focus of the community right now, for better or worse

17:38 Chouser: Yeah, I don't know if it's for better or worse, esp. in the long run. But it's a mismatch with my personal interests, so I'm occasionally annoyed by it.

17:39 rhickey: yeah, certainly the microbenchmarks are tiresome

17:39 hiredman: :(

17:40 Chouser: the only performance metric that I'm at *all* unhappy with is startup time, and I think that's been addressed as much as possible.

17:40 I intend to play with nailgun at some point and see how that feels.

17:40 rhickey: so, while you may say ew at Math/udp-float, it makes the construct hintable. Alternatives for that would be welcome too

17:41 hiredman: Chouser: the solution to that is, start once and run forever

17:41 rhickey: disallowing type-overloaded methods would disallow many methods

17:41 Chouser: Hints already strike me as a (sometimes) necessary evil. I don't mind the extra #(%) noise if I'm also going to have type-hint noise.

17:42 rhickey: It's one thing to adorn what you've already got, another to have to switch constructs

17:42 * Chouser nods, shrugs, and goes back to poking at a conditions/restarts port.

17:43 rhickey: you are giving up too easily

17:44 Chouser: it's 5 characters. If they weren't all puncutation I would have given up sooner.

17:44 rhickey: :)

17:45 * danlarkin perks up at the mention of conditions/restarts

17:45 * durka42 too

17:45 Chouser: still no pricing up on ILC 2009. I can't decide if it's worth the trip out there.

17:45 ayrnieu: translating Java to Clojure, I like the hints for documentation. I actually do a lot of "what *type* is this?!" reading Java; it helps to cache the lookups.

17:46 rhickey: Chouser: are you using exceptions for conditions?

17:46 I had conditions in an early prototype of Clojure

17:46 but exceptions are the only non-local flow control, and user catches can interfere

17:47 still, I had to use them for transactions

17:47 Chouser: rhickey: well, I don't think I'm going to do a straight port, but yeah I have to use exceptions in some places.

17:48 I'm reading about CL's system, trying to make sure I at least have an excuse for any features I leave out.

17:49 rhickey: Chouser: fwiw, I used exception (actually Error) object identity for handler matches, custom derive your own Error type and neuter fillInStackTrace

17:50 Chouser: why neuter fillInStackTrace?

17:50 hiredman: performance?

17:50 ryszard_szopa: rhickey: do you plan to make to make Clojure more Java (as in Java-the-language, not Java-the-vm-and-platform) independent in the future? Most of the time I spent learning Clojure consisted of reading about Java :-)

17:50 rhickey: because it's a huge overhead you don't need

17:50 Chouser: ah. hm.

17:51 rhickey: Chouser: it's a standard technique when using exceptions for flow control

17:51 hiredman: there was something on reddit yesterday about exceptions that mentioned it

17:51 Chouser: well, my #1 goal is a simple compile-free way to "throw" and "catch" custom "exceptions"

17:52 ayrnieu: hiredman - this? http://www.reddit.com/r/programming/comments/7u3jc/languages_on_the_jvm_can_implement_nonlocal/

17:52 hiredman: ayrnieu: looks like it

17:52 rhickey: Chouser: really, that's all?

17:52 Chouser: but once starting down that road it seems a shame to leave out any useful features from CL's condition system, at least the ones that anyone ever uses.

17:52 rhickey: yeah, I don't know CL well enough to have any larger ambitions

17:52 :-)

17:53 durka42: wait, what do you mean compile-free

17:53 ayrnieu: Chouser, you could a variant of 'try' that rethrows the type of exception that you use for this other purpose.

17:53 rhickey: The main point of conditions is to allow code to intervene before the stack unwinds

17:53 Chouser: yes, and I've got that already

17:53 no Exceptions needed

17:53 hiredman: durka42: no need to gen-class and (compile ...)

17:53 Chouser: http://paste.lisp.org/display/72867

17:54 durka42: yeah, what hiredman said

17:54 but if you want to restart anywhere other than the lowest level, or not restart at all, then I don't see how to avoid an Exception.

17:54 Raynes: read-line if broke in whatever version of Clojure Programming Clojure's sample code is using.

17:56 ayrnieu: Raynes, where do you see read-line ? I don't see it in the book or in the sample code.

17:56 gnuvince_: ,(/ 25000 365)

17:56 clojurebot: 5000/73

17:56 gnuvince_: ,(double (/ 25000 365))

17:56 clojurebot: 68.4931506849315

17:56 Raynes: ayrnieu: I was using read-line, with his version. It's not in the book.

17:56 hiredman: clojurebot: clojurebot is also like life: you make trade-offs

17:56 clojurebot: Ack. Ack.

17:56 Raynes: Also, *is in my previous statment.

17:57 hiredman: ugh

17:57 stupid completeion

17:57 Raynes: statement*

17:57 -.-

17:57 hiredman: clojurebot: clojure is also like life: you make trade-offs

17:57 clojurebot: Ik begrijp

17:58 danlarkin: Raynes: testbuttsecks.clj? jeez...

18:00 Raynes: danlarkin: :| You try to think of a namespace name at 2 am after being awake for 36 hours :|

18:01 ayrnieu: just go with 'no namespace'.

18:01 Raynes: The file name is main.clj, the package is testbuttsecks

18:01 danlarkin: Raynes: :) nah I don't blame you, I'm still nameless for a project I've been working on for a few weeks

18:01 technomancy: I bet *that*'s awkward.

18:01 ayrnieu: clojurebot: jure words

18:01 clojurebot: http://gist.github.com/54847

18:01 technomancy: oh no, please no. =)

18:02 we have enough *jure projects already

18:02 except injure. that would be awesome.

18:03 hiredman: clojurebot: Xiphojura?

18:03 clojurebot: 2009:Jan:29:16:03:17 <hiredman> I call Xiphojura

18:03 danlarkin: hahaha oh man

18:03 inure

18:03 injure rather

18:03 that's the only acceptable -jure name

18:03 durka42: antipleajure

18:04 seijure

18:04 that's enough of that i think

18:04 Raynes: Heh, you should see the Haskell project names :|

18:04 They all start with an H :|

18:05 technomancy: ruby projects all started with R until about 2005

18:06 danlarkin: oh it's the same with everything, kde/gnome were all k--- and g---

18:07 technomancy: I think a language outgrows that after a while. Hopefully with Clojure it can happen sooner rather than later.

18:07 duck1123: what do you think of a clojure-based identi.ca clone named indenjure

18:07 ryszard_szopa: suo-jure would be a good name for a project that is *something* in its own right

18:08 duck1123: I wanted to contact the .ar registar to get spec.tacul.ar

18:24 hiredman: clojurebot: two cents is <reply>�

18:24 clojurebot: c'est bon!

18:25 kotarak: clojurebot: this is not a bug

18:25 clojurebot: 'Sea, mhuise.

18:26 hiredman: ,0800

18:26 clojurebot: Eval-in-box threw an exception:Invalid number: 0800

18:26 hiredman: ,0700

18:26 clojurebot: 448

18:26 hiredman: weird, yes?

18:27 Chouser: what's wierd?

18:28 weird

18:28 danlarkin: hiredman: prefixing a number with 0 means octal

18:29 hiredman: oh

18:29 of course

18:39 danlarkin: Chouser: I came to the conclusion that clojure-json does belong in contrib. Or rather that contrib should have a good json library.. which it does, certainly, just that clojure-json has a few more features, but stephen's version is so much simpler, so I donno

18:41 Chouser: hm...

18:42 have you talked to him about it at all?

18:42 danlarkin: no I haven't

18:43 probably should :)

18:44 ozy`: what's the word on efforts to get clojure featured in a hip new anime?

18:45 you know, to compete with common lisp

18:45 technomancy: ozy`: there was talk of using it to replace VB for creating a GUI to track IP addresses...

18:46 danlarkin: technomancy: re: IP GUI: I'm all over that

18:46 hiredman: the first gui stuff I did with clojure was making a fake "TCP Flow Control Panel"

18:48 ozy`: technomancy: "serial experiments lain" was a -bit- more tech-savvy than CSI ;)

18:49 I would like to make one of those interfaces where you type random keys into a window and it displays random lines and circles all over the screen

18:49 that would be a neat prop to confuse my friends with

18:49 * technomancy watched Hackers last week. we should make a 3D hacking gui with stuff whizzing by

18:50 hiredman: ozy`: I think that is called "unicode font browser"

18:50 ,(char 3424)

18:50 clojurebot: \?

18:50 hiredman: hmm

18:50 ozy`: hiredman: well played....

18:52 hiredman: ,(char 1342)

18:52 clojurebot: \?

18:52 hiredman: hmm

18:53 ozy`: technomancy: played Uplink recently? that's an even niftier hacking GUI... you could remake that with 3D graphics and it would be a blast

18:53 :p

18:53 ,(char 1492)

18:53 clojurebot: \?

18:53 hiredman: ,(char 1111)

18:53 clojurebot: \?

18:54 hiredman: ,(char 911)

18:54 clojurebot: \?

18:54 ryszard_szopa: ,(char 666)

18:54 clojurebot: \?

18:54 mudphone: technomancy: we'll probably need angelina jolie to help out too.

18:54 ayrnieu: that character does not warrant its code.

18:55 ryszard_szopa: ,(char 777)

18:55 clojurebot: \?

18:55 ozy`: ,(map char (range 666 700))

18:55 clojurebot: (\? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \? \� \�� \?)

18:56 Hun: oh noes. my unicode font has a hole

18:56 ryszard_szopa: well, apparently phonetics is evil

18:57 Chousuke: regarding the technical realism in CSI... didn't they use photo manipulation in one episode to look behind a corner or something? /:

18:57 I think that's awesome.

18:57 ozy`: yeah, I hear they do that on a regular basis

18:57 Hun: blade runner did that first

18:57 hiredman: infinite resolution security cameras

18:57 ozy`: but with blade runner he was looking under the edge of a framed photo, wasn't he?

18:57 Hun: numb3rs had some steganography a while ago

18:58 they hid text in jpgs

18:58 ayrnieu: ,(java.util.Date. (long (* 1000 1234567890)))

18:58 clojurebot: #<Date Fri Feb 13 15:31:30 PST 2009>

18:58 Chousuke: or getting the face of the attacker from the reflection in the victim's eye.

18:58 ozy`: D:

18:58 Chousuke: though that's almost believable.

18:58 Hun: and the cooldudes found it by zooming infinity plus one times in to read it

18:59 ergo zoom a single black pixel to make it become a tiny `o'

18:59 ozy`: I think it was 24 (didn't see it, only heard about it) where someone takes a guard's picture, magnifies it in a copier, and holds it up to a retina scanner to get through a oor

18:59 *door

18:59 Hun: awesome. i need one of those xeroxen

18:59 Chousuke: heheh

19:00 technomancy: you sure that wasn't Space Quest IV?

19:00 Chousuke: see, unreal computer tech in movies is a GOOD thing.

19:00 endless source of amusement.

19:00 ozy`: Chousuke: and of "interesting" deadlines from easily amused management... ;)

19:00 Hun: a few years ago in cobra 11 (german police series), the goodguys had a picture of the car of one of the badguys

19:01 but a tree was blocking the sight of the license plate

19:01 so they photoshopped the tree away to read it

19:02 ryszard_szopa: do you think it would be possible in Clojure to have sql queries behave like lazy sequences? So that you could do eg. (drop 5 some-query), and that would return a query like the original but with offset 5?

19:02 danlarkin: Hun: I wish I could do that!

19:03 hiredman: ryszard_szopa: sure, just need someone to write it

19:03 Chousuke: well, hmm

19:03 ozy`: Hun: they should take that to its logical conclusion. some spies need to look inside a safe, so they take a picture from the other side of town and then photoshop it so it shows the room with the safe

19:03 Chousuke: you could write something that executes the query when realised I guess

19:03 hiredman: you have an sql query, that has a custom seq

19:03 ozy`: and then when they have trouble shooping the safe open, someone has to flip a switch from "magic" to "more magic"

19:04 Hun: ozy`: oh yays :)

19:04 ryszard_szopa: hiredman: yeah, but how to implement stuff like filter?

19:05 Hun: ozy`: and they photoshop the case away to see where the single wire to that switch goes

19:05 ryszard_szopa: hiredman: I was thinking of having some map that would get serialized to the argument right after select

19:05 Chousuke: ryszard_szopa: that sounds like you'd be better off creating a DSL with its own filter and drop functions.

19:06 ryszard_szopa: Chousuke: well yeah, but lazy seqs are so cool ;-)

19:06 Chousuke: you could still expose it as a lazy seq I guess.

19:07 I guess it'd be like a resultset-seq; only your DSL would allow you to manipulate the query in a functional style before you execaute it.

19:07 execute*

19:08 implementing such a system doesn't sound trivial though :/

19:09 danlarkin: this is like how django QuerySet objects behave

19:09 ozy`: ants.clj has an internally inconsistent function definition style.... sometimes the docstring is before the arglist, sometimes after

19:09 is there any semantic difference there?

19:10 danlarkin: Model.objects.all()[4:10] is offset 4 limit 10

19:11 Chousuke: danlarkin: does that modify the query itself? :/

19:11 ryszard_szopa: danlarkin: yeah, exactly... but in Python is just enough to implement a __getitem__ method

19:11 danlarkin: Chousuke: yes, django QuerySet objects are lazy

19:11 ryszard_szopa: collections just have first, rest and something else I don't remember

19:11 ayrnieu: ozy, (arglist docstring) is more common across languages, but it doesn't also work with multi-arglist functions.

19:13 I found (docstring arglist) off-putting, but it puts [name list & more] closer to your (name (more (list ...)))'ing code.

19:13 technomancy: yeah, I found the different locations of the docstring kind of weird too

19:14 makes sense why it's necessary though.

19:14 Chousuke: so wait, it works after the arglist in some cases? /:

19:14 technomancy: I have a hard time remembering to do it the clojure way

19:14 Chousuke: I don't think so.

19:14 ozy`: technomancy: looks like rhickey does, too :p

19:15 ayrnieu: (defn foo [] "doc" ...) works, yes.

19:15 ozy`: to be clear: this code is switching back and forth between (defn foo [args] "doc" (only-one-body)) and (defn foo "doc" [args] (still-only-one-body))

19:15 ryszard_szopa: that's kinda funny...

19:16 ayrnieu: you don't have to stick to in-function docstrings, though; you can add the documentation in a later step.

19:16 ryszard_szopa: I guess it would be saner if the lisp/python way didn't work

19:17 oh, but if you do it the docstring-after-args way doc doesn't show the docstring

19:18 ayrnieu: oops.

19:18 technomancy: ryszard_szopa: you can put a string *anywhere* in a function body if you want. =)

19:19 it's just not a docstring

19:20 ozy`: @stuff splices the contents of 'stuff into the current (arg)list, right?

19:21 Chousuke: ,'@x

19:21 clojurebot: (clojure.core/deref x)

19:21 Chousuke: so, no. :)

19:22 ayrnieu: ,`(def x [~@(list 1 2 3)])

19:22 clojurebot: (def clojure.core/x [1 2 3])

19:22 ayrnieu: ,`(def x [~(list 1 2 3)])

19:22 clojurebot: (def clojure.core/x [(1 2 3)])

19:27 ryszard_szopa: technomancy: so the docstring after args way *doesn't* work, after all. so it's sane. :)

19:28 ayrnieu: ,(.setMeta #'+ (assoc (meta #'+) :doc "Returns the sums of nums. (+) should never be used."))

19:28 clojurebot: nil

19:28 ayrnieu: ,(doc +)

19:28 clojurebot: "([] [x] [x y] [x y & more]); Returns the sums of nums. (+) should never be used."

20:11 gnuvince_: Wow

20:11 An operation on 100 files took 188 seconds

20:11 I added a type hint to some of the called functions

20:11 dropped to 60 seconds

20:13 ozy`: see, the static typing people aren't -that- crazy :p

20:13 gnuvince_: Who said they were crazy?

20:14 danlarkin: gnuvince: use (set! *warn-on-reflection* true) to find all places you're having to reflect

20:15 gnuvince_: danlarkin: do I need to put one per file?

20:15 danlarkin: gnuvince_: no

20:15 ayrnieu: you can set it once and then load all of your files.

20:20 gnuvince_: I'm gonna need to find more efficient ways to improve performance

20:29 hmmm

20:29 3 3.89% 23.43% 2216296 304693 sun.reflect.ReflectionFactory.copyMethod

20:30 2.2M calls to copyMethod, is that usual in Clojure?

20:33 darrint: I "need" a loop to call setPosAt in Qt many times. Where do I find how to do that?

20:35 Chouser: dotimes, doseq, loop/recur

20:35 ayrnieu: dorun

20:35 darrint: dotimes looks like what I need. Much thanks.

20:36 Chouser: That's listed here under Looping: http://clojure.org/macros

20:36 sohail: hey how is the Qt interface going? is it still fugly

20:37 darrint: Hope you aren't asking me. It's prettier from here than raw C++. That's all I know.

20:38 Chouser: several people have taken swings at it

20:38 danlarkin: Chouser: pun intended?

20:39 darrint: I'm trying to make Graphics View work. So far so good.

20:39 Chouser: danlarkin: nah, but I'll take it. :-)

20:41 gnuvince_: grrr!

20:45 darrint: "Hello World!" moving diagonally. w00t!

20:46 tomorrow, the world.

20:46 dreish: Was that in Acorn BASIC?

20:46 ayrnieu: (doto world greet conquer)

20:46 dreish: If not, too bad. I love Acorn BASIC.

20:47 Though it might be better with macros.

20:48 ayrnieu: doto: http://paste.lisp.org/display/74762

21:04 darrint: Ok. It there a quick way to get from a vector of some objects to a java array of that object?

21:04 Chouser: (into-array myvector)

21:06 hiredman: that was pretty quick

21:06 darrint: thanks.

21:08 ayrnieu: ,[(into-array Integer/TYPE [1 2]) (into-array [(int 1) (int 2)])]

21:08 clojurebot: [#<int[] [I@15cd9a> #<Integer[] [Ljava.lang.Integer;@145d424>]

21:09 ayrnieu: oh, you don't need the (int %) in the second case. Instead:

21:09 ,(into-array [1 2 "3"])

21:09 clojurebot: java.lang.IllegalArgumentException: array element type mismatch

21:10 Chouser: right, you can't put primitives in a Clojure container.

21:10 hiredman: auto-bbbbbboxing

21:11 ozy`: ,`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`a

21:11 clojurebot: clojure.core/a

21:12 hiredman: I should figure out why clojurebot evals that to clojure.core

21:12 ozy`: ,'a

21:12 clojurebot: a

21:12 ozy`: ,''a

21:12 clojurebot: (quote a)

21:12 Chouser: I think if you run Script, it defaults to clojure.core instead of user

21:12 ayrnieu: clojure.core vs. sandbox, ozy.

21:12 ozy`: ,'~'a

21:12 clojurebot: (clojure.core/unquote (quote a))

21:12 ozy`: weird

21:12 ayrnieu: ,*ns*

21:12 clojurebot: #<Namespace sandbox>

21:12 ayrnieu: ,`~*ns*

21:12 clojurebot: #<Namespace sandbox>

21:13 hiredman: Chouser: I run Repl

21:13 Chouser: hm... oh, new thread?

21:13 ayrnieu: ,::a

21:13 clojurebot: :clojure.core/a

21:13 Chouser: bindings go back to root

21:13 hiredman: yeah, but *ns* is bound to (create-ns 'sandbox)

21:14 ,*ns*

21:14 clojurebot: #<Namespace sandbox>

21:14 Chouser: before you 'read'?

21:14 hiredman: oh, I see

21:14 cp2: does anyone here have experience with lisp while on lsd?

21:17 hiredman: ,~`a

21:17 clojurebot: java.lang.IllegalStateException: Var clojure.core/unquote is unbound.

21:17 hiredman: ,`~`a

21:17 clojurebot: sandbox/a

21:17 hiredman: shaza

21:26 Chouser: hiredman: good job!

21:30 ozy`: cp2: that would be fascinating, I'm sure...

21:30 ,`~`~(exit)

21:30 clojurebot: java.lang.Exception: Unable to resolve symbol: exit in this context

21:33 metaperl: could someone share their .emacs config to use clojure-mode.el?

21:33 is *command-line-args* in the package user?

21:34 ayrnieu: http://paste.lisp.org/display/74008

21:34 ,(var *command-line-args*)

21:34 clojurebot: #'clojure.core/*command-line-args*

21:34 darrint: Is (connect) part of the clojure api?

21:34 cp2: ozy`, i havent done it, but it would be interesting

21:35 i remember the first time i used a computer while using lsd, it seemed like everything made sense

21:35 but of course i didnt remember many details, so meh ;(

21:35 ayrnieu: darrint - no.

21:36 darrint: How can I instrospect on the symbol and figure out where it came from?

21:36 ayrnieu: ,(var *command-line-args*)

21:36 clojurebot: #'clojure.core/*command-line-args*

21:36 ayrnieu: ,(meta (var *command-line-args*))

21:36 clojurebot: {:name *command-line-args*, :macro false, :doc "A sequence of the supplied command line arguments, or nil if\n none were supplied", :ns #<Namespace clojure.core>}

21:37 darrint: thanks

21:37 metaperl: ayrnieu: thank you, however, it appears that slime is under cvs version control - http://common-lisp.net/project/slime/ ... where did you get a git clone?

21:38 ayrnieu: metaperl - I didn't, but see http://github.com/search?q=slime

21:38 metaperl: your .emacs says ; git clone next to your load of slime

21:39 ayrnieu: that isn't mine.

21:39 metaperl: oh :)

21:39 darrint: now I get it.

21:50 lisppaste8: metaperl pasted "(require 'clojure-auto) is failing" at http://paste.lisp.org/display/74844

21:53 ayrnieu: does ~/emacs-contrib/clojure-mode/clojure-auto.el exist?

21:53 hiredman: clojurebot: emacs?

21:53 clojurebot: but I like using notepad++!

21:54 durka42: clojurebot: vim?

21:54 clojurebot: Excuse me?

21:54 ayrnieu: oh, you don't need clojure-auto anyway; you already have the autoloads in your .emacs

21:54 durka42: clojurebot: vim is <reply>Gesundheit!

21:54 clojurebot: Ik begrijp

21:55 darrint: Is there a way to force gc from clojure?

21:55 ayrnieu: ,(System/gc)

21:55 clojurebot: nil

21:55 durka42: i suppose Runtime.getRuntime().gc() would work

21:55 that too

21:55 hiredman: if there is a way from java there is from clojure

21:55 metaperl: ayrnieu: no ... I think that would be generated by the `update-directory-autoloads' function ... which I did not run

21:56 dreish: Occasionally I find microbenchmarks improve after a (System/gc) by more than the time (System/gc) itself took.

21:56 darrint: thanks

21:56 dreish, Occasionally I find that Qt apps hang for several seconds unless I call (System/gc) right after they exit. (maybe...)

21:57 dreish: Ooh. That's unfortunate.

21:57 At least there's a workaround.

21:57 darrint: I just keep putting (do (load-file "testqt.clj") (testqt/hello-graphics-view) (System/gc)) in the repl to test my app.

21:58 Well, got the long hang despite the gc. Mystery remains...

21:58 cooldude127: hey what shell does everybody use?

21:58 dreish: zsh

21:59 Bash has pretty much caught up thought.

21:59 cooldude127: dreish: i'm thinking about switching to zsh

21:59 dreish: s/t\././

21:59 durka42: i use zsh because i read this blog post about how awesome it is, but i haven't really found anything that's incredibly awesome

21:59 dreish: It's nice. I think Bash still only has one of the two =() <() forms.

21:59 durka42: the smarter tab completion is annoying as often as it's helpful

22:00 ayrnieu: I used to like zsh because I thought it cute to put my directory in RPROMPT; nowadays I do nothing special with the shell.

22:01 cooldude127: anyone have a good resource on how to customize zsh?

22:02 dreish: http://www.amazon.com/Bash-Z-Shell-Conquering-Command/dp/1590593766

22:02 ayrnieu: http://www.dotfiles.com/index.php?app_id=4

22:03 lisppaste8: metaperl pasted "java.lang.NoClassDefFoundError: clojure/main" at http://paste.lisp.org/display/74845

22:12 hiredman: ugh

22:13 cooldude127: there are a few websites devoted to sharing .zshrc tips

22:13 cooldude127: http://www.wunjo.org/zsh-git/ this is pretty cool

22:13 hiredman: http://zshwiki.org/home/

22:14 huh

22:15 thats right, there is a zsh channel on freenode

22:16 cooldude127: that sounds right

22:20 holy jesus this is the most informative prompt i've ever seen

22:20 hiredman: :P

22:21 the most important bit is a. hostname completion based ssh's known_hosts b. completiong of remote files for scp and rsync

23:11 metaperl: I'm not sure what the point of running ant was --- the downloaded clojure already had a clojure.jar in it...

23:13 cooldude127: lol

23:27 newb12345: user=> (use '[clojure.contrib.str-utils :onl (str-join)])

23:27 java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: (NO_SOURCE_FILE:0)

23:27 how do I make this work?

23:29 durka42: is clojure-contrib.jar on the classpath?

23:31 newb12345, how did you set up contrib

23:35 cooldude127: newb12345: (System/getProperty "java.class.path") <- what does that give you?

23:35 newb12345: I run it from a dire that contains both clojure.jar and clojure-contrib.jar

23:36 cooldude127: newb12345: that doesn't add them to the classpath

23:36 durka42: in that case make sure the classpath contains "." (the current dir)

23:36 also you should spell :only correctly, but that isn't the error

23:36 cooldude127: durka42: that won't include the jars

23:36 durka42: oh

23:36 meh

23:36 cooldude127: he needs to explicitly specify the jars

23:36 durka42: i need to update smuggler to take note of that

23:37 is there a comprehensive reference on this stuff, along with extdirs

23:39 cooldude127: i don't know one

23:39 this is just built-up experience

23:39 durka42: extdirs is recursive though, yes?

23:39 cooldude127: i have no idea

23:40 * durka42 realizes that this is why it's ok to have recursive symlink loops in the classpath

23:41 newb12345: user=> (System/getProperty "java.class.path")

23:41 "clojure.jar"

23:41 cooldude127: newb12345: there is problem

23:41 durka42: how are you running clojure?

23:41 newb12345: java -jar clojure.jar

23:41 durka42: try:

23:42 java -cp clojure.jar:clojure-contrib.jar -jar clojure.jar

23:42 cooldude127: durka42: i'm not positive, but i think those options conflict

23:43 newb12345: x@x:~/build/clojure$ java -cp clojure.jar:clojure-contrib.jar -jar clojure.jar

23:43 Clojure

23:43 user=> (use '[clojure.contrib.str-utils :only (str-join)])

23:43 java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath: (NO_SOURCE_FILE:0)

23:43 durka42: oh, they do

23:43 java -cp clojure.jar:clojure-contrib.jar clojure.main

23:44 cooldude127: durka42: that one's a winner

23:44 durka42: (they conflict silently... java just ignores the classpath. classy.)

23:44 newb12345: works now

23:44 cooldude127: lol

23:44 newb12345: durka42: thanks

23:45 durka42: in fairness, the behavior is documented on the man page

23:46 cooldude127: durka42: no, that is not enough

23:57 knapr: if id o (let [x (ref a)] ...) and then change x or a, i dont change the other rght?

23:57 any plans on porting clojure to its own vm or to make it selfhosted?

23:58 durka42: as to the second question

23:58 i don't think so

Logging service provided by n01se.net