#clojure log - Apr 10 2009

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

0:28 something: I'm trying to get clojure mode running in emacs. I added (require 'clojure-auto), but I'm getting the following error: File error: Cannot open load file, clojure-auto

0:28 actually I'm using Aquaemacs.

0:30 I don't actually see a file named clojure-auto in the clojure-mode git clone.

1:28 dakrone_hb: ,(size '(1 2 3))

1:28 clojurebot: java.lang.Exception: Unable to resolve symbol: size in this context

1:28 dakrone_hb: ,(len '(1 2 3))

1:28 clojurebot: java.lang.Exception: Unable to resolve symbol: len in this context

1:28 dakrone_hb: ,(length '(1 2 3))

1:28 clojurebot: java.lang.Exception: Unable to resolve symbol: length in this context

1:28 dakrone_hb: bah, what is it...

1:28 slashus2: ,(count '(1 2 3))

1:28 clojurebot: 3

1:29 dakrone_hb: slashus2, that's it! thanks :)

1:37 bradford: suppose i have many key value pairs in a map like this {"open" (rand) "high" (rand) "low"}

1:37 clojurebot: map is *LAZY*

1:37 bradford: and i want a small function to pass a key to and get back a key value pair (i.e. extract that rand bit

1:37 what does that function return?

1:38 hiredman: ,(:open {:open (rand) :high (rand) :low (rand)})

1:38 clojurebot: 0.021964224049019876

1:43 bradford: hiredman, what is the colon doing htere?

1:43 i know - stupid questions, but bear with me :-)

1:43 slashus2: bradford: Makes them keywords.

1:44 Which represent themselves.

1:44 hiredman: http://clojure.org/data_structures#toc8

1:44 clojurebot: keywords?

1:44 clojurebot: excusez-moi

1:44 hiredman: clojurebot: keywords is <reply>http://clojure.org/data_structures#toc8

1:44 clojurebot: Ok.

1:45 bradford: yea, i'm reading about keywords and the reader

1:46 so these keywords evaluate to themselves and have a name, which is the string

1:47 so it is always idiomatic clojrue to use these as keys rather than strings in maps and suhc, correct?

1:47 durka42: yes

1:47 and you can do tricks like calling them as functions (and pass the map in which they are a key)

1:48 bradford: could you give me a simple example of such a trick?

1:48 durka42: what hiredman did

1:48 hiredman: it's what I did with :open

1:48 durka42: of course you can do it the other way

1:48 ,({:a 1 :b2 } :a)

1:48 clojurebot: java.lang.ArrayIndexOutOfBoundsException: 3

1:48 hiredman: ,({:a 1} :a)

1:48 clojurebot: 1

1:48 hiredman: ,(:a {:a 1})

1:48 clojurebot: 1

1:49 hiredman: maps are functions of their keys, keywords are functions of maps

1:49 similar with vectors

1:49 ,([1] 0)

1:49 clojurebot: 1

1:50 bradford: ok, let me try to testate "maps are functions of their keys, keywords are functions of maps" to see if i understand

1:50 clojurebot: maps are functions

1:50 dakrone_hb: can maps contain functions as the values also?

1:50 hiredman: sure

1:51 dakrone_hb: ,({:fn (fn [] (println "foo"))})

1:51 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

1:51 hiredman: or even as keys

1:51 bradford: a key can be used as a function that takes a map and returns the value associated with the key?

1:51 hiredman: ,{:fn (fn [] (println "foo"))}

1:51 clojurebot: {:fn #<sandbox$eval__2222$fn__2224 sandbox$eval__2222$fn__2224@5ba0d9>}

1:51 hiredman: bradford: a keyword can, and so can a symbol, but not any other kind of key you might use

1:52 bradford: right, such as in my initial code when i sued strings

1:52 hiredman: there is also get

1:52 ,(get {:a 1} :a)

1:52 clojurebot: 1

1:52 bradford: right, i have been using get but now it seems inferior

1:53 and so it works the other way around as well...,({:a 1} :a)

1:53 hiredman: yes

1:54 bradford: because the map is a function ath when applied to a key (or keyword?) retuns the value associated with that key

1:54 do I ahve it right?

1:54 hiredman: yes

1:54 bradford: damn, that is pretty powerful

1:54 hiredman: a map as a function can take any kind of key

1:54 ,({"foo" 1} "foo")

1:54 clojurebot: 1

1:54 hiredman: you can also provide defaults

1:54 ,({"foo" 1} :bar 3)

1:54 clojurebot: 3

1:55 hiredman: returns 3 because :bar is not in the map

1:55 ,(:bar {"foo" 1} 3)

1:55 clojurebot: 3

1:56 bradford: and what is going on there with those commas?

1:56 hiredman: they just get clojurebot's attention

1:56 commas are white space in clojure

1:56 bradford: ah, i see

1:57 so this works regardless ,({"foo" 1} :bar 3) map as a function applied to a key

1:57 hiredman: yes

1:58 bradford: but (:a {:a 1}) that is only valid if the key is a function or a keyword (which you can use as a function) ?

1:58 hiredman: yes

1:58 symbols too

1:58 ,('a {'a 1})

1:58 clojurebot: 1

1:58 durka42: ,(ifn? :a)

1:58 clojurebot: true

1:59 durka42: ,(ifn? {})

1:59 clojurebot: true

1:59 durka42: ,(ifn? 3)

1:59 clojurebot: false

1:59 bradford: ah, neat

1:59 durka42: ~def ifn?

2:01 bradford: ok, now that i get this, back to the initial question: {:open (rand) :high (rand) :low (rand) :close (rand)}

2:02 how would i am stract a little function that produces the pair for the keyword and a rand?

2:02 hiredman: (seq {:open (rand) :high (rand) :low (rand) :close (rand)})

2:02 ,(seq {:open (rand) :high (rand) :low (rand) :close (rand)})

2:02 clojurebot: ([:open 0.8407993627078036] [:high 0.7140756192186338] [:low 0.39123758183484647] [:close 0.7588801724644191])

2:03 hiredman: wait

2:03 I know this set

2:03 you doing markets?

2:03 bradford: indeed :-)

2:04 right now starting out building a time series database on tp of hbase

2:04 seems like a good starter porject to learn clojure

2:04 hiredman: ,(let [a (java.util.ArrayList. (seq {:open (rand) :high (rand) :low (rand) :close (rand)}))](java.util.Collections/shuffle a) (first a))

2:04 clojurebot: [:open 0.6810614330271418]

2:05 hiredman: ,(let [a (java.util.ArrayList. (seq {:open (rand) :high (rand) :low (rand) :close (rand)}))](java.util.Collections/shuffle a) (first a))

2:05 clojurebot: [:close 0.08798164520592999]

2:05 hiredman: that might not be the best way to pick a random item

2:07 bradford: ah, right. my ultiamte goal is to create random time series

2:07 so this map will be the value in another map where the keys are data/time


2:07 ERC>

2:07 ERC> (defn random-trades [count] (for [x (range count)] [{:price (rand) :volume 1000}]))

2:08 something liek that

2:15 so now I ahve this: (defn random-trades-starting-at [count]

2:15 (for [x (range count)] [{:price (rand) :volume 1000}])

2:16 if I want to generate a sequence that is a map of key-vales wher ehte key is a date and the value is the {:price :volume} - what sould I do?

2:24 hiredman: ,(java.util.Date.)

2:24 clojurebot: #<Date Thu Apr 09 23:26:21 PDT 2009>

2:24 bradford: right

2:24 my problem is to generate a mp using the for macro

2:24 hiredman: you need into

2:24 bradford: ,(defn random-trades-starting-at [count]

2:24 clojurebot: EOF while reading

2:24 bradford: (for [x (range count)] {:price (rand) :volume 1000}))

2:25 results in a big list

2:25 hiredman: ,(into {} '([:a 1]))

2:25 clojurebot: {:a 1}

2:25 hiredman: ,(into {} '([:a 1] [:b 2]))

2:25 clojurebot: {:b 2, :a 1}

2:25 hiredman: or reduce

2:29 bradford: (defn random-trades-starting-at [count]

2:29 (into {} (for [x (range count)] [x {:price (rand) :volume 1000}])))

2:29 cool

2:29 cp2: yeah

5:10 Carsten: hi

5:11 Does anynoe know how to call a macro from clojure and get the evaluated result and not just the expanded expr

5:21 Neronus: use it like a function

5:23 AWizzArd_: Carsten: how are you trying this right now?

5:23 For example, AND is a macro

5:23 ,(and (= 5 5) true true)

5:23 clojurebot: true

5:24 Carsten: I defined my own macro to get the arglists of a function

5:25 and it only returns a Cons

5:25 ((clojure.core/meta (var #'org.enclojure.ide.nb.editor.ClojureSourceTemplate/abb)) :arglists)

5:25 abb is the function, in the REPL it returns ([a [b] [& c]])

5:26 Neronus: could you paste the code defining the macro somewhere?

5:26 Carsten: (defmacro extr [fun] `((meta (var ~fun)) :arglists))

5:27 rats - I meant: how to call a macro from _Java_

5:27 Neronus: ahhh.. sorry, I can't help you there. Maybe someone else can

5:29 Chousuke: Carsten: call it, get the form, then eval the form?

5:30 Neronus: Question is, though, why this doens't happen transparently

5:30 Carsten: This is what I am looking for: How to I eval the form returned?

5:31 Chousuke: I'm pretty sure there should be a java .eval function somewhere.

5:31 ~source eval

5:31 Neronus: Well, macros are just functions which get and return s-exprs, and are treated specially by the compiler

5:31 Chousuke: clojure.lang.Compiler.eval

5:33 Neronus: I guess it's because it's not really a macro call; what you have in java is the function object :/

5:33 hmm

5:33 ,#^->

5:33 clojurebot: EOF while reading

5:33 Chousuke: meh

5:33 ,(var ->)

5:33 clojurebot: #'clojure.core/->

5:33 Chousuke: ,((var ->) 'test 'moretest)

5:33 clojurebot: (moretest test)

5:34 Chousuke: that's what happens with java I guess.

5:36 Neronus: probably

5:42 Carsten: tryied both Compiler.eval and eval.invoke -> ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Symbol

5:46 Chousuke: hmmh

5:46 remember that eval takes a form

5:46 ,(eval '(+ 1 1))

5:46 clojurebot: DENIED

5:46 Chousuke: ... oh, right.

5:47 Carsten: It must be something special with the macro - this macro works like a function

5:47 (defmacro iif [test clause]

5:47 `(if ~test

5:47 ~clause

5:47 ))

5:47 Chousuke: um, isn't that just when

5:48 Carsten: something wrong with (defmacro extr [fun] `((meta (var ~fun)) :arglists)) ?

5:49 Chousuke: nah

5:50 Carsten: For my problem I can work around it (RT.meta works fine)

5:50 But might it be a bug?

5:57 Chousuke: I have no idea :/

5:57 I haven't used clojure from java.

6:33 csaager: I created issue 104 for this problem

8:08 Neronus: ignore = Name *spool

8:10 sorry

9:56 alinp: hi

9:56 there is a function in clojure like haskell's [1..]

9:56 ?

9:56 or haskell's [1..9]

9:57 hiredman: ,(range 10)

9:57 clojurebot: (0 1 2 3 4 5 6 7 8 9)

9:57 hiredman: ,(take 10 (iterate inc 0))

9:57 clojurebot: (0 1 2 3 4 5 6 7 8 9)

9:57 alinp: oh, ok

9:57 thanks

10:05 why range is not giving all the elements from start to end ?

10:05 I mean:

10:05 ,(range 1 9)

10:05 clojurebot: (1 2 3 4 5 6 7 8)

10:06 alinp: shouldn't give (1 2 3 4 5 6 7 8 9) ?

10:06 hiredman: range is sort of like array or vector indexing like that

10:06 ,(doc range)

10:06 clojurebot: "([end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0 and step to 1."

10:06 alinp: oh, end (exclusive), skipped that

10:06 thank you

10:26 marklar: Is there any function that takes a vector and an index/value and returns a vector with that index/value removed?

10:36 Neronus: I guess compojure is listening to per default?

10:37 cconstantine: ,(doc disj)

10:37 clojurebot: "([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)."

10:38 Neronus: ah, no. Its

10:55 marklar: cconstantine: thank you

11:08 storkme: HEY GUISE

11:08 what's going on in this thread

11:09 Hun: thread?

11:11 storkme: wat?

11:11 Hun: dat!

11:18 storkme: wat

12:04 Cark: ~def send

12:57 eyeris: I have a (defn main [] ...) in my clj file but clojure.lang.Compiler still raises java.lang.NoSuchMethodError: main

12:58 hiredman: ~compilation

12:58 clojurebot: compilation is see compile

12:58 hiredman: ~compile

12:58 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

13:07 eyeris: Okay. I change main to -main [s] and I'm trying to compile the namespace instead of the file, but I still get the NoSuchMethodError exception

13:08 hiredman: pastebin

13:08 lisppaste8: ozzilee pasted "Messy Assoc" at http://paste.lisp.org/display/78368

13:09 hiredman: ,(doc update-in)

13:09 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

13:09 ozzilee: hiredman: Cool, that will help.

13:10 eyeris: http://pastebin.ca/1388133

13:13 hiredman: don't do that

13:14 java clojure.main -e "(compile 'wiscaid.reporting)"

13:14 that exception is because clojure.lang.Compiler does not have a main()

13:17 eyeris: Oh!

13:17 ozzilee: hiredman: Hmm. Is there a way for update-in to work on all values in a vector? (update-in document [:sections * :items * :quantity] inc) ?

13:18 hiredman: nope

13:18 also keep in mind, that using standard sequence functions (filter,map,etc) you will end up with a sequence instead of a vector

13:18 ozzilee: hiredman: Is there another way to clean that pasted mess up, then? The update-in only helps the innermost assoc.

13:18 hiredman: Crap, you're right.

13:19 hiredman: Maybe I should be using zip?

13:19 hiredman: writing a vector map wouldn't be too hard

13:20 ,(keys [1])

13:20 clojurebot: java.lang.Integer cannot be cast to java.util.Map$Entry

13:20 hiredman: bah

13:20 ozzilee: hiredman: No, it's not, I've done that once already. Still doesn't help the overall mess though.

13:21 hiredman: my attack would be to decompose the operations into several functions

13:23 although, I do like the zippers

13:26 ozzilee: Yeah... it seems like an issue I've run into a number of times. There should be a simple jQuery-esque solution somewhere.

13:28 hiredman: the jquery-esque solution would be zippers, I guess

13:28 ozzilee: (update-in foo [:bar [] :baz [:one :two]] inc)

13:29 To update keys :one and :two in :baz in every map in the vector :bar in foo.

13:29 Eh maybe that's too compicated of a syntax.

13:31 hiredman: is there a reason you are using vectors instead of just seqs for :items?

13:32 ozzilee: hiredman: clojure-json uses vectors, not sure if it will encode seqs correctly, I'll give it a shot.

13:33 duncanm: la la la

13:34 ozzilee: hiredman: Yeah, it will. So that doesn't matter.

13:34 hiredman: ,(org.danlarkin.json/encode '(foo bar))

13:34 clojurebot: java.lang.Exception: No such var: org.danlarkin.json/encode

13:35 ozzilee: ,(org.danlarkin.json/encode-to-str '(foo bar))

13:35 clojurebot: "[\"foo\",\"bar\"]"

13:37 hiredman: (update-in document [:sections] (partial map update-items))

13:38 or something

13:40 ozzilee: hiredman: Yeah, I suppose that would work. I need to do a number of updates to each item, so that would be more effecient than walking the document for each one, using the imaginary update-in with wildcards multiple times.

13:42 hiredman: you could always write the update with wild cards :P

13:43 ,:*

13:43 clojurebot: :*

13:43 lisppaste8: ozzilee annotated #78368 "Less Messy Assoc" at http://paste.lisp.org/display/78368#1

13:44 ozzilee: hiredman: Yeah, that's an option :-) I was thinking a vector of keys to mean "all of these keys", not sure what to mean "all keys" though. Don't want to use something that could actually be a key.

13:45 eyeris: Does the latest clojureql 03Feb work with the latest Clojure 30Mar?

13:45 ozzilee: Maybe I'll drop a message on the google group. I'm going to grab some lunch now, thanks for the help.

13:46 eyeris: I get an Exception "Unable to resolve symbol: lazy-cons in this context"

13:47 hiredman: that would be a no

13:48 eyeris: Darn. It doesn't work with the 20080217 Clojure release either (Unable to resolve condp).

13:49 hiredman: Lau_of_DK: well, whats the deal with clojureql?

13:50 Lau_of_DK: We're a few hours of work away from 1.0, but hestitant to put that work into it

13:51 eyeris: Lau_of_DK What Clojure revision are you using to develop?

13:52 Lau_of_DK: We're always working on the HEAD

13:52 dakrone_hb: I'm having trouble accessing the Field.Store.YES from this javadoc: http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/document/Field.Store.html I've tried (Field.Store/YES) and (Field/Store/YES), but it still isn't correct, what's the right way to access the static field?

13:52 Lau_of_DK: eyeris, you submitted limits right?

13:52 hiredman: dakrone_hb: $

13:52 eyeris: Lau_of_DK Yeah

13:52 hiredman: or not

13:53 Lau_of_DK: eyeris, Thank you for that - The code looked good and Im sorry I havent taken the time to implement it, its on the top of my list

13:53 dakrone_hb: hiredman, like (Field$Store/YES)?

13:53 hiredman: possibly

13:53 dreish: No parens, right?

13:53 dakrone_hb: what's the rule of thumb for putting in the '$'?

13:53 hiredman: the javadoc doesn't make a whole lof of sense

13:53 stuhood: yea... you need the $ for inner classes

13:53 hiredman: $ is for inner classes

13:53 eyeris: Lau_of_DK np, I've been keeping a private copy for that project.

13:53 stuhood: even static inner classes

13:54 dakrone_hb: okay, so since I imported Field, Field.Store is an inner class right?

13:54 hiredman: you have to import Field$Store

13:55 but yeah

13:55 Field.Store

13:55 just does not compute

13:55 it seems like the class name is Field.Store

13:55 dakrone_hb: hiredman, got it, importing Field$Store worked, I didn't realize I needed to import the inner class also

13:55 thanks!

13:56 dreish: I think the actual class Java compiles Field.Store to is Field$Store.

13:56 I'm guessing you'd see that in the .class binary.

13:56 dakrone_hb: is that a java-ism or a clojure-ism then?

13:56 hiredman: but the javadoc is so unhelpful

13:56 dreish: I believe it's a Javaism.

13:57 Clojure just isn't doing the namespace->name translation that Java would do.

13:59 blbrown_lt: ,(list nil nil nil)

13:59 clojurebot: (nil nil nil)

13:59 blbrown_lt: how do I condense that list so that the list is empty

14:00 ,(zip (list nil nil nil))

14:00 clojurebot: java.lang.Exception: Unable to resolve symbol: zip in this context

14:00 dreish: (filter identity '(nil nil nil))

14:00 blbrown_lt: there you go

14:01 hiredman: ,(remove nil? (list nil nil nil))

14:01 clojurebot: ()

14:01 blbrown_lt: ,(filter identity '(nil nil nil))

14:01 clojurebot: ()

14:01 dreish: hiredman's is better -- mine also removes false.

14:01 hiredman: I actualy use filter identity

14:02 blbrown_lt: hiredman, just curious, are you from a lisp background or java background or neither

14:03 hiredman: neither, I guess

14:03 blbrown_lt: dreish, in terms of self documenting code, hiredman's seems a little better

14:03 hiredman: clojure is my first lisp (besides trying to write one in ruby with cons cells based on lambdas after watching sicp)

14:03 dreish: blbrown_lt: Way to twist the knife, guy.

14:04 blbrown_lt: shrug, no feelings hurt

14:04 dreish: I kid, of course.

14:04 blbrown_lt: I was the one that through zip in there

14:04 hiredman: the java I have written was just enough to pass CS142 and 143 (intro to Programming^W Java)

14:05 st3fan: i would like to use clojure to write some web services that i would normally do in java

14:05 hiredman: all though I do think my java had a certain flare

14:05 st3fan: just haven't found the time to make a good start with that

14:06 blbrown_lt: st3fan, I plan on using json-lib with google appengine and clojure pretty soon

14:06 st3fan, use json-lib and axis2 if you want web services and a json library

14:06 hiredman: blbrown_lt: are you using json-lib just cause it's in contrib?

14:07 st3fan: blbrown_lt: i wrote a framework to do rest style + json result kind of web services

14:08 blbrown_lt: contrib has a json library or is contrib using json-lib? and how complete is it

14:08 st3fan: blbrown_lt: just add some annotations to a pojo and you expose a bean as a service action .. want to do something similar in clojure

14:08 http://code.google.com/p/polarrose-wsf-examples/w/list

14:09 danlarkin: all hail clojure-json!

14:09 st3fan: yeah i will look into it soon

14:09 i think it will be a good project for me to get into clojure

14:11 hiredman: blbrown_lt: maybe I am confusing contrib's json with json-lib

14:12 the only json lib I've used is danlarkin's

14:13 cads: I'd like to create a browser based repl tutorial similar in spirit to Why's interactive ruby tutorial at http://tryruby.hobix.com

14:13 and I was wondering first if you guys have already run across something like that

14:14 gnuvince: It's funny that #clojure has more users than #scala ;)

14:14 hiredman: it has come up, I think Chouser was working on an applet based repl?

14:15 Chouser: haven't touched it in a while: http://clojurescript.n01se.net/

14:15 hiredman: depending on how involved a tutorial you might get away with just clojurescript :P

14:15 Chouser: but it's the javascript runtime, so no agents, no real stm, etc...

14:16 hiredman: the other option I guess would be something like clojurebot

14:17 (running code in a sandbox)

14:17 gnuvince: That would probably be the best choice

14:17 cads: yeah, a friend already told me about the limitations of of java in browsers, how many are coming with it disabled these days

14:18 I thought to have the complete repl running in an applet, but feel like having it serverside in a sandboxed VM would be better

14:18 hiredman: I wonder if appengine's jvm has the security manager enabled

14:18 cads: well there's another thing, there are all the different implementations, could be hard to get working right

14:19 on the other hand I feel like it would be easier for me to create an interface in an applet

14:21 Chouser: well, that would be another option -- pure java applet (or web start)

14:21 hiredman: there was some javascript terminal widget thing

14:21 drewolson: can anyone help me out with some vim clojure questions?

14:22 Chouser: that gets you argents, stm, etc.

14:22 appengine for java doesn't currently allow spawning threads

14:23 cads: Chouser, your repl would be a good starting point

14:24 can you describe its implementation a bit?

14:25 Chouser: dom+javascript to collect the repl input, which is sent as a string (via liveconnect) to the applet.

14:25 The applet includes all of clojure plus the clojurescript compiler -- it translates the given repl string to javascript and returns that.

14:26 the javascript in the page then evals the returned javascript and displays the output via the dom

14:27 all the javascript I just mentioned is actually also compiled from clojure sources

14:27 all the code for this is in contrib

14:28 cads: very nice

14:29 dakrone_hb: drewolson, probably best just to ask and see if anyone can help

14:29 Chouser: so you could just cut out the clojurescript stuff and get more features, better performance, and a smaller applet

14:30 cads: I think so too

14:31 that's pretty fantastic, kudos

14:43 blbrown_lt: only bad thing about the new lazy sequences is that it can hard to detect errors. E.g. before it seem like you could navigate to line 123 and that is where the error is. Now we have to remember a seq is lazy

14:44 marklar: Is there a way to control the output of find-doc? i.e. How many items are returned?

14:55 eyeris: Could someone interpret this compile exception for me? http://pastebin.ca/1388243

14:56 hiredman: clojurebot: compile

14:56 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

14:57 hiredman: I know this is the second time I have referenced that

14:57 but I need you to read it

14:58 eyeris: I know. I did read it. I just can't find the answer.

14:58 dakrone_hb: it doesn't look like you have ./classes in your classpath

14:58 eyeris: I'm pretty jvm-ignorant, so most of the gen-class stuff is over my head.

14:59 dakrone_hb: does ./classes/ exist and is it in your classpath?

14:59 clojurebot: classpath is (System/getProperty "java.class.path")

14:59 hiredman: ~botsnack

14:59 clojurebot: thanks; that was delicious. (nom nom nom)

14:59 eyeris: I see. It needs ./classes for the intermediate steps.

14:59 I thought that was in the example cmd line simply for other .class files

15:00 hiredman: not intermediate steps

15:00 radarsat1: hi, is there an easy way to do a lazy reduce in clojure?

15:00 hiredman: the compiled classes are written to ./classes/

15:01 radarsat1: reduce as a lazy operation is, like unpossible

15:01 radarsat1: okay

15:01 hiredman: reduce by it's nature consumes a whole sequence and outputs one value

15:01 you could wrap it in a (delay ...)

15:02 radarsat1: i want to translate '((0 1 2) (3 4 5)) into '(0 1 2 3 4 5) lazily

15:02 hiredman: replaca: that is not reduce

15:02 radarsat1: it works with (reduce concat...) but that's not lazy

15:02 hiredman: ,(apply concat '((0 1 2) (3 4 5)))

15:02 clojurebot: (0 1 2 3 4 5)

15:03 dreish: ,(flatten '((0 1 2) (3 4 5)))

15:03 clojurebot: java.lang.Exception: Unable to resolve symbol: flatten in this context

15:03 dreish: I guess that's in seq-utils.

15:03 It's lazy, anyway.

15:03 radarsat1: apply is lazy?

15:03 clojurebot: lazy is hard

15:04 dreish: (apply concat '((0 1 2) (3 4 5))) is equivalent to (concat '(0 1 2) '(3 4 5)), and concat is lazy.

15:05 radarsat1: okay thanks

15:05 ah i see my problem here

15:05 i was using '(0 1 2) as examples but they are also calculated lazily

15:06 anyways i'll think about it thanks

15:06 dreish: You probably want seq-utils/flatten

15:06 radarsat1: i'll try that

15:13 i just tried with a few more list items and found that applying concat is lazy, its just that it starts by calculating the first 3 or 4 in advance, that's why i was confused. thanks.

15:14 the 5th and 6th entries are being evaluated as needed.

15:44 __mj__: Has the route function been removed in clojure?

15:44 I mean compojure?

15:58 lisppaste8: thickey pasted "show-doc" at http://paste.lisp.org/display/78375

15:58 marklar: That is great

15:59 thickey: marklar: it was based on your comment earlier, i've been wanting the same

15:59 marklar: thickey: Thank you! It will be incredibly helpful learning

16:00 thickey: np

16:04 duncanm: is there a way to access the binding vector inside a LET?

16:04 hiredman: interesting

16:04 uh

16:04 for why?

16:05 duncanm: i want to check that they're not zero

16:05 rsynnott: sounds like the sort of thing you don't really WANT to do

16:05 hiredman: ,(show-doc "vec")

16:05 duncanm: i have something like this

16:05 clojurebot: [ 0] org.danlarkin.json.decoder/decode-array [ 1] clojure.contrib.seq-utils/flatten [ 2] clojure.contrib.seq-utils/group-by [ 3] clojure.contrib.seq-utils/separate [ 4] clojure.core/assoc [ 5] clojure.core/contains? [ 6] clojure.core/for [ 7] clojure.core/letfn [ 8] clojure.core/peek [ 9] clojure.core/pop [10] clojure.core/proxy [11] clojure.core/re-groups [12] clojure.core/replace [13] clojure.core/require [14] clojure.core/rseq [15] clojure.core/spli

16:06 hiredman: ,(show-doc "vec" 0)

16:06 clojurebot: ------------------------- org.danlarkin.json.decoder/decode-array ([b-reader]) Decodes a JSON array and returns a vector.

16:06 duncanm: (let [x (f) y (g)] (if (some zero? (list x y)) 'boo 'woohoo))

16:06 i was just thinking of a way to not have to write (list x y)

16:06 hiredman: ah, uses print-doc

16:07 if you want a list, make a list

16:07 (let [x (list (f) (g))] ...

16:07 actually

16:07 (let [l (list (f) (g)) [x y] l] ...

16:10 Chouser: duncanm: would the 'if' always be the first thing inside the 'let'?

16:10 if so, a macro do to that would be pretty reasonable.

16:13 twansit: quick question... how do you remove a symbol from a namspace?

16:13 remove/unload

16:13 hiredman: clojurebot: namespaces

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

16:14 hiredman: er

16:14 wait

16:14 not what I was looking for

16:14 clojure.org/namespaces

16:14 functions for doing stuff with namespaces

16:15 twansit: cool thanks

16:15 i know the function that does this exists but its not on that page

16:16 cause the issue is im trying require a clj library using an alias

16:16 hiredman: ...

16:17 twansit: i would like to switch to another library but still using the same alias

16:17 do i have to remove-ns

16:17 or is there a fuction that just removes the alias

16:17 pjstadig: look under 'n' at http://clojure.org/api

16:17 ns-unalias

16:17 ns-unmap

16:18 hiredman: or look under "Remove" on clojure.org/namespaces

16:18 well

16:18 "Removing things"

16:19 twansit: ah

16:19 didnt see that for some reason

16:19 thanks guys

16:21 danlarkin: you here?

16:22 danlarkin: twansit: yessir

16:22 twansit: I'm using your json library

16:22 actually the decode-from-reader fn

16:23 danlarkin: cool

16:23 twansit: whats the difference if i pass a BufferedReader or InputStreamReader, is there a preference?

16:24 danlarkin: ?

16:25 danlarkin: right now i pass (BufferedReader. (InputStreamReader. stream *default-encoding*))

16:26 danlarkin: you don't necessarily need to wrap it in a BufferedReader yourself

16:27 hiredman: there is a seperate decode-from-buffered-reader

16:27 danlarkin: decode-from-reader checks if the reader you pass is a BufferedReader, and if it's not it wraps it itself

16:27 twansit: cool thanks

16:27 i should have just looked at the src... but im lazy :)

16:31 hiredman: ,(show-doc "decode-from-reader")

16:31 clojurebot: [ 0] org.danlarkin.json/decode-from-reader

16:31 hiredman: ,(show-doc "decode-from-reader" 0)

16:31 clojurebot: ------------------------- org.danlarkin.json/decode-from-reader ([reader]) Takes a java.io.Reader pointing to JSON-encoded data and returns a clojure datastructure.

16:31 hiredman: hmmm

16:31 if I am going to use that, print-doc needs a rebinding

16:32 dakrone_hb: why does it print all the '-'s?

16:32 hiredman: ,(doc print-doc)

16:32 clojurebot: "([v]); "

16:32 hiredman: nice

16:32 print-doc is used and print-doc prints all the dashes and the heading

16:33 drewolson: hey all, i'm having an issue with vimclojure. syntax highlighting seems fine, ngserver runs cleanly and ng runs fine, however none of the key mappings seem to have any effect.

16:35 hiredman: is clj_want_gorilla set?

16:35 drewolson: yep, it is

16:35 it's almost as if nothing is mapped

16:35 * hiredman is now out of his depth

16:35 drewolson: i try \sr, and it simply does a replacement of the current character with r

16:35 hiredman: actaully

16:35 I had that too

16:36 drewolson: really?

16:36 and how did you solve it

16:36 * hiredman tries to remember what the problem was

16:36 drewolson: thanks :)

16:36 wait, is it clj_want_gorilla or clj_wants_gorilla?

16:37 hiredman: want, I think

16:37 drewolson: wow, that was it :)

16:38 ugh, now back to the issue i was seeing earlier

16:38 Error detected while processing function vimclojure#ExecuteNailWithInput:

16:38 line 23:

16:38 E605: Exception not caught: Couldn't execute Nail! ng de.kotka.vimclojure.nails.NamespaceOfFile </var/folders/+e/+eeVZjm3E+y-FujQq60a8U+++TM/-Tmp-/v396957/0

16:38 Error detected while processing function <SNR>12_activateNode:

16:38 line 12:

16:38 E171: Missing :endif

16:38 hiredman: uh

16:38 pastbin

16:38 the ng binary needs to be in your path

16:38 drewolson: it is

16:38 hiredman: is it in the path of vim?

16:39 :!ng

16:39 drewolson: $ which ng

16:39 let me check

16:39 yep, sure is

16:39 hiredman: is the fail you are editing all namespaced up?

16:40 file

16:40 :P

16:40 drewolson: let me try with a simple empty file

16:40 breaks on an empty file as well

16:41 hiredman: what kind of classpath are you starting the ngserver with?

16:41 drewolson: let me find the command

16:41 http://pastie.org/443200

16:41 that's the ngserver command

16:42 hiredman: *shrug*

16:42 I have found vimclojure to be very finicky about classpaths

16:43 drewolson: yeah, apparently...i had the old version working with gorilla, would love to get this back up and running

16:44 hiredman: I would make sure the file you are editing is in the classpath

16:45 drewolson: hrm, really? i suppose then i would need to create a separate launcher for every project i was working on

16:45 pjstadig: or just have a huge classpath that includes everything you'd need

16:46 drewolson: let me give that a quick shot

16:47 still fails if the file i'm editing is in the classpath

16:47 of the server

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

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

16:52 dakrone_hb: ,(show-doc "xml" 2)

16:52 clojurebot: ------------------------- clojure.xml/parse ([s] [s startparse]) Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a fn taking a source and a ContentHandler and returning a parser

17:01 dakrone_hb: ,(show-doc "json")

17:01 clojurebot: [ 0] org.danlarkin.json.decoder/json-ws?

17:03 twansit: i need a clojure sticker for my notebook

17:03 where can I cop one?

17:07 or a large clojure icon will do?

17:09 pjstadig: there are some files at the google group

17:09 http://clojure.googlegroups.com/web/Clojure-glyph.svg?gda=4BZz8kMAAAC2LrkjeC7f10uHiY7GOiyxp_O1uqTqpaVnLTdRwwRk4Xcahxnv5uvgTxaQgfZeUAYytiJ-HdGYYcPi_09pl8N7FWLveOaWjzbYnpnkpmxcWg

17:09 stuhood: http://clojure.org/file/detail/clojure_cake.png

17:11 oh... svg

17:11 that works

17:11 twansit: thanks!

17:11 pjstadig: np

17:12 stuhood: heh, that svg is on wikipedia too

17:12 but it has some copyright restrictions http://en.wikipedia.org/wiki/File:Clojure-glyph.svg

17:14 pjstadig: yeah i'm not sure what the restrictions are

17:14 is there something published somewhere that would say

17:14 i mean i wouldn't go selling stickers or anything else

17:15 i think thickey made the logo, maybe he could shed some light?

17:18 twansit: nah i wouldnt sell them anyways

17:22 pjstadig: http://groups.google.com/group/clojure/browse_thread/thread/7f179c79f0d0bb3e/e065944bbbcb84e9

17:22 some discussion, but the status of the logo was never specified

17:25 twansit: ,(java.net.URLEncoder/encode. "string" "UTF-8")

17:25 clojurebot: java.lang.IllegalArgumentException: No matching method: encode.

17:26 twansit: ,(.java.net.URLEncoder/encode "string" "UTF-8")

17:26 clojurebot: java.lang.Exception: No such namespace: .java.net.URLEncoder

17:26 hiredman: erm

17:27 ,(java.net.URLEncoder/encode. "string")

17:27 clojurebot: java.lang.IllegalArgumentException: No matching method: encode.

17:27 hiredman: bah

17:27 twansit: ,(java.net.URLEncoder/encode "string" "UTF-8")

17:27 clojurebot: "string"

17:27 hiredman: ,(java.net.URLEncoder/encode "string")

17:27 clojurebot: "string"

17:27 hiredman: I live in the future

17:27 everything is UTF-8

17:27 twansit: oh ok

17:27 thanks man

18:29 lisppaste8: Neronus pasted "compiling clauses" at http://paste.lisp.org/display/78380

18:31 Neronus: How efficient is function compilation in clojure? Say, I want to write a function which compiles a clause, e.g. what I just pasted. How often do I have to evaluate that function to make compiling this thing worthwile in comparison to just "interpreting" such a clause

18:31 for example via every?

18:31 hiredman: clojure does interpret anything

18:31 er

18:31 doesn't

18:31 everytyhing is compiled

18:32 and using eval is horrible

18:32 so don't, ever

18:32 Neronus: right, I know that. What I mean by interpretation: (fn check [clause assignment] (every? #(assignment %1) clause))

18:33 hiredman: I am not going to bother and figure what you are doing

18:33 have fun

18:33 Neronus: I'll do my best

18:35 zakwilson: Using eval is likely the right thing if you're doing genetic programming or writing a REPL.

18:37 Neronus: why for genetic programming?

18:39 lisppaste8: Neronus annotated #78380 "macro instead of evil eval" at http://paste.lisp.org/display/78380#1

18:40 Neronus: clojurebot: eval?

18:40 clojurebot: eval is evil

18:40 Neronus: thought as much

18:42 durka42: clojurebot: macros?

18:42 clojurebot: Holy Crap.

18:42 dakrone_hb: Vn1m4ith

18:42 bleh

18:42 durka42: whoops

18:42 change that password

18:42 dakrone_hb: heh

18:43 only my screen password, so no worries

18:43 durka42: don't worry, all i saw was ********

18:43 * durka42 wonders if anyone will get the reference

18:44 dakrone_hb: heh

18:44 Neronus: you mean, if I enter my password, everybody sees just stars? OK, I'll try it

18:44 oldbutbeautifuljoke

18:44 there, all stars

18:54 mek`: Hi all, I'm just switching to clojure from common lisp and I'd really like to start by writing code correctly (conventionally). Does anyone know of an authoritative resource on clojure commenting and programming conventions? And links to resources would be greatly appreciated.

18:55 Any* links, rather.

18:56 hiredman: core.clj :P

18:56 ~def quote

18:56 ah

18:56 mek`: Thank you kindly. :o)

18:56 hiredman: ~def unquote

18:57 actually

18:57 core.clj is kind of dated

18:58 (. clojure.lang.RT (toArray coll)) would be (clojure.lang.RT/toArray coll) these days

18:58 example of calling a static java method

18:59 ,(macroexpand '(clojure.lang.RT/toArray coll))

18:59 clojurebot: (. clojure.lang.RT toArray coll)

18:59 hiredman: hmm

18:59 ,(macroexpand '(. clojure.lang.RT (toArray coll)))

18:59 clojurebot: (. clojure.lang.RT (toArray coll))

18:59 hiredman: ,(. clojure.lang.RT (toArray []))

18:59 clojurebot: #<Object[] [Ljava.lang.Object;@11c0dc6>

19:00 hiredman: ,(. clojure.lang.RT toArray [])

19:00 clojurebot: #<Object[] [Ljava.lang.Object;@1f96306>

19:01 hiredman: towards the end you get some more modern style

19:08 mek`: This is just what I was looking for. Thank you kindly, hiredman.

19:16 elg: what would be the idiomatic way to do the equivalent to this ruby code? ARGF.each_line{|l| foo, bar, baz = l.split}

19:16 (and obviously do something with them, stuff them into an array or something - but that's irrelevant)

19:16 hiredman: map

19:17 uh

19:17 well you would not stuff into an array

19:17 elg: naturally

19:17 hiredman: or do assignment

19:17 elg: i was speaking about the ruby side - that code by itself is pointless

19:18 I assume there's something more elegant than java.util.Scanner

19:18 hiredman: ruby .each* is somekind of map

19:18 elg: yes. ARGF is stdin/files on ARGV

19:19 hiredman: I've never used Scanner

19:19 elg: it's not pretty

19:19 gnuvince_: Those who know something about compilers: my Clojure code is spend a large majority of its time in clojure.lang.Var.deref and get; do you think it would be possible to "change" those to let-vars if the compiler could determine that they're used not for their threading semantics, but just for naming things?

19:20 hiredman: well, I guess .each* could be doseq as well

19:20 elg: what do you want to do? loop over lines in something?

19:21 elg: i want to create a data structure from the lines in a file

19:21 hiredman: so if you have a bufferedreader you can use line-seq

19:21 and doseq or map

19:21 ,(doc line-seq)

19:21 clojurebot: "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."

19:22 slashus2: gnuvince_: Maybe you should write the part that is slow in java, and the rest in clojure.

19:23 gnuvince_: slashus2: the part that is slow (or at least, I think is slow if I'm reading those profiling figures right) is the one I *really* want to write in Clojure :)

19:23 slashus2: :-(

19:24 eevar__: gnuvince: considered using let?

19:24 gnuvince_: eevar__: I'm trying now, but it does not seem to have a lot of effect

19:24 eevar__: assuming you don't _have_ to dereference, that is

19:24 gnuvince_: Went down from 113 seconds to 111

19:24 Which is probably just a question of margin of error

19:26 Not to mention that it makes some code really ugly; (def my-func (let [; 20 lines of local function definitions ] (fn [...] ...)))

19:27 Neronus: gnuvince_: You could pack it all into a map, if you always use it together; only one deref that way

19:27 gnuvince_: If anyone's interested in doing some tests of their own, the code is here: http://github.com/gnuvince/clj-starcraft/tree/master

19:27 Neronus: Doesn't seem you real performance bottleneck, though. What do you use for profiling?

19:27 gnuvince_: I could provide you with the data I'm testing against.

19:28 Neronus: -Xrunhprof:cpu=times

19:29 Neronus: Thanks. I'm still looking for a nice profiling solution

19:30 gnuvince_: Neronus: there's also -Xprof

19:30 Faster, but less precise

19:32 eevar__: yea, i'd go with cpu=samples

19:32 Neronus: But the benchmarks I did also indicated that dynamic variable lookup is slow. Which is sad, as defn'd functions are variables

19:33 Well, got to go

19:33 bye

19:34 or maybe profiling influences the outcome a lot, because the overhead induced by profiling is bigger than the time needed for the lookup of variables

19:35 elg: hiredman: essentially what I'm trying to do is http://pastie.org/443376

19:35 gnuvince_: eevar__: what's samples?

19:35 elg: i'm still very new at clojure, and trying to feel out the standard idioms

19:35 i can see how to do it by naively porting equivalent java code, but i doubt that's idiomatic

19:36 hiredman: elg: do you have contrib?

19:38 it contrib's duckstreams there is a reader function that will turn just about anthing into some kind of BufferedReader

19:38 then you call lazy-seq on it, then you just call map

19:38 and you can use String's split method

19:39 "structs" and hashs are the samething in clojure

19:39 eevar__: gnuvince_: periodic sampling of the stack frame, rather than trying to time every method call or whatever 'times' does. way way faster

19:39 and still reasonably accurate

19:39 hiredman: structs are just hashes optimized for a smaller number of keys

19:40 gnuvince_: eevar__: very nice, I'll try it in a few minutes

19:40 elg: hiredman: thanks, I'll look at duckstreams

19:40 hiredman: ,(doc defstruct)

19:40 clojurebot: "([name & keys]); Same as (def name (create-struct keys...))"

19:48 lisppaste8: gnuvince pasted "For elg" at http://paste.lisp.org/display/78384

19:48 hiredman: oh jesus

19:49 next thing he'll be in here asking why elg won't compile

19:49 :(

19:49 gnuvince_: hmmm?

19:49 hiredman: gnuvince_: foo.elg

19:50 or something, not a single segment namespace

19:51 gnuvince_: Why would he name the file foo.elg?

19:51 hiredman: I have no idea

19:51 gnuvince_: It runs fine here

19:51 Dunno about AOT compilation

19:51 but that's for another time.

19:51 hiredman: sure it'll run, but after he has been using it for a few days, and tries to compile, he'll be back in here

19:52 and I'll have to do this

19:52 ~namespaces

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

19:52 hiredman: or even breakout ~compile

20:04 mattrepl: single segment namespace not allowed because compiled classes would be in default package?

20:58 dysinger: Strange I am getting 502 on several google code svn repos @app_engine outage related I wonder.

20:59 clojure & clojure-contrib = 502

21:04 * gnuvince_ too

21:08 hiredman: clojurebot's svn watcher is throw exceptions

21:14 dysinger: clojure should be on git not svn /ducks

21:15 poorman's alternative would be hg /ducks again

21:16 :P

21:17 cmvkk: you can get clojure off of github if you want

21:17 it's just a clone of the svn version

21:18 gnuvince_: I prefer Mercurial myself, but I don't have a problem with Clojure being managed with Subversion if that's what Rich likes/knows.

21:20 eevar__: cpu=samples is pretty nice.

21:21 It's giving me very different results.

21:21 WHich make more sense I think and are more consistent with results from -Xprof

21:23 rlb: Is is very easy to create new container types?

21:23 s/Is is/Is it/

21:24 i.e. something that can be used as a container but with a custom implementation?

21:25 hiredman: Yes

21:25 what do you mean by "container"

21:26 Cark: i would say no =P

21:26 hiredman: I would say Yes

21:26 Cark: for what value of yes ?

21:26 hiredman: they are just java classes

21:27 Cark: right, you have to go to genclass or java

21:27 hiredman: you can gen-class, write java, or use proxy

21:27 it depends

21:27 Cark: ah proxy might be cool indeed

21:27 clojurebot: proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.

21:27 hiredman: clojurebot: shove off

21:27 clojurebot: No entiendo

21:27 hiredman: ~you heard me

21:27 clojurebot: hiredman: I'm just giving you a second chance

21:29 hiredman: like I said, it depends

21:29 rlb: what do you mean by "container"

21:29 a Collection type?

21:29 I don't see why you would

21:30 Cark: hum making a trie for instance ?

21:30 i'm working with telephone number and prefixes a lot

21:31 hiredman: it's possible to do that using vectors

21:31 Cark: i think i read somewhere that rich was thinking about mmoving more of the implementation to clojure code

21:31 hiredman : what do you mean ?

21:32 hiredman: you can make tree structures using vectors like cons cells

21:33 Cark: i have my implementation of a trie in clojure ....but it's neither a map nor a seq

21:33 trie /= tree

21:33 hiredman: it is a tree

21:34 are you kidding?

21:34 Cark: right it's a tree ...just not your vanilla binary tree

21:35 anyways i didn't think about using proxy

21:35 hiredman: why would you?

21:35 Cark: so that i can use my trie as a seq and as a map

21:35 rlb: I was thinking about something like a very large disk-backed container.

21:35 bbiab.

21:35 Cark: i wonder what's the performance penalty

21:35 hiredman: I guess he must mean Collection

21:36 they have those, called "files"

21:37 Cark: file based persitent data structures .... pray that the gc never collects

21:37 hiredman: it's an idea that keeps coming up

21:38 Cark: that's i beleive how some db engine are doing transactions

21:38 hiredman: because people never get tired of fighting with virtual memory systems?

21:39 most operating systems implement a type of "disk-backed container" called a file

21:41 Cark: i'm not sur how good is java when running on the virtual memory

21:41 *not sure

22:14 slashus2: Is there a Java framework like the python framework twisted?

22:15 hiredman: there are many

22:16 #java recomends xnio or netty

22:16 slashus2: Thank you. I will check them out.

22:16 hiredman: (netty seems to be higher level built ontop of xnio)

22:16 the apache foundation has there own, mina

22:16 their

22:17 which is what twitter used with scala for thei message queue thing

22:17 but #java seems to look down on it

22:17 (the primary author of xnio hangs out in #java)

22:18 slashus2: I think I will take a close look at Netty

22:19 I was going to play around and try to write an IRC server or something.

22:21 rlb: hiredman: I'll have to go investigate this "File" thing you speak of. Thanks.

22:25 hiredman: netty seems to use annotations, which could be a problem

22:26 slashus2: hiredman: Looks like Netty uses annotations a lot, how do you deal with that in clojure? They are just properties, right?

22:26 hiredman: I don't know

22:30 rlb: For anyone who actually cares, what I was thinking of was something that would allow you to use something like filter on very large homogeneous vectors -- say a 3GB file of 64-bit integers.

22:31 Perhaps something like line-seq, but customizable.

22:41 mattrepl: slashus2: the java compiler emits bytecode for class and runtime annotations, so gen-class would need to mimic that

22:41 rlb: Ahh, OK, after looking at the source, it looks like it might be pretty easy to just create something that does at least part of what I wanted.

23:02 nzkoz: Hey guys, do you have any pointers to a good example application using clojure's concurrency support? I'm looking to build something really simple where a few UI threads feed a few more worker threads. But I want to make sure I approach it 'right' rather than just 'java with parens) ;)

23:03 Cark: have a look to the ants simulation

23:04 ~ants?

23:04 clojurebot: Excuse me?

23:04 Cark: i think the code is on the google group

23:04 mattrepl: ~ants

23:04 clojurebot: Excuse me?

23:05 Cark: might be based on an old version of clojure though

23:05 mattrepl: (thought it was question mark)

23:05 hiredman: it gets updated

23:05 nzkoz: ?ants

23:05 irc bots never liked me anyway :)

23:05 Cark: clojurebot does not like anybody

23:05 nzkoz: from the google group homepage?

23:06 Cark: in the file section

23:06 let me check

23:07 clojurebot : ants is http://clojure.googlegroups.com/web/ants.clj

23:07 clojurebot: ants is http://clojure.googlegroups.com/web/ants.clj

23:07 clojurebot: Roger.

23:07 Cark: ~ants?

23:07 clojurebot: ants is http://clojure.googlegroups.com/web/ants.clj

23:08 nzkoz: thanks

23:09 Cark: mzkoz : you should watch the videos too

23:09 nzkoz: yeah, saw the boston lisp ones, really good. if somewhat long :)

23:16 gnuvince_: nzkoz: as I understand it, it was supposed to be 90 minutes, but went over 3 hours :)

23:16 And people didn't seem to mind

23:17 hiredman: which vidoes are those?

23:17 gnuvince_: Boston Lisp User Group

23:17 hiredman: ~google boston lisp user group videos

23:17 clojurebot: First, out of 13800 results is:

23:17 Find a Meetup Group Near You! - Ruby Meetups - Boston

23:17 http://ruby.meetup.com/cities/us/ma/boston/

23:18 hiredman: *blink*

23:18 cmvkk: google: it's not perfect.

23:19 hiredman: this is the clojure for lisp programmers stuff?

23:20 slashus2: mattrepl: I see an example in the group of how to annotations for methods inside of a class, but how do you do it for a class itself.

23:20 gnuvince_: hiredman: yes.

23:21 mattrepl: slashus2: if you're talking about the thread I started, that hasn't been implemented. there so far hasn't been much interest in it. for classes, we'd just need to add another option to gen-class to define all the class annotations

23:24 replaca: Boston Lisp Group videos are at http://clojure.blip.tv

23:25 look at "Clojure for Lisp Programmers" part 1 & 2

23:25 watching that video was, for me, like a junkie's first taste of heroin

23:30 hiredman: I can't wait for the qcon videos

23:39 Raynes: It's 10:36pm. I've had 4 hours of sleep in the last 36. I've been monitoring a severe weather event all day. I have a fried porkchop in my mouth, a cold Coca-Cola in my hand I'm trying to concentrate on learning Scala with little object oriented background. This must be what the life of a programmer is really like.

23:41 Cark: that's the life of a bug writer

23:43 Raynes: Cark: That was offensive :(

23:43 Cark: ah sorry ...

23:43 but you know

23:43 you have to be carefull with your body if you want to write great software using your mind

23:44 i don't quite know how to formulate this in english

23:44 clojurebot: this is not a bug

23:44 Cark: in a non offensive way =P

23:45 Raynes: Cark: I'm competent. I'm just sleepy. I'm in one of those states where I can read an entire chapter before realizing I haven't been paying attention to what I was reading. Then have to re-read the whole thing.

23:45 And I was just joking about it being offensive.

23:45 \o/

23:45 Cark: hehe ok

23:45 anyways that's bad habits i had too back then

23:46 then i became older, and i have to sleep now =P

23:47 gnuvince_: Raynes: any thoughts on Scala? I was considering translating my Starcraft program to it to compare its speed and ease of use with Clojure.

23:47 Raynes: I normally /do/ sleep. I intended on going to sleep last night then the first complex of storms that came through caught me off guard and I monitored that severe weather until 5AM and slept for 4 hours before the next wave of storms. Those lasted all day so here I am.

23:47 gnuvince_: I'm only on the first actually-learning-something chapter.

23:48 gnuvince_: ok

23:48 cmvkk: if sleeplessness and junk food were good enough for john carmack, then they're good enough for me :)

23:48 Raynes: When they say Programming in Scala is a slow-paced book they mean it. They spend 2 chapters just running random crap by you.

23:48 gnuvince_: heh

23:48 Raynes: I'm on the second introduction chapter :|

23:49 gnuvince_: From what I've seen, I most likely know that I prefer Clojure (more liberal, less concepts), but I don't dislike static typing and really like to try new languages

23:49 Cark: cmvkk : looks like i'm not the next john carmack =(

23:49 gnuvince_: So.. :)

23:49 Raynes: I'm learning it because I need Object Orientation, but I don't want to learn Java.

23:49 Not now anyway.

23:49 Cark: ~OOP?

23:49 clojurebot: Gabh mo leithsc�al?

23:49 Cark: ~oop

23:49 clojurebot: Huh?

23:49 Cark: ~oop?

23:49 clojurebot: Gabh mo leithsc�al?

23:50 Cark: bah

23:50 gnuvince_: object oriented programming

23:50 Raynes: ~OOP

23:50 clojurebot: Huh?

23:50 hiredman: ~mock objects

23:50 clojurebot: Your mock object is a joke; that object is mocking you. For needing it. -- rhickey

23:51 Cark: there need to be some sarcastic oop definition in clojurebot

23:51 danlarkin: Raynes: you don't need OO

23:51 Raynes: I really want to learn Factor. But I can't bring myself to do it with absolutely /no/ beginner material.

23:51 danlarkin: I need better knowledge of OO.

23:51 Cark: factor looks nice

23:52 but i don't like to have these stack manipulation words in the code

23:53 gnuvince_: Factor *is* nice, but I guess my brain's just not made for concatenative code

23:53 I guess I'll just you Haskell and (.) if I want point-free programming :)

23:53 s/you/Use/

23:54 Cark: there definetly is some commonality between these 2

23:55 (-> data action1 action2 action3)

23:55 there's a stack in there too

23:56 (-> data action1 (action2 avalue) action3)

23:56 what if the parameter that should be passed to avalue was in second position ?

23:56 Raynes: I love everything about Factor, besides the fact that the creator makes this wonderful language and can't even write something of a comprehensive introduction to the language to help people learn it. :\

23:57 Cark: (-> data action1 (switch action2 avalue) action3)

23:57 hiredman: doesn't work

23:57 Cark: (-> data action1 ((switch action2 avalue)) action3)

23:57 !

23:57 hiredman: -> is a macro so it happens before the function switch

23:57 Cark: how about that last form ?

23:58 hiredman: it might

23:58 clojurebot: pl?

23:58 clojurebot: have you heard about the bird? is<reply>The bird, bird, bird, the bird is the word.

23:58 hiredman: clojurebot: transform

23:58 clojurebot: transform is http://github.com/hiredman/odds-and-ends/blob/8a84e6ddbad9d71f714ba16c3e1239633228a7eb/functional.clj

23:58 hiredman: I have a few odds and ends there

23:58 uncurry and flip

23:59 Cark: ah flip that's the correct name !

23:59 uncurry ....i don't understand that one

23:59 hiredman: ,(doc pl)

23:59 clojurebot: "([& forms]); replaces a $ b with (a b) walking right to left replaces a � b with (comp a b) left to right ?a with (uncurry a) left to right ?a with (flip a) left to right"

Logging service provided by n01se.net