#clojure log - Oct 01 2009

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

0:14 kunley: hi

0:15 How to define a print-method for a java array of some java objects?

0:15 hiredman: easiest is to just call seq on it

0:16 ,(into-array ["foo"])

0:16 clojurebot: #<String[] [Ljava.lang.String;@1a70476>

0:16 hiredman: ,(seq (into-array ["foo"]))

0:16 clojurebot: ("foo")

0:55 slyrus_: hrm... I see that I can use proxies to implement java interfaces, but can I subclass a java class?

1:46 hrm... ok, on to the next error... I'm occasionally seeing this error message: clojure.lang.PersistentStructMap cannot be cast to clojure.lang.PersistentStructMap$Def

1:46 any clues?

2:01 hoeck: slyrus_: that happens when you try to create a struct but supply a struct-map instead of a struct-map-definition

2:02 like: (struct (struct (create-struct foo :a) 1) 1)

2:04 slyrus_: maybe you have defined a struct-map with defstruct and later defined some Var with the same name, or in a let you define a local with the same name as the structmap and then try to create one

2:04 slyrus_: hoeck: yes, the second one. thanks!

2:04 that is to say it was a var with the same name that was mucking things up

2:06 hoeck: slyrus_: yeah, thats one of the drawbacks of a lisp-1

2:06 slyrus_: ah, right... clearly i'm used to a lisp-n...

3:28 AWizzArd: ~ max people

3:28 clojurebot: max people is 178

3:33 Fossi: still ;)

3:36 AWizzArd: not bad for this time of the day

3:36 geht doch

4:09 LauJensen: AWizzArd: You mean the 148 ?

4:16 G0SUB: I am planning to write a simple macro called (with-debug) which calls the body with *debug* bound to true. and the functions check *debug* and decide if they should enable debig or not.

4:16 is that a good approach?

4:27 LauJensen: G0SUB: Maybe - On a few projects I use a debug macro with I call similar to this (with-debug "Exchanging keys" (connect......)) and that will simply output <timestamp> Exchanging keys .. then do the work and output <timestamp> OK: Exchanging keys it everything goes well.

4:28 Chousuke: yeah. put the check for *debug* in the debug macros themselves. having (if *debug* ...) scattered around the actual program logic is icky :)

4:30 you could also simply have the *debug* be a global var and set it to true during development, and false afterwards. kind of like *assert*

4:30 G0SUB: Chousuke: actually I am dealing with some XML apis. I specifically want some low-level functions to spit out the XML depending on the value of *debug*

4:31 LauJensen: Oh, and while you're added, I recommended hooking into log4j from the get go, you can then later change output to whatever you like, text file, syslog, sql, you name it

4:31 G0SUB: LauJensen: good idea.

4:31 Chousuke: G0SUB: hm, then the name *debug* might not be so good.

4:31 *verbose-xml* or something? :/

4:31 G0SUB: Chousuke: yeah, that's fine too.

4:32 Chousuke: It was just thinking if putting (if *verbose-xml* ...) in the low-level functions is a good way or not.

4:33 Chousuke: well, you might be able to make it a bit nicer with a macro

4:33 G0SUB: Chousuke: would appreciate a small example.

4:34 Chousuke: well, I don't know the exact requirements so I'm not sure what you need.

4:34 but for example debug macros are usually done like (debug "whatever") and they expand to (if debug-enabled ...)

4:34 G0SUB: Chousuke: ah, got it now.

4:36 Chousuke: if you bind the value before compile-time it's even possible to have them check the value and expand to nothing if debugging is disabled. but I don't know if that's possible in your situation

5:13 G0SUB: OK. Are there any Clj wrappers over Log4J ?

5:13 AWizzArd: LauJensen: yes

5:14 LauJensen: G0SUB: As I recall it wasn't needed, so little interop

5:14 G0SUB: LauJensen: I am new to Log4J. how does one dynamically config it?

5:17 LauJensen: By modifying an xml file

5:25 sfuentes: anyone know if there is a function in clojure that retrives the current working directory?

5:27 jdz: sfuentes: that's a Java question.

5:33 ,(.getCanonicalPath (new java.io.File "."))

5:33 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)

5:33 jdz: good bot, good

5:35 sfuentes: actually what i'm trying to do is open/read a file from a jar from which clojure is executed

5:35 from what i understand i should be using getResource

5:39 hoeck: sfuentes: or getResourceAsStream

5:39 sfuentes: great! thank you

5:58 is there not an easy way of converting this InputStream into a string in clojure? It looks pretty ugly on the Java side

6:10 G0SUB: LauJensen: Logger.getLogger() takes a class name. do I need to use gen-class for that?

6:13 LauJensen: (def *logger* (Logger/getRootLogger))

6:13 (defn log* ([priority action thunk] (.log *logger* priority action) (let [retr (thunk)] (.log *logger* Priority/DEBUG (str '< action '>)) retr)))

6:13 (defmacro log [priority action & body] `(log* ~priority ~action (fn [] ~@body)))

6:25 hoeck: sfuentes: (.readLine (reader (.getResourceAsStream clojure.lang.PersistentHashMap "PersistentHashMap.class")))

6:26 G0SUB: are there any breaking changes to 1.0 in the current master?

6:26 hoeck: sfuentes: 'reader' is from the clojure.contrib.duck-streams package

6:26 AWizzArd: Oh nice, nvidia anounced that their java api for cuda is in work.

6:27 sfuentes: hoeck: awesome! thanks again

6:28 that is soo much nicer than doing in it in java

6:28 hoeck: sfuentes: of course :)

6:35 cschreiner: ...

6:49 G0SUB: has anyone used c.c.logging here?

6:50 how do I tell it to use a file for logging?

8:45 konr: has anyone already made a Clojure reference card?

8:45 chouser: I think I saw one

8:47 konr: http://clojure.googlegroups.com/web/clojure-cheat-sheet.zip

8:48 konr: haha thanks! You saved me an afternoon :)

8:48 chouser: you're welcome

8:56 ambient: pretty cool cheatsheet :)

8:57 serp: awesome sheet!

8:57 ambient: that could be linked in the clojure main page so more people knew about it

8:57 * rhickey pins it to his wall

8:58 rhickey: (just kidding :)

8:58 nice sheet though!

8:58 chouser: I'm glad that since there are people who like it, that there are others who were willing to make it.

8:59 rhickey: could someone with some CSS mojo produce an HTML version? It would be nice on the site

9:12 hamza: hey guys, i have a graphics object defined as [#^Graphics (:graphics surface)] but i still get (.setColor graphics) can't be resolved?

9:14 hoeck: hamza: and you supply a java.awt.Color object to .setcolor?

9:15 raek: rhickey: working on it now

9:15 hamza: hoeck: yes, same error for drawLine also (.drawLine graphics x y x y ) to paint a dot.

9:18 hoeck: hamza: and (type graphics) evaluates to Graphics or some descendant of the Graphics class?

9:19 hamza: evaluates to Graphics

9:22 hoeck: hamza: can you paste your code to lisppaste?

9:23 hamza: sure

9:24 snowwhite: I am using Emacs-starter-kit. To start the lisp process i do clojure-project but i figure out what exactly it does under the cover?

9:24 Chousuke: you can take a look at it. :)

9:24 snowwhite: I am using Emacs-starter-kit. To start the lisp process i do clojure-project but i am not able to figure out what exactly it does under the cover?

9:25 spuz: this is another really stupid question but, does clojure have 'else-if'?

9:25 Chousuke: spuz: cond

9:25 snowwhite: spuz, use cond

9:26 spuz: Chousuke: ah thanks

9:27 lisppaste8: hamza pasted "untitled" at http://paste.lisp.org/display/88004

9:28 hamza: i think my type hint is wrong because now it does not work, http://paste.lisp.org/display/88004

9:28 it thinks graphics is a persistant vector

9:31 liwp: hamza:

9:31 whoops...

9:31 hamza: yeah, the type hinting is broken

9:32 hamza: try this: (.drawLine #^Graphics graphics x y x y) and take the hint and the [] out from the let

9:33 if you do want to keep the hint in the let binding it should be something like this: (let [#^Graphics graphics (:graphics surface)] ...)

9:33 hamza: kk now it works. thx, i was following the example on clojure.org they are def'ed as (defn len2 [#^String x]... so thats why i typed my like that

9:33 liwp: at the moment you're binding a vector that to graphics

9:34 hoeck: hamza, liwp: yes, it is the vector around [#^Graphics (:graphics surface)]

9:34 liwp: yeah, that example is about a fun def so the args are in a vector

9:34 hamza: ahh damm it didn't notice that :P

9:34 liwp: but AFAIK even this won't work: (let [graphics #^Graphics (:graphics surface)] ..,)

9:35 i.e. the hint is in the wrong part of the binding

9:40 spuz: if I have a predicate function, how do I create an infinite lazy sequence of numbers for which the function is true?

9:41 I could use range + filter but this will create a sequence that terminates

9:43 mccraig: ,(take 5 (iterate inc 0))

9:43 clojurebot: (0 1 2 3 4)

9:43 mccraig: spuz: iterate and inc will give u an infinite seq of integers, see above

9:50 somnium: how to get to a nested enum from clojure? according to api it should be com.foo.bar.Klass.VerboseEnum(.VerboseEnumFirst...), but class not found, and repl-utils show doesn't indicate that VerboseEnum exists in Klass

9:52 cgrand: somnium: $ instead of . when nested

9:53 somnium: thanks!

10:44 Fossi: eh

10:44 the conversation that you just had turned up in a google search for clojure enum i just made ;D

10:45 hamza: hehe google is fast but i hate it when i search for something and stumble on my question and no answer..

10:46 Fossi: pretty amazing actually

10:47 hamza: btw, does take evalutes the items in the lazy sequence?

10:47 clojurebot: lazy is hard

10:47 arohner: In this post, where does the function self-eval? come from? http://clj-me.blogspot.com/2009/05/need-for-more-lack-of-understanding.html

10:48 liwp: hamza: take is lazy as well

10:50 raek: is "#^data form" always equivalent to (with-meta form data) ?

10:50 liwp: raek: nope. #^foo is a type hint which I believe is mapped to :tag in the meta map

10:51 raek: ,(meta #^{:a 1} 2)

10:51 clojurebot: Metadata can only be applied to IMetas

10:51 liwp: so #^data form becomes somethng like (with-meta form {:tag data})

10:51 arohner: raek: you can see what it does by doing (meta #^data form)

10:52 zemariamm: hello guys

10:52 raek: ,(meta #^{:a 1} (list 1 2 3))

10:52 clojurebot: nil

10:53 raek: shouldn't that return {:a 1} ?

10:53 zemariamm: when I have a bug in my code, and it blows up why do I get an error meesage with (NO_SOURCE_FILE:0) instead of the filename and line number ?

10:57 Chousuke: raek: no, #^{} is read-time

10:58 raek: you're actually adding metadata to the list '(list 1 2 3)

10:58 not to '(1 2 3)

10:58 raek: ah

11:00 liwp: ,(meta #^{:a 1} [1 2 3])

11:00 clojurebot: {:a 1}

11:00 liwp: ,(meta #^{:a 1} '(1 2 3))

11:00 clojurebot: nil

11:00 Chousuke: liwp: that happens because [1 2 3] evaluates to itself :)

11:01 raek: anyway, I've been converting the cheat sheet to html

11:01 liwp: so is there any way to associate meta data to lists?

11:01 raek: http://raek.se/clojure-cheat-sheet.html

11:01 Chousuke: ,(meta '#^{:a 1} (a 1 b))

11:01 clojurebot: {:a 1}

11:01 raek: I've done page 1 so far

11:01 Chousuke: note the position of the quote

11:01 liwp: ahh, the quote's before the meta data. clever

11:01 raek: I was thinking about expanding a little on the #^ reader macro

11:01 zemariamm: guys, when I have a bug in my code, and it blows up why do I get an error meesage with (NO_SOURCE_FILE:0) instead of the filename and line number ? it there any way of having a stack trace ? that would very helpful

11:01 ?

11:02 Chousuke: you can also use with-meta of course

11:03 liwp: so how does #^{:a 1} relate to type hints?

11:03 raek: #^{:tag ClassName} form

11:03 #^ClassName form

11:04 the compiler treats :tag metadata as a type hint

11:04 liwp: so #^Foo gets turned into #^{:tag Foo} by the #^ reader macro?

11:05 or probably more specifically it gets turned into (with-meta ... {:tag Foo})

11:05 raek: yes, passing a symbol instead of a map is a shorthand of a map with the :tag mapping set to the symbol

11:06 liwp: ok, thanks

11:07 ,^'#^{:a 1} (1 2 3)

11:07 clojurebot: {:a 1}

11:07 liwp: yay

11:09 Fossi: ,^'#^

11:09 clojurebot: EOF while reading

11:09 Fossi: ,^#^'

11:09 clojurebot: EOF while reading

11:09 Fossi: :(

11:09 chouser: the #^ reader macro does not expand to (with-meta ...)

11:10 both attach metadata, but they do so at different times.

11:10 liwp: chouser: I thought that might be the case... what does it expand to?

11:10 opqdonut: it associates metadata directly with the next object to be read

11:10 right?

11:10 chouser: #^ doesn't expand to anything. It attaches the given metadata directly to the next form read, at read time.

11:11 if the next form is a literal, then at runtime that literal will still have its metadata

11:11 ,(meta #^java.util.Map {})

11:11 clojurebot: {:tag java.util.Map}

11:12 liwp: with-meta calls withMeta on the IObj. Is that what the reader does as well?

11:12 chouser: if the next form is *not* a literal, but is instead an expression, a special form (like quote), etc. then by runtime it's likely that the object returned at runtime is a different one and therefore has no metadata on it.

11:13 liwp: ok

11:13 chouser: ,(meta #^java.util.Map '{})

11:13 clojurebot: nil

11:14 chouser: ,(meta #^{:my :meta} (if true {:val true} {:val false}))

11:14 clojurebot: nil

11:14 liwp: so the metadata is attached to the expression before it's evaluated?

11:14 chouser: liwp: exactly

11:14 ,(meta (with-meta (if true {:val true} {:val false}) {:my :meta}))

11:14 clojurebot: {:my :meta}

11:15 liwp: why isn't the metadata attached to the value of the expressions instead?

11:15 I'm sure there's some reason for it...

11:15 chouser: liwp: because #^ is used to communicate to the compiler, before anything has been evaluated

11:16 jeremy___: this is probably a simple question, but I have a function with two arguments (f [x y]) is there an easy way I can reverse the parameters so that I can create a partial fixing the second argument?

11:16 rhickey: the #^ metadata is a read time thing and thus has to end up on the read-time data

11:16 from there, the compiler may interpret it as part of evaluation, e.g. treating :tag metadata on symbols and lists as type hints

11:16 liwp: so if #^ would expand to e.g. with-meta we wouldn't be able to use it for type hinting etc.?

11:17 Chousuke: correct.

11:17 stuartsierra: jeremy___: #(f %2 %1)

11:17 rhickey: some metadata is evaluated as flow-through when the expression is itself a data literal, e.g. vectors and maps. But lists aren't data literals

11:17 jeremy___: stuartsierra: ah thanks! I thought it was something simple

11:17 liwp: ok, cool

11:18 chouser: part of why the difference between #^ and with-meta isn't obvious is that at lots of points metadata is copied from the compile-time thing to the runtime thing, like (def #^{:my :meta} foo) getting copied to the Var

11:22 zemariamm: guys, how can i configure clojure to give me the stack trace (or at least tell me the file and the line number) of the program when a bug occurs ?

11:22 chouser: zemariamm: plain terminal repl, emacs slime/swank, or something else?

11:23 zemariamm: chouser: emacs slime/swank

11:23 liwp: if I add meta data to a var, e.g. (def #^{:a 1} foo 1), I can't see it with (meta foo) only with (meta #'user/foo)

11:24 chouser: liwp: right. that def added metadata (at read time) to the symbol foo.

11:24 liwp: and (meta foo) is looking at the meta data attached to the value rather than the var?

11:24 Chousuke: yes

11:24 liwp: ok

11:24 Chousuke: it's a bit confusing I guess :D

11:24 chouser: def, at runtime, copied that metadata from the symbol to the Var (not the value)

11:25 rhickey: (anything foo) is being passed the value of the var foo, and not the var itself

11:25 chouser: The value is an Integer which doesn't even support metadata.

11:25 rhickey: that includes meta

11:25 Chousuke: firstly, the symbols can have metadata, then, vars can have metadata, and even values can have metadata :P

11:25 chouser: except when anything == var :-)

11:26 Chousuke: and in some cases the values can be vars or symbols, further confusing the poor programmers.

11:26 rhickey: Chouser: no

11:26 Fossi: so, again, how do i get at the values of an enum? (.FIELD EnumClass)?

11:26 rhickey: same evaluation for vars in head

11:26 Chousuke: Fossi: EnumClass/FIELD?

11:27 chouser: rhickey: 'var' is not passed the value of the var foo, but because it's a special form it just gets the symbol foo, right?

11:27 Fossi: thanks

11:27 rhickey: using the-name-of-a-var designates it's value unless it is a special form like var

11:27 its

11:28 Chouser: oh, now I see, yes

11:28 I thought you meanty when anything is a var, you mean when anything is var

11:28 zemariamm: chouser: any hints ?

11:28 chouser: rhickey: ah! heh. yes.

11:29 zemariamm: nope, sorry -- maybe somebody here who uses slime can help

11:29 zemariamm: chouser: tks anyway :)

11:30 liwp: zemariamm: I don't usually see filename/line number in traces in slime

11:30 zemariamm: sometimes you can look at the cause of the trace and that'll give you more information

11:30 zemariamm: liwp: how do you find the bugs then ?

11:30 liwp: humm is this case it was dawn hard, let me give you an example

11:32 liwp: i was executing clojure.set/select, think it would return a list instead of a set

11:32 liwp: zemariamm: let me rephrase that: I don't see source files / line numbers in the exception message, but I do see them in the actual backtrace

11:32 zemariamm: liwp: no backtrace

11:32 liwp: zemariamm: so I look for files in the trace that are part of my project

11:33 zemariamm: liwp: If i have this: (nth (clojure.set/select #(= (mod % 2)) #{1 2 5 10}) 0)

11:33 liwp: zemariamm: and looking at the cause ('Throw cause of this exception' in slime) can then sometimes show more information

11:33 zemariamm: liwp: somewhere in a file

11:34 liwp: i get this message java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.LazySeq (NO_SOURCE_FILE:0)

11:34 liwp: slime doesn't give me for info than this I think

11:35 liwp: zemariamm: you don't see a stack trace?

11:35 zemariamm: liwp: exactly

11:35 liwp: I get an UnsupportedOperationException

11:35 zemariamm: (but i think I used to see it)

11:35 liwp: me too, If i run the line directly in the Repl

11:36 liwp: it should opens a new emacs window, are you running e.g. AquaMacs which does weird things to windows?

11:36 zemariamm: are you sure that line is the issue then?

11:36 and if you run that line in the repl do you see a stack trace?

11:36 zemariamm: liwp: AquaMacs actually, with (tool-bar-mode -1)

11:37 liwp: and (scroll-bar-mode nil)

11:37 liwp: actually in the code the seq is a lazy one

11:37 liwp: to be honest though, I tend to run everything from the repl, i.e. I load a file of code which defs a bunch of stuff and then I call it from the repl

11:38 zemariamm: yeah me too

11:38 liwp: yeah me too

11:38 liwp: I have a much of kb macros to load my code and then just call the defn directly, but i get a NOSOURCE_FILE msg

11:39 liwp: and no trace...

11:40 zemariamm: liwp: and added an expression to my code (/ 10 0) in a file, loaded the file (with use :reload-all namespace)

11:40 liwp: and the error mensage i got was java.lang.RuntimeException: java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)

11:40 liwp: without knowing the line number it could be hell to find it

11:41 liwp: in our installation you get the file and line number right ?

11:41 liwp: may I ask you which version of clojure and java are you using ?

11:41 liwp: maybe it's the params I use to load the JVM ?

11:41 liwp: zemariamm: clojure from github and java 1.6.something

11:41 I think it's a swank-clojure issue

11:42 i.e. swank-clojure does not pass in the file name and line numbers when the source is injected

11:42 zemariamm: let me try to run it by the terminal ( I think I tried that already but)

11:42 liwp: that makes sense

11:42 liwp: on the terminal you should see the line numbers and the file name

11:42 zemariamm: liwp: but I could sear it worked before

11:43 chouser: in a terminal, no stack trace is printed by default, just the exception.

11:43 To see the whole trace, use (.printStackTrace *e)

11:44 zemariamm: liwp: nope, in the terminal same result

11:44 liwp: Listening for transport dt_socket at address: 8888

11:44 Clojure 1.0.1-alpha-SNAPSHOT

11:44 user=> (use 'c3po.state.database)

11:44 nil

11:44 user=> (run-offline "5ahfrah0l500glaht500l0rad0r00kl05" "wlhh0r")

11:44 java.lang.RuntimeException: java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)

11:44 user=>

11:44 ops sorry guys

11:45 chouser: zemariamm: To see the whole trace, use (.printStackTrace *e)

11:45 * rhickey is thinking (again) about a js macro

11:45 somnium: zemariamm: trace macros in contrib are also helpful

11:45 chouser: rhickey: are you writing js code??

11:46 zemariamm: chouser: it actually shows the stack trace using that expression but it still says NO_SOURCE_file

11:46 rhickey: Chouser: trying to avoid it :)

11:46 chouser: zemariamm: you should see file names and line numbers in the stack trace itself

11:46 rhickey: I want Clojure-like syntax (and macros) with js semantics

11:46 somnium: I have half a library with a couple control structures and mostly jquery wrappers...

11:46 chouser: rhickey: oh, I see. you want ... yeah.

11:46 rhickey: which isn't even ClojureScript.

11:47 zemariamm: chouser: YES, actually in the end of the stack trace it is showing

11:47 rhickey: not the same as ClojureScript, more like parenscript

11:47 zemariamm: chouser: is it possible to make the printing of the stack tarce default ?

11:47 somnium: I saw something about adding a heredoc reader macro in a mailing list from last year, is that still a possibility?

11:48 rhickey: but the fun of it would be that it could be a start for cinc in that it would be all-clojure analysis, of whatever primitives are supported

11:48 a lot like the very very early Clojure where I was considering targeting JS, given Rhino and MS JScript compilation

11:49 * rhickey looks for old notebook

11:49 chouser: zemariamm: look at clojure.main/repl-caught

11:50 zemariamm: you may be able to use 'binding' or something to handle repl exceptions yourself.

11:50 rhickey: this is what I do when I want to avoid the tedious and painful reality of bridge method generation in reify...

11:50 chouser: rhickey: ha!

11:51 * chouser avoids drudgery by answering questions here...

11:51 zemariamm: chouser: great idea!! I ll try it right away :) thanks :)

11:52 chouser: rhickey: I mentioned the idea of writing something to convert Compiler's current java-object tree into a clojure collections tree as a step toward cinc

11:53 rhickey: I was wondering if you care to share any thoughts about when cinc's ast would look like. no metadata at all? metadata for almost everything what was in the original reader output?

11:53 s/when/what/

11:53 rhickey: Chouser: that's an idea, I think the problem is you won't get a cinc very different from the current Java compiler

11:54 chouser: you're expecting the ast to be very different?

11:54 rhickey: Chouser: I think it may all be actual data, not metadata

11:55 Chouser: well, I want it to be more functional, that may only be in the mechanics of analyze and not the AST

11:56 chouser: no metadata makes sense -- filenames, line numbers, etc. all there right next to type hints, special-form names, etc.

11:56 rhickey: but the environments disappear, and that isn't helpful for tools, since they just need to reconstruct them

11:56 so I'd like to do better there

11:56 chouser: right, I was thinking it would actually be easier to write a functional compiler if there were an example of the immutable output to look at and aim for.

11:57 rhickey: Chouser: definitely

11:57 chouser: what do you mean by environments

11:57 ?

11:57 rhickey: Chouser: what the names signify at any point

11:58 LOCAL_ENV

11:58 chouser: a name's namespace or the fact that its a local, for example?

11:58 oh

11:58 rhickey: that flows through the process then vanishes

11:59 stuartsierra: rhickey: What are the barriers to a 1.1 release right now?

12:00 chouser: stuartsierra: just as soon as cinc is done ...

12:00 :-)

12:00 stuartsierra: Seriously, I don't want to wait for cinc.

12:00 chouser: I'm kidding.

12:00 stuartsierra: I know. :)

12:00 rhickey: stuartsierra: need to make some decisions as to what's in or not, for instance there is new work sitting around in par and new branches

12:00 cinc is not 1.1

12:00 par could wait

12:01 stuartsierra: So could newnew/reify, I think.

12:01 rhickey: newnew/reify would be really nice, but come with a bunch of new code that I imagine few have tried

12:02 chouser: transients and chunks are perhaps big enough for 1.1?

12:02 stuartsierra: You've still got transients, chunks, several new namespaces from testing, and various small improvements...

12:03 I have an ulterior motive: I'm trying to get swank-clojure and an updated clojure-maven-plugin released on Maven central.

12:03 rhickey: yes, it's not a bad spot, but transients and chunks still aren't shaken out. Maybe that's just a matter of calling it RC1 and getting more usage

12:04 stuartsierra: I'd go for that.

12:04 rhickey: there are still a bunch of things marked for next release with no patches, and some patches not applied

12:04 chouser: additions to LOCAL_ENV would be explicit at each level of the ast, so recreating would be just a merge of those on the way down the tree

12:05 stuartsierra: rhickey: ok, anything I can help with? (I have some clojure.test patches)

12:05 rhickey: Chouser: right, but we could just leave in the AST

12:06 chouser: rhickey: at every node or just 'fn' nodes?

12:07 rhickey: Chouser: maybe every node that might bind, like lets as well

12:08 chouser: ok

12:08 technomancy: stuartsierra: how's pom-ifying swank-clojure going?

12:08 is it ready to merge back upstream?

12:08 slyrus_: if I have a list of things that I want to turn into array-maps, is there a more idiomatic way than: (map #(apply array-map %) ...)

12:09 stuartsierra: technomancy: Jeffrey Chu is willing, doesn't know Maven. I've re-forked, making a clean POM without dependencies on any of my stuff.

12:09 somnium: layman question about initializing state <- is there a practical difference between putting an atom in a map and swapping it with function calls, or using macros that def functions in a namespace? - like while loading modules before starting a server

12:09 rhickey: stuartsierra: you have patches not yet submitted?

12:09 technomancy: stuartsierra: cool. Jeffrey and myself are both maintainers, so I can help too if you need anything.

12:09 stuartsierra: rhickey: no, I think they're all in there

12:09 somnium: and is there a preferred approach?

12:10 stuartsierra: rhickey: need to fix one bug related to TAP, haven't written patch yet

12:10 technomancy: cool, didn't know you were officially maintaining, will send POM to you as soon as it's finished.

12:11 rhickey: stuartsierra: are they marked as "test"? otherwise I don't know there's a patch to look at

12:11 stuartsierra: rhickey: ok, will check

12:11 technomancy: stuartsierra: I don't think jochu does much clojure these days

12:11 chouser: there are 2 approved tickets with no patches, 5 with unapplied patches, and 27 fixed

12:11 stuartsierra: technomancy: ok, good to know

12:13 rhickey: Chouser: approved with no patches?

12:16 chouser: I should say 2 approved but "new". One has bad patches for an ant guru to fix.

12:16 The other is left "as new for any bugfixes"

12:17 rhickey: ok, I see

12:18 chouser: I would need to think about agent errors queues more before doing anything there.

12:24 stuartsierra: technomancy: my swank-clojure fork, with POM: http://github.com/stuartsierra/swank-clojure

12:30 technomancy: stuartsierra: is it ready for a merge then?

12:30 and your changes are all pom-related?

12:30 stuartsierra: technomancy: should be; give it a try. I only added the pom.xml, but I rearranged all the source directories to make Maven happy.

12:32 technomancy: stuartsierra: OK, I'll see if I can take a look at that later today

12:32 thanks

12:32 stuartsierra: no problem

12:35 hamza: guys, when is clojure.lang.MultiFn.invoke is invoked? i have a function that does complex number crunching and from profiler all time is spend 70% on this call?

12:37 rhickey: hamza: whenever a multimethod is called

12:41 hamza: i am assuming its the + * from the complex library, is it possible to call them directly and not through multi function? they are called 200xbillion times it may help..

12:46 johnmn31: what is cinc?

12:47 stuartsierra: clojure-in-clojure, the plan to reimplement most of Clojure in Clojure itself

12:47 johnmn31: ah, ok

12:51 stuartsierra: If your language isn't self-hosting then language geeks will make fun of you. ;)

12:51 ambient: heh, that sounds like a really severe problem

12:52 hiredman: plus, if clojure is cinc, and you write in clojure, you are in cinc

12:54 stuartsierra: ouch

12:54 hiredman: ~laugh

12:54 clojurebot: ha ha

12:55 hiredman: ~laugh is also <repl>#who, find another sycophant

12:55 clojurebot: Ok.

13:38 wooby: hi, i'm working on a small program to save occurrences of words in a hash map

13:38 i'm able to build my map with no problems, but i'd like to display the words in order of number of occurrences... and not sure how to go about it

13:39 i think i'm not able to sort a hash map by values, is this correct? should i convert it to some sortable data structure?

13:39 code: http://gist.github.com/199121

13:41 thanks in advance for tips

13:41 LauJensen: Can I give some kind of Thread priority to a future ?

13:42 wooby: http://clj-me.cgrand.net/2009/05/04/counting-without-numbers/

13:43 chouser: ,(sort-by second {"this" 2 "pants" 1})

13:43 clojurebot: (["pants" 1] ["this" 2])

13:44 cgrand: LauJensen: you mean http://clj-me.cgrand.net/2009/04/27/counting-occurences/

13:44 LauJensen: cgrandI just picked one, they all seem to work generically

13:45 wooby: LauJensen: awesome, thank you

13:45 tomoj: ,(sort-by val {"this" 2 "pants" 1})

13:45 clojurebot: (["pants" 1] ["this" 2])

13:46 chouser: tomoj: even better

13:46 LauJensen: Can I give some kind of Thread priority to a future ?

13:47 tomoj: oh, he left

13:48 chouser: LauJensen: don't think so

13:50 LauJensen: I don't even see a way for Executors to manage priority, let alone as abstracted by agent or future

13:50 LauJensen: Ok, my best bet is to hog the main thread then ?

13:51 chouser: I wouldn't assume the "main" thread will get any higher priority than the others.

13:51 LauJensen: It doesn't, I can see that now

13:53 cgrand: chouser: you can pass a ThreadFactory when creating an executor, the factory can set the priority

13:53 chouser: cgrand: ah, thanks.

13:56 maybe you could call setPriority on yourself in the future closure?

13:56 hoeck1: LauJensen: you could patch clojure.lang.Agent to submit your future to a lower/higher priority ExecutorService

13:57 LauJensen: Ok thanks

13:57 hoeck1: LauJensen: but the book says: "avoid the temptation to use thread priorities..." :)

13:57 LauJensen: But I need more juice! :)

13:57 chouser: hoeck1: which book?

13:58 hoeck1: chouser: JCIP

13:58 chouser: ah

13:58 LauJensen: Anybody have a quick guide on how to attach a profiler - As I recall JSwat connects very easily once you start the JVM with a param ?

13:59 chouser: LauJensen: I've been using jvisualvm, which comes with sun's jdk I think.

13:59 hoeck1: chouser: and setting the thread priority in the future is a bad idea, since its thread will be reused (likely)

13:59 chouser: hoeck1: exactly.

13:59 hoeck1: +1 for jvisualvm

13:59 LauJensen: k

13:59 chouser: LauJensen: I run jvisualvm and it lists all the running clojure repls. I just pick one and 2 clicks later it's profiling.

14:00 LauJensen: Wow - That a little easier than JSWat even

14:00 I have JDK6 here, but no jvisualvm

14:01 chouser: LauJensen: here on ubuntu it's /usr/lib/jvm/java-6-sun/bin/jvisualvm

14:02 not in the PATH for some reason.

14:02 LauJensen: ah, thanks - Didn't think to check locate

14:04 I'm already profiling, fantastic

14:09 Seems like 'future' and 'deref' are hogging 40% of the cpu-time :P

14:09 wooby: in that count-occurrences blog post's use of 'reduce,' it looks like in that form reduce behaves like foldl... is that correct?

14:11 chouser: I think so

14:11 wooby: awesome

14:12 thanks again for the link, i'm out for now

14:12 boiling 30 lines down to 1 rules

14:15 LauJensen: yea, like fixing 1500 bugs with 1 line of shell-script "rm *.php" :)

14:23 rhickey: where does maven want source code? (dir structure)

14:23 clojurebot: source is http://github.com/hiredman/clojurebot/tree/master

14:24 chouser: rhickey: src/main/clojure/my/great/library.clj

14:24 rhickey: thanks

14:24 chouser: if you have a Clojure namespace called my.great.library

14:25 http://stuartsierra.com/2009/09/03/mavens-not-so-bad

14:26 sproingie: funny thing how close "pom.xml" looks to "porn.xml" in some fonts

14:27 stuartsierra: POMs probably qualify as XML-porn.

14:27 sproingie: more like xml snuff

14:28 maven doesn't even use a real xml parser. can't validate, because tag content is pretty much arbitrary

14:29 stuartsierra: It does its own validation to some extent, because it throws exceptions if you put tags in the wrong places. But there's no schema.

14:29 LauJensen: rhickey: I'm guessing you would know. I've just done a purely functional implementation of a cellular automata, it updates every cell at a speed of 0,032msecs, doing an iteration on a 80x80 board in 200 msecs. That's incredibly slow compared to imperative implementations, is that to be expected from functional code, or should I work on optimizing? (not that I can think of more to do)

14:29 sproingie: yeah the validation is ad-hoc

14:30 LauJensen: is it short enough to pastebin?

14:31 LauJensen: sproingie: Yea, but it's more of a general question, the code is (I think) fully optimized

14:34 cgrand: LauJensen: it churns too much memory. Transients may help but not with this implementation.

14:34 chouser: LauJensen: one benefit of higher-level languages in general and functional ones in particular is that more complex algorithms may be easier to implement

14:35 LauJensen: Yes there's no doubt about that - But the performance is still surprisingly bad

14:35 chouser: I'd recommend pursuing algorithmic improvements before getting down to optimizing a particular approach.

14:38 rhickey: cgrand: what's the implementation?

14:42 LauJensen: rhickey: If you're asking about my memory eating code, its this http://gist.github.com/198457

14:42 lines 28 -> 54 are the interesting ones

14:42 hiredman: is this life?

14:43 LauJensen: Brians brain

14:44 hiredman: I see

14:47 rhickey: LauJensen: you won't come close to an imperative version like that, but you could do much better with vector for board

14:47 danny: hey i need help real quick, is there a way to have the if statement do more than one thing if statement is true?

14:47 raek: rhickey: the cheat sheet in html: http://raek.se/clojure-cheat-sheet.html

14:48 rhickey: raek: awesome! ok if I put on the site?

14:48 raek: danny: "do" and "when" might be what you are looking for

14:48 chouser: danny: (if true-thing (do step1 step2 step3)) ... or just use 'when'

14:48 raek: rhickey: of course! go ahead...

14:49 (when true-thing step1 step2 step3)

14:49 when does not have a false-branch, though

14:51 Chousuke: that cheatsheet has lazy-cons :P

14:53 chouser: that's what comes of cheating

14:55 raek: rhickey: also, I think that the original pdf version should be linked to

14:55 LauJensen: alright, thanks rhickey

14:55 raek: the layouting in html is, well, unpredictable at some times

14:56 so, if anyone wants to print it, they should be able to find the good version

14:56 danny: k thanks a lot probably should read documentation more lol

16:23 rhickey: http://clojure.org/cheatsheet - thanks to Steve/Rasmus/Tom!

16:26 thickey: rhickey: np

16:27 arbscht: nice!

16:29 rys: An, that's brilliant

16:30 dnolen: (= 'cheatsheet 'awesome) -> true

16:33 rys: In fact, that's bloody brilliant. I think I'll tear down my notes from the corkboard behind my monitor and just print that out

16:41 stuartsierra: great

17:11 raek: thickey: may I suggest something?

17:11 a direct link to the PDF (and maybe the gray-scale version too), called something like "printable version" would be really be useful

17:11 because, if people's gonna print the cheat sheet, they should *really* print the PDF

17:31 thickey: raek: i agree that a direct link would be good. though google groups file links are always indirect.

17:32 rhickey: would you be fine with me putting the pdfs in the file section of the wiki?

17:33 arbscht: thickey: isn't there a copy on github?

17:33 http://cloud.github.com/downloads/richhickey/clojure/clojure-cheat-sheet-a4-grey.pdf

17:34 thickey: arbscht: evidently ;)

17:58 raek: added the link to pdf on github in addition to original source zip (thanks for heads-up arbscht)

18:00 spuz: thickey, are you aware of the problem with the search on clojure.org?

18:01 it took me a while before I noticed all the results at the bottom of the page :p

18:02 raek: thickey: nice!

18:02 but now I realized that I forgot to tell you that I imagined the link to be at the top of the page

18:02 the cheet sheet is rather long, so people might miss the link if it's at the bottom

18:02 this was my thought

18:02 sorry for nagging... :)

18:02 you have done a great job with the website

18:02 now I will be quiet.

18:03 thickey: spuz: i was not... that's pretty bad! thanks for letting me know

18:03 raek: my first instinct was to put it up top, but rhickey had it down below (wasn't sure if there was a reason for that)

18:03 spuz: heh, glad to help :)

18:04 thickey: raek: no need to be quiet, feedback is always welcome

18:04 raek: ok, great!

18:11 LauJensen: A post about cellular automata, specifically Brians brain, http://www.dzone.com/links/brians_functional_brain_in_clojure.html for those who are interested :)

18:15 spuz: LauJensen: Looks interesting as always, lau. I'm going to work through that tomorrow and see what I can learn. Looking forward to see how you handle the parallelism and seeing how it performs on my quad core cpu :p

18:16 LauJensen: Yea that'll be interesting to see

18:17 spuz: I only have my laptop with me at the moment so that will have to wait, the difference in performance should be quite noticable I imagine tho :)

18:18 LauJensen: I would think so, about 40%. It hogs both my cores pretty effeciently

18:20 spuz: You said earlier to rich that you'd pretty much optimised the code as much as you could, is that the code you show in your blog post, or are you showing us the more idiomatic version?

18:21 LauJensen: This is the optimized idiomatic version :) There are 2 more things to do, 1) The board should be 1 vector, 2) Abstract some imperative code or similar - which I probably won't bother to do

18:22 spuz: ok

18:22 LauJensen: But last time I put code up, I got 3 revisions within the following 36 hours - so who knows what will happen :)

18:22 spuz: hehe :)

18:22 well till tomorrow

18:23 LauJensen: Ta ta :)

18:23 mccraig: what is the idiomatic way of concatenating two vectors into a vector ? i can think of (apply conj a b) or (into [] (concat a b)) ...

18:23 hiredman: mccraig: into works on non-empty things

18:24 (into [1 2 3] [4 5 6])

18:24 ,(into [1 2 3] [4 5 6])

18:24 clojurebot: [1 2 3 4 5 6]

18:24 mccraig: aha!

18:29 lisppaste8: miltonsilva pasted "euler 1" at http://paste.lisp.org/display/88046

18:29 miltonsilva: hi

18:30 hiredman: for

18:30 Chousuke: miltonsilva: hi

18:30 miltonsilva: that is one solution to the euler problem. but I would like to pass a list of divisors

18:30 euler problem 1

18:30 Chousuke: miltonsilva: 1) there's a "range" function for making a range, 2) the vector is not needed :)

18:31 miltonsilva: oh.. didn't noticed that

18:33 Chousuke: or hm, never mind 2). it's not a vector. you calling it vec just confused me :P

18:34 which probably means it's time for me to sleep! Good night.

18:39 ari__: help a newbie out. I have a def that calls clojure.xml/parse. If I want to search for specific elements, is zip the only way to do it? ideally i'd like a variable that contains the element that I have in mind

18:39 i've googled for hours looking for a decent example that's well-commented enough to work from

18:42 arbscht: ari__: is zip insufficient? there's also clojure.contrib.zip-filter

18:42 hiredman: you can just use filter and map

18:43 http://gist.github.com/184831

18:43 the output of zip-soup is clojure.xml/parse output

18:47 ari__: neither are insufficient exactly, I guess I was just confused; I figured that since there were accessors attached I could do something like (:blah get-tree) (get-tree is the name of my function)

18:47 hiredman: eh?

18:47 ari__: where :blah is the name of an element, like :currentTime

18:47 but I guess I was wrong

18:47 i'm fairly new to lisp altogether and programming, so

18:47 not really clued

18:48 hiredman: (:blah get-tree) would work if get-tree is a Map

18:48 that is what keywords used as functions do, they look themselves up in a map

18:49 ari__: but clojure.xml/parse doesn't output as a map, right?

18:49 hiredman: it does

18:50 dthomas: But the keys are not elements, IIRC.

18:50 ari__: yeah, I mean that doesn't throw an error or anything, but the output is blank. e.g. (str (:currentTime get-tree))

18:52 arbscht: you aren't calling get-tree there

18:53 hiredman: and the output of parse is not going to have a key :currentTime

18:53 ,(-> "<?xml version="1.0"?>

18:53 clojurebot: EOF while reading string

18:53 hiredman: er

18:53 ari__: let me rephrase my question: how do I get to the content of the element when it looks like http://gist.github.com/199303

18:56 hiredman: ,(-> "<?xml version=\"1.0\"?> <foo/>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse)

18:56 clojurebot: {:tag :foo, :attrs nil, :content nil}

18:57 hiredman: well, you have a map there

18:57 with the keys ::tag :attrs and :content

18:58 er, :tag

18:58 and thats not the whole datastructure

18:58 ari__: no

18:58 it's just a part of it

18:58 i'm just wondering, can I get to currenttime's content easily

18:58 without using zip

18:58 hiredman: sure

18:59 you take the :content of blah, search for :currentTime and take it's :content

19:00 ,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse)

19:00 clojurebot: {:tag :foo, :attrs nil, :content [{:tag :bar, :attrs nil, :content nil} {:tag :baz, :attrs nil, :content ["some content"]}]}

19:01 hiredman: ,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content ((partial filter #(= :baz (:tag %)))))

19:01 clojurebot: ({:tag :baz, :attrs nil, :content ["some content"]})

19:01 hiredman: ,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content ((partial filter #(= :baz (:tag %)))) :content ((partial apply str)))

19:01 clojurebot: ""

19:01 hiredman: bah

19:01 ,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content ((partial filter #(= :baz (:tag %)))) :content)

19:01 clojurebot: nil

19:01 hiredman: ,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content ((partial filter #(= :baz (:tag %)))) first :content ((partial apply str)))

19:02 clojurebot: "some content"

19:03 hiredman: you have a nested structure of maps and vectors that you need to traverse

19:06 ari__: is most of how to do that covered in programming clojure?

19:06 hiredman: ari__: uh, it's pretty simple

19:07 dthomas: ari__: If you ever want to use zippers on your XML, I learned them recently and found them to be just what I needed. I made a quick example at http://gist.github.com/199309 .

19:08 ari__: dthomas, that example is pretty helpful

19:08 thanks

19:09 it's not that I didn't want to use zippers, but I got the idea they were for modifying trees as opposed to just reading them

19:09 tomoj: also lets you query them easily :)

19:12 ari__: I guess I probably need to go sit down with SICP, and then programming clojure

19:12 it's my first language, probably not the best choice, but it's what I want to use :)

19:13 ambient: first language ever? if i'd be in the similar position i'd perhaps start with scheme and sicp

19:13 LauJensen: ambient: are you nuts?

19:13 ambient: how so?

19:13 LauJensen: You're telling a guy who wants to pick up Clojure to go hang with the Flintstones?

19:14 ambient: clojure introduces a lote more new concepts than scheme does. it may be easier to grok the functional programming style with scheme when there are no additional obstacles

19:14 ari__: isn't SICP a good mechanism to learn functional programming & programming in general?

19:14 that's what I understood

19:14 LauJensen: ari__: It sure is

19:15 ari__: well, last I checked, there was no current entrance into programming from clojure

19:15 in book form

19:15 LauJensen: ambient: Ok - I get where you're coming from... still a little nuts, good night guys :)

19:15 ari__: I thought programming clojure was a little more advanced and required you to have some java knowledge

19:15 ambient: LauJensen btw nice article, hope you continue writing :)

19:15 LauJensen: Thanks ambient :)

19:16 hiredman: http://sicpinclojure.com/

19:17 ambient: "you should not be here yet." heh

19:17 hiredman: yeah

19:17 anyway, that is just one of a few efforts

19:18 ambient: that might be an interesting read, just to see how much the absence of tail call optimization hurts clojure if any

19:18 ari__: Wow!

19:19 That's awesome hiredman. Thanks!

19:20 hiredman: I dunno that he has actually gotten that far

19:21 ari__: he hasn't

19:21 but it's good to know there's an effort

19:49 http://lolwat.net/?w=534f0698de5b616377460b8b93dcbec3

20:44 kevin__: hey all, anyone using the quasiquote form mentioned in this thread: http://groups.google.com/group/clojure/browse_thread/thread/6d0c5f7e37909055/3a8fa4e4d680a38a?hl=en&ie=UTF-8&q=quasiquote+clojure#3a8fa4e4d680a38a

20:54 quidnunc: Is there a function that will return a function that applies its argument (a function) N times?

20:55 hiredman: #(dotimes [i n] (f))

20:56 quidnunc: thanks

20:56 hiredman: dunno why you'd apply a function more than once, because the answer would always be the same

20:56 quidnunc: the function takes args

20:57 hiredman: so?

20:57 a function on the same set of args always has the some output

20:57 quidnunc: Er, I guess your solution doesn't work

20:57 for what I want to do. (f (f x))

20:57 hiredman: ,(doc iterate)

20:57 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

20:57 kevin__: you mean if n is 3 (f (f (f x)))

20:58 quidnunc: iterate is what I want, thanks.

21:50 Is there a way to use -> with anonymous functions?

21:53 arbscht: ,(-> 5 (#(* % %)))

21:53 clojurebot: 25

21:53 arbscht: ugly :)

21:54 quidnunc: Okay, thanks.

21:58 tomoj: is ~'foo the proper way to get unhygienic variables in a macro?

22:04 chouser: yes

22:05 to the extent that unhygienic variables can be proper, anyway.

22:05 tomoj: hmm.. how does this look? http://gist.github.com/b99ca5c6e87318540cf5

22:05 I felt like I needed them for defn and let

22:06 arbscht: why not gensym?

22:06 tomoj: ah, yeah, forgot about that

22:07 chouser: yeah, use n# instead of ~'n

22:08 tomoj: that makes it look much better, thanks

22:11 hmm, that doesn't seem to work, though

22:12 because I've got multiple levels of quoting-unquoting

22:12 so n# in the nested ` gets a different gensym than n# in the toplevel ` :(

22:13 arbscht: ,(doc gensym)

22:13 clojurebot: "([] [prefix-string]); Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'."

22:16 kevin__: how does this work as compared to CL? cause the generated symbol could match something someone constructed later, in CL this is not possible right?

22:17 ,(gensym)

22:17 clojurebot: G__5134

22:17 tomoj: ,'G__5134

22:17 clojurebot: G__5134

22:17 tomoj: why wouldn't the same be possible in CL?

22:17 kevin__: those would be = right?

22:17 cause the second one would not be the same as the first in CL, not = right?

22:18 in CL gensyms are unreadable

22:18 tomoj: and it's impossible to construct them?

22:19 arbscht: thanks, using gensym manually worked

22:19 kevin__: it's impossible to get one through the reader that matches the gynsym'ed one i think, if that makes since, i think i need to provide an example, ...

22:20 tomoj: (deffizzer fizzbuzzbazz {3 "Fizz" 5 "Buzz" 7 "Bazz"}), (fizzbuzzbazz 105) -> "FizzBuzzBazz") :D

22:39 icey: are many people using an editor without slime? i've been wrestling with weird classpath issues for days and wondering if it's worth all the hassle

22:39 i mean... without it, it's just like programming in any other language that doesn't have a REPL, right?

22:40 ztellman: icey: what sort of problems are you having?

22:41 I just have slime invoke a script that has an exhaustive list of all the classpath stuff I want

22:41 icey: it can't seem to find swank.clj when i fire slime up

22:41 ztellman: oh, well that's a little different

22:41 I dunno about that one

22:42 icey: yeah; like i said, it's a weird thing; all my paths check out and everything, but I figure if it's not a big deal to use vim or textmate or something without a repl, maybe i'd just do that for awhile and go back to the problem later

22:46 tomoj: I'm using zip-filter.xml, but it seems difficult to reuse parts of filter chains

22:47 e.g. say you've got (xml-> doc :foo (attr= :bar "baz") :bing) which returns a bunch of elements, but then you'd like to do further filtering on these in different ways

22:47 it sucs to have to put the ":foo (attr= :bar "baz") :bing" where you want to do that

22:47 any ideas?

23:28 ztellman: if a java function takes a variable number of arguments, do I need to pass those arguments in as an array?

23:28 tha

23:28 that seems to be what's implied by the error I'm getting

23:33 JAS415: you shouldn't have to

23:33 what is the error

23:34 ztellman: com.nativelibs4java.opencl.CLDevice cannot be cast to [Lcom.nativelibs4java.opencl.CLDevice

23:35 per the javadoc, the signature is createContext(CLDevice... devices)

23:35 JAS415: hmm

23:35 you could try using make array or to array

23:36 ztellman: to-array doesn't work, because it's an array of objects

23:36 make-array will work, but is annoying

23:36 JAS415: ooh

23:36 yeah that is annoying

23:36 ztellman: because I have to first make the array, and then fill it in

23:36 JAS415: yup

23:36 could write a helper fn that does that i guess

23:36 ztellman: oh well, if that's what's required

23:36 yeah, I was just hoping I wouldn't have to

23:37 JAS415: yeah is kind of annoying to not have plain 'old java array syntax

23:37 for certain things

23:38 ztellman: I dunno, I have to assume that there could be an auto-translation for this particular situation

23:38 and I don't really care about arrays in other situations

23:39 JAS415: i was expecting to-array would do it, but if it returns array of objects that is annoying

23:39 mikem: ,(doc rfirst)

23:39 clojurebot: No entiendo

23:39 JAS415: into-array

23:39 try that one

23:39 ,(doc into-array)

23:39 clojurebot: "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

23:39 mikem: hm, rfirst is in the cheatsheet in the section "Using a seq": http://clojure.org/cheatsheet

23:40 JAS415: user=> (to-array ["fred" "ethel"]) [Ljava.lang.Object;@3f472b

23:40 user=> (into-array ["fred" "ethel"]) [Ljava.lang.String;@74e78a

23:49 arbscht: mikem: is it in clojure 1.0? I seem to recall it existing in old versions

23:49 mikem: arbscht: hm, perhaps. I'm running a git version, about a month old

23:50 and apparently so is clojurebot

23:51 another question: under "Reader Macros" is the entry: "#' | Var quote: @'x -> (var x)"

23:51 so is it #' or @'?

23:52 looks like it's #', and there's a typo in the example

23:53 arbscht: right

Logging service provided by n01se.net