#clojure logs

2009-10-01

00:14kunleyhi
00:15kunleyHow to define a print-method for a java array of some java objects?
00:15hiredmaneasiest is to just call seq on it
00:16hiredman,(into-array ["foo"])
00:16clojurebot#<String[] [Ljava.lang.String;@1a70476>
00:16hiredman,(seq (into-array ["foo"]))
00:16clojurebot("foo")
00:55slyrus_hrm... I see that I can use proxies to implement java interfaces, but can I subclass a java class?
01:46slyrus_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
01:46slyrus_any clues?
02:01hoeckslyrus_: that happens when you try to create a struct but supply a struct-map instead of a struct-map-definition
02:02hoecklike: (struct (struct (create-struct foo :a) 1) 1)
02:04hoeckslyrus_: 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
02:04slyrus_hoeck: yes, the second one. thanks!
02:04slyrus_that is to say it was a var with the same name that was mucking things up
02:06hoeckslyrus_: yeah, thats one of the drawbacks of a lisp-1
02:06slyrus_ah, right... clearly i'm used to a lisp-n...
03:28AWizzArd~ max people
03:28clojurebotmax people is 178
03:33Fossistill ;)
03:36AWizzArdnot bad for this time of the day
03:36AWizzArdgeht doch
04:09LauJensenAWizzArd: You mean the 148 ?
04:16G0SUBI 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.
04:16G0SUBis that a good approach?
04:27LauJensenG0SUB: 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.
04:28Chousukeyeah. put the check for *debug* in the debug macros themselves. having (if *debug* ...) scattered around the actual program logic is icky :)
04:30Chousukeyou could also simply have the *debug* be a global var and set it to true during development, and false afterwards. kind of like *assert*
04:30G0SUBChousuke: 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*
04:31LauJensenOh, 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
04:31G0SUBLauJensen: good idea.
04:31ChousukeG0SUB: hm, then the name *debug* might not be so good.
04:31Chousuke*verbose-xml* or something? :/
04:31G0SUBChousuke: yeah, that's fine too.
04:32G0SUBChousuke: It was just thinking if putting (if *verbose-xml* ...) in the low-level functions is a good way or not.
04:33Chousukewell, you might be able to make it a bit nicer with a macro
04:33G0SUBChousuke: would appreciate a small example.
04:34Chousukewell, I don't know the exact requirements so I'm not sure what you need.
04:34Chousukebut for example debug macros are usually done like (debug "whatever") and they expand to (if debug-enabled ...)
04:34G0SUBChousuke: ah, got it now.
04:36Chousukeif 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
05:13G0SUBOK. Are there any Clj wrappers over Log4J ?
05:13AWizzArdLauJensen: yes
05:14LauJensenG0SUB: As I recall it wasn't needed, so little interop
05:14G0SUBLauJensen: I am new to Log4J. how does one dynamically config it?
05:17LauJensenBy modifying an xml file
05:25sfuentesanyone know if there is a function in clojure that retrives the current working directory?
05:27jdzsfuentes: that's a Java question.
05:33jdz,(.getCanonicalPath (new java.io.File "."))
05:33clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
05:33jdzgood bot, good
05:35sfuentesactually what i'm trying to do is open/read a file from a jar from which clojure is executed
05:35sfuentesfrom what i understand i should be using getResource
05:39hoecksfuentes: or getResourceAsStream
05:39sfuentesgreat! thank you
05:58sfuentesis there not an easy way of converting this InputStream into a string in clojure? It looks pretty ugly on the Java side
06:10G0SUBLauJensen: Logger.getLogger() takes a class name. do I need to use gen-class for that?
06:13LauJensen(def *logger* (Logger/getRootLogger))
06:13LauJensen(defn log* ([priority action thunk] (.log *logger* priority action) (let [retr (thunk)] (.log *logger* Priority/DEBUG (str '< action '>)) retr)))
06:13LauJensen(defmacro log [priority action & body] `(log* ~priority ~action (fn [] ~@body)))
06:25hoecksfuentes: (.readLine (reader (.getResourceAsStream clojure.lang.PersistentHashMap "PersistentHashMap.class")))
06:26G0SUBare there any breaking changes to 1.0 in the current master?
06:26hoecksfuentes: 'reader' is from the clojure.contrib.duck-streams package
06:26AWizzArdOh nice, nvidia anounced that their java api for cuda is in work.
06:27sfuenteshoeck: awesome! thanks again
06:28sfuentesthat is soo much nicer than doing in it in java
06:28hoecksfuentes: of course :)
06:35cschreiner...
06:49G0SUBhas anyone used c.c.logging here?
06:50G0SUBhow do I tell it to use a file for logging?
08:45konrhas anyone already made a Clojure reference card?
08:45chouserI think I saw one
08:47chouserkonr: http://clojure.googlegroups.com/web/clojure-cheat-sheet.zip
08:48konrhaha thanks! You saved me an afternoon :)
08:48chouseryou're welcome
08:56ambientpretty cool cheatsheet :)
08:57serpawesome sheet!
08:57ambientthat could be linked in the clojure main page so more people knew about it
08:58rhickey(just kidding :)
08:58rhickeynice sheet though!
08:58chouserI'm glad that since there are people who like it, that there are others who were willing to make it.
08:59rhickeycould someone with some CSS mojo produce an HTML version? It would be nice on the site
09:12hamzahey guys, i have a graphics object defined as [#^Graphics (:graphics surface)] but i still get (.setColor graphics) can't be resolved?
09:14hoeckhamza: and you supply a java.awt.Color object to .setcolor?
09:15raekrhickey: working on it now
09:15hamzahoeck: yes, same error for drawLine also (.drawLine graphics x y x y ) to paint a dot.
09:18hoeckhamza: and (type graphics) evaluates to Graphics or some descendant of the Graphics class?
09:19hamzaevaluates to Graphics
09:22hoeckhamza: can you paste your code to lisppaste?
09:23hamzasure
09:24snowwhiteI 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?
09:24Chousukeyou can take a look at it. :)
09:24snowwhiteI 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?
09:25spuzthis is another really stupid question but, does clojure have 'else-if'?
09:25Chousukespuz: cond
09:25snowwhitespuz, use cond
09:26spuzChousuke: ah thanks
09:27lisppaste8hamza pasted "untitled" at http://paste.lisp.org/display/88004
09:28hamzai think my type hint is wrong because now it does not work, http://paste.lisp.org/display/88004
09:28hamzait thinks graphics is a persistant vector
09:31liwphamza:
09:31liwpwhoops...
09:31liwphamza: yeah, the type hinting is broken
09:32liwphamza: try this: (.drawLine #^Graphics graphics x y x y) and take the hint and the [] out from the let
09:33liwpif you do want to keep the hint in the let binding it should be something like this: (let [#^Graphics graphics (:graphics surface)] ...)
09:33hamzakk 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
09:33liwpat the moment you're binding a vector that to graphics
09:34hoeckhamza, liwp: yes, it is the vector around [#^Graphics (:graphics surface)]
09:34liwpyeah, that example is about a fun def so the args are in a vector
09:34hamzaahh damm it didn't notice that :P
09:34liwpbut AFAIK even this won't work: (let [graphics #^Graphics (:graphics surface)] ..,)
09:35liwpi.e. the hint is in the wrong part of the binding
09:40spuzif I have a predicate function, how do I create an infinite lazy sequence of numbers for which the function is true?
09:41spuzI could use range + filter but this will create a sequence that terminates
09:43mccraig,(take 5 (iterate inc 0))
09:43clojurebot(0 1 2 3 4)
09:43mccraigspuz: iterate and inc will give u an infinite seq of integers, see above
09:50somniumhow 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
09:52cgrandsomnium: $ instead of . when nested
09:53somniumthanks!
10:44Fossieh
10:44Fossithe conversation that you just had turned up in a google search for clojure enum i just made ;D
10:45hamzahehe google is fast but i hate it when i search for something and stumble on my question and no answer..
10:46Fossipretty amazing actually
10:47hamzabtw, does take evalutes the items in the lazy sequence?
10:47clojurebotlazy is hard
10:47arohnerIn 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:48liwphamza: take is lazy as well
10:50raekis "#^data form" always equivalent to (with-meta form data) ?
10:50liwpraek: nope. #^foo is a type hint which I believe is mapped to :tag in the meta map
10:51raek,(meta #^{:a 1} 2)
10:51clojurebotMetadata can only be applied to IMetas
10:51liwpso #^data form becomes somethng like (with-meta form {:tag data})
10:51arohnerraek: you can see what it does by doing (meta #^data form)
10:52zemariammhello guys
10:52raek,(meta #^{:a 1} (list 1 2 3))
10:52clojurebotnil
10:53raekshouldn't that return {:a 1} ?
10:53zemariammwhen 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:57Chousukeraek: no, #^{} is read-time
10:58Chousukeraek: you're actually adding metadata to the list '(list 1 2 3)
10:58Chousukenot to '(1 2 3)
10:58raekah
11:00liwp,(meta #^{:a 1} [1 2 3])
11:00clojurebot{:a 1}
11:00liwp,(meta #^{:a 1} '(1 2 3))
11:00clojurebotnil
11:00Chousukeliwp: that happens because [1 2 3] evaluates to itself :)
11:01raekanyway, I've been converting the cheat sheet to html
11:01liwpso is there any way to associate meta data to lists?
11:01raekhttp://raek.se/clojure-cheat-sheet.html
11:01Chousuke,(meta '#^{:a 1} (a 1 b))
11:01clojurebot{:a 1}
11:01raekI've done page 1 so far
11:01Chousukenote the position of the quote
11:01liwpahh, the quote's before the meta data. clever
11:01raekI was thinking about expanding a little on the #^ reader macro
11:01zemariammguys, 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:01zemariamm?
11:02Chousukeyou can also use with-meta of course
11:03liwpso how does #^{:a 1} relate to type hints?
11:03raek#^{:tag ClassName} form
11:03raek#^ClassName form
11:04raekthe compiler treats :tag metadata as a type hint
11:04liwpso #^Foo gets turned into #^{:tag Foo} by the #^ reader macro?
11:05liwpor probably more specifically it gets turned into (with-meta ... {:tag Foo})
11:05raekyes, passing a symbol instead of a map is a shorthand of a map with the :tag mapping set to the symbol
11:06liwpok, thanks
11:07liwp,^'#^{:a 1} (1 2 3)
11:07clojurebot{:a 1}
11:07liwpyay
11:09Fossi,^'#^
11:09clojurebotEOF while reading
11:09Fossi,^#^'
11:09clojurebotEOF while reading
11:09Fossi:(
11:09chouserthe #^ reader macro does not expand to (with-meta ...)
11:10chouserboth attach metadata, but they do so at different times.
11:10liwpchouser: I thought that might be the case... what does it expand to?
11:10opqdonutit associates metadata directly with the next object to be read
11:10opqdonutright?
11:10chouser#^ doesn't expand to anything. It attaches the given metadata directly to the next form read, at read time.
11:11chouserif the next form is a literal, then at runtime that literal will still have its metadata
11:11chouser,(meta #^java.util.Map {})
11:11clojurebot{:tag java.util.Map}
11:12liwpwith-meta calls withMeta on the IObj. Is that what the reader does as well?
11:12chouserif 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:13liwpok
11:13chouser,(meta #^java.util.Map '{})
11:13clojurebotnil
11:14chouser,(meta #^{:my :meta} (if true {:val true} {:val false}))
11:14clojurebotnil
11:14liwpso the metadata is attached to the expression before it's evaluated?
11:14chouserliwp: exactly
11:14chouser,(meta (with-meta (if true {:val true} {:val false}) {:my :meta}))
11:14clojurebot{:my :meta}
11:15liwpwhy isn't the metadata attached to the value of the expressions instead?
11:15liwpI'm sure there's some reason for it...
11:15chouserliwp: because #^ is used to communicate to the compiler, before anything has been evaluated
11:16jeremy___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:16rhickeythe #^ metadata is a read time thing and thus has to end up on the read-time data
11:16rhickeyfrom there, the compiler may interpret it as part of evaluation, e.g. treating :tag metadata on symbols and lists as type hints
11:16liwpso if #^ would expand to e.g. with-meta we wouldn't be able to use it for type hinting etc.?
11:17Chousukecorrect.
11:17stuartsierrajeremy___: #(f %2 %1)
11:17rhickeysome 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:17jeremy___stuartsierra: ah thanks! I thought it was something simple
11:17liwpok, cool
11:18chouserpart 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:22zemariammguys, 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:22chouserzemariamm: plain terminal repl, emacs slime/swank, or something else?
11:23zemariammchouser: emacs slime/swank
11:23liwpif 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:24chouserliwp: right. that def added metadata (at read time) to the symbol foo.
11:24liwpand (meta foo) is looking at the meta data attached to the value rather than the var?
11:24Chousukeyes
11:24liwpok
11:24Chousukeit's a bit confusing I guess :D
11:24chouserdef, at runtime, copied that metadata from the symbol to the Var (not the value)
11:25rhickey(anything foo) is being passed the value of the var foo, and not the var itself
11:25chouserThe value is an Integer which doesn't even support metadata.
11:25rhickeythat includes meta
11:25Chousukefirstly, the symbols can have metadata, then, vars can have metadata, and even values can have metadata :P
11:25chouserexcept when anything == var :-)
11:26Chousukeand in some cases the values can be vars or symbols, further confusing the poor programmers.
11:26rhickeyChouser: no
11:26Fossiso, again, how do i get at the values of an enum? (.FIELD EnumClass)?
11:26rhickeysame evaluation for vars in head
11:26ChousukeFossi: EnumClass/FIELD?
11:27chouserrhickey: '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:27Fossithanks
11:27rhickeyusing the-name-of-a-var designates it's value unless it is a special form like var
11:27rhickeyits
11:28rhickeyChouser: oh, now I see, yes
11:28rhickeyI thought you meanty when anything is a var, you mean when anything is var
11:28zemariammchouser: any hints ?
11:28chouserrhickey: ah! heh. yes.
11:29chouserzemariamm: nope, sorry -- maybe somebody here who uses slime can help
11:29zemariammchouser: tks anyway :)
11:30liwpzemariamm: I don't usually see filename/line number in traces in slime
11:30liwpzemariamm: sometimes you can look at the cause of the trace and that'll give you more information
11:30zemariammliwp: how do you find the bugs then ?
11:30zemariammliwp: humm is this case it was dawn hard, let me give you an example
11:32zemariammliwp: i was executing clojure.set/select, think it would return a list instead of a set
11:32liwpzemariamm: 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:32zemariammliwp: no backtrace
11:32liwpzemariamm: so I look for files in the trace that are part of my project
11:33zemariammliwp: If i have this: (nth (clojure.set/select #(= (mod % 2)) #{1 2 5 10}) 0)
11:33liwpzemariamm: and looking at the cause ('Throw cause of this exception' in slime) can then sometimes show more information
11:33zemariammliwp: somewhere in a file
11:34zemariammliwp: i get this message java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.LazySeq (NO_SOURCE_FILE:0)
11:34zemariammliwp: slime doesn't give me for info than this I think
11:35liwpzemariamm: you don't see a stack trace?
11:35zemariammliwp: exactly
11:35liwpI get an UnsupportedOperationException
11:35zemariamm(but i think I used to see it)
11:35zemariammliwp: me too, If i run the line directly in the Repl
11:36liwpit should opens a new emacs window, are you running e.g. AquaMacs which does weird things to windows?
11:36liwpzemariamm: are you sure that line is the issue then?
11:36liwpand if you run that line in the repl do you see a stack trace?
11:36zemariammliwp: AquaMacs actually, with (tool-bar-mode -1)
11:37zemariammliwp: and (scroll-bar-mode nil)
11:37zemariammliwp: actually in the code the seq is a lazy one
11:37liwpto 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:38zemariammyeah me too
11:38zemariammliwp: yeah me too
11:38zemariammliwp: 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:39liwpand no trace...
11:40zemariammliwp: and added an expression to my code (/ 10 0) in a file, loaded the file (with use :reload-all namespace)
11:40zemariammliwp: and the error mensage i got was java.lang.RuntimeException: java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)
11:40zemariammliwp: without knowing the line number it could be hell to find it
11:41zemariammliwp: in our installation you get the file and line number right ?
11:41zemariammliwp: may I ask you which version of clojure and java are you using ?
11:41zemariammliwp: maybe it's the params I use to load the JVM ?
11:41liwpzemariamm: clojure from github and java 1.6.something
11:41liwpI think it's a swank-clojure issue
11:42liwpi.e. swank-clojure does not pass in the file name and line numbers when the source is injected
11:42zemariammlet me try to run it by the terminal ( I think I tried that already but)
11:42zemariammliwp: that makes sense
11:42liwpon the terminal you should see the line numbers and the file name
11:42zemariammliwp: but I could sear it worked before
11:43chouserin a terminal, no stack trace is printed by default, just the exception.
11:43chouserTo see the whole trace, use (.printStackTrace *e)
11:44zemariammliwp: nope, in the terminal same result
11:44zemariammliwp: Listening for transport dt_socket at address: 8888
11:44zemariammClojure 1.0.1-alpha-SNAPSHOT
11:44zemariammuser=> (use 'c3po.state.database)
11:44zemariammnil
11:44zemariammuser=> (run-offline "5ahfrah0l500glaht500l0rad0r00kl05" "wlhh0r")
11:44zemariammjava.lang.RuntimeException: java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)
11:44zemariammuser=>
11:44zemariammops sorry guys
11:45chouserzemariamm: To see the whole trace, use (.printStackTrace *e)
11:45somniumzemariamm: trace macros in contrib are also helpful
11:45chouserrhickey: are you writing js code??
11:46zemariammchouser: it actually shows the stack trace using that expression but it still says NO_SOURCE_file
11:46rhickeyChouser: trying to avoid it :)
11:46chouserzemariamm: you should see file names and line numbers in the stack trace itself
11:46rhickeyI want Clojure-like syntax (and macros) with js semantics
11:46somniumI have half a library with a couple control structures and mostly jquery wrappers...
11:46chouserrhickey: oh, I see. you want ... yeah.
11:46chouserrhickey: which isn't even ClojureScript.
11:47zemariammchouser: YES, actually in the end of the stack trace it is showing
11:47rhickeynot the same as ClojureScript, more like parenscript
11:47zemariammchouser: is it possible to make the printing of the stack tarce default ?
11:47somniumI saw something about adding a heredoc reader macro in a mailing list from last year, is that still a possibility?
11:48rhickeybut 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:48rhickeya lot like the very very early Clojure where I was considering targeting JS, given Rhino and MS JScript compilation
11:49chouserzemariamm: look at clojure.main/repl-caught
11:50chouserzemariamm: you may be able to use 'binding' or something to handle repl exceptions yourself.
11:50rhickeythis is what I do when I want to avoid the tedious and painful reality of bridge method generation in reify...
11:50chouserrhickey: ha!
11:51zemariammchouser: great idea!! I ll try it right away :) thanks :)
11:52chouserrhickey: 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:53chouserrhickey: 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:53chousers/when/what/
11:53rhickeyChouser: that's an idea, I think the problem is you won't get a cinc very different from the current Java compiler
11:54chouseryou're expecting the ast to be very different?
11:54rhickeyChouser: I think it may all be actual data, not metadata
11:55rhickeyChouser: well, I want it to be more functional, that may only be in the mechanics of analyze and not the AST
11:56chouserno metadata makes sense -- filenames, line numbers, etc. all there right next to type hints, special-form names, etc.
11:56rhickeybut the environments disappear, and that isn't helpful for tools, since they just need to reconstruct them
11:56rhickeyso I'd like to do better there
11:56chouserright, 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:57rhickeyChouser: definitely
11:57chouserwhat do you mean by environments
11:57chouser?
11:57rhickeyChouser: what the names signify at any point
11:58rhickeyLOCAL_ENV
11:58chousera name's namespace or the fact that its a local, for example?
11:58chouseroh
11:58rhickeythat flows through the process then vanishes
11:59stuartsierrarhickey: What are the barriers to a 1.1 release right now?
12:00chouserstuartsierra: just as soon as cinc is done ...
12:00chouser:-)
12:00stuartsierraSeriously, I don't want to wait for cinc.
12:00chouserI'm kidding.
12:00stuartsierraI know. :)
12:00rhickeystuartsierra: 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:00rhickeycinc is not 1.1
12:00rhickeypar could wait
12:01stuartsierraSo could newnew/reify, I think.
12:01rhickeynewnew/reify would be really nice, but come with a bunch of new code that I imagine few have tried
12:02chousertransients and chunks are perhaps big enough for 1.1?
12:02stuartsierraYou've still got transients, chunks, several new namespaces from testing, and various small improvements...
12:03stuartsierraI have an ulterior motive: I'm trying to get swank-clojure and an updated clojure-maven-plugin released on Maven central.
12:03rhickeyyes, 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:04stuartsierraI'd go for that.
12:04rhickeythere are still a bunch of things marked for next release with no patches, and some patches not applied
12:04chouseradditions 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:05stuartsierrarhickey: ok, anything I can help with? (I have some clojure.test patches)
12:05rhickeyChouser: right, but we could just leave in the AST
12:06chouserrhickey: at every node or just 'fn' nodes?
12:07rhickeyChouser: maybe every node that might bind, like lets as well
12:08chouserok
12:08technomancystuartsierra: how's pom-ifying swank-clojure going?
12:08technomancyis it ready to merge back upstream?
12:08slyrus_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:09stuartsierratechnomancy: Jeffrey Chu is willing, doesn't know Maven. I've re-forked, making a clean POM without dependencies on any of my stuff.
12:09somniumlayman 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:09rhickeystuartsierra: you have patches not yet submitted?
12:09technomancystuartsierra: cool. Jeffrey and myself are both maintainers, so I can help too if you need anything.
12:09stuartsierrarhickey: no, I think they're all in there
12:09somniumand is there a preferred approach?
12:10stuartsierrarhickey: need to fix one bug related to TAP, haven't written patch yet
12:10stuartsierratechnomancy: cool, didn't know you were officially maintaining, will send POM to you as soon as it's finished.
12:11rhickeystuartsierra: are they marked as "test"? otherwise I don't know there's a patch to look at
12:11stuartsierrarhickey: ok, will check
12:11technomancystuartsierra: I don't think jochu does much clojure these days
12:11chouserthere are 2 approved tickets with no patches, 5 with unapplied patches, and 27 fixed
12:11stuartsierratechnomancy: ok, good to know
12:13rhickeyChouser: approved with no patches?
12:16chouserI should say 2 approved but "new". One has bad patches for an ant guru to fix.
12:16chouserThe other is left "as new for any bugfixes"
12:17rhickeyok, I see
12:18chouserI would need to think about agent errors queues more before doing anything there.
12:24stuartsierratechnomancy: my swank-clojure fork, with POM: http://github.com/stuartsierra/swank-clojure
12:30technomancystuartsierra: is it ready for a merge then?
12:30technomancyand your changes are all pom-related?
12:30stuartsierratechnomancy: should be; give it a try. I only added the pom.xml, but I rearranged all the source directories to make Maven happy.
12:32technomancystuartsierra: OK, I'll see if I can take a look at that later today
12:32technomancythanks
12:32stuartsierrano problem
12:35hamzaguys, 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:37rhickeyhamza: whenever a multimethod is called
12:41hamzai 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:46johnmn31what is cinc?
12:47stuartsierraclojure-in-clojure, the plan to reimplement most of Clojure in Clojure itself
12:47johnmn31ah, ok
12:51stuartsierraIf your language isn't self-hosting then language geeks will make fun of you. ;)
12:51ambientheh, that sounds like a really severe problem
12:52hiredmanplus, if clojure is cinc, and you write in clojure, you are in cinc
12:54stuartsierraouch
12:54hiredman~laugh
12:54clojurebotha ha
12:55hiredman~laugh is also <repl>#who, find another sycophant
12:55clojurebotOk.
13:38woobyhi, i'm working on a small program to save occurrences of words in a hash map
13:38woobyi'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:39woobyi 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:39woobycode: http://gist.github.com/199121
13:41woobythanks in advance for tips
13:41LauJensenCan I give some kind of Thread priority to a future ?
13:42LauJensenwooby: http://clj-me.cgrand.net/2009/05/04/counting-without-numbers/
13:43chouser,(sort-by second {"this" 2 "pants" 1})
13:43clojurebot(["pants" 1] ["this" 2])
13:44cgrandLauJensen: you mean http://clj-me.cgrand.net/2009/04/27/counting-occurences/
13:44LauJensencgrandI just picked one, they all seem to work generically
13:45woobyLauJensen: awesome, thank you
13:45tomoj,(sort-by val {"this" 2 "pants" 1})
13:45clojurebot(["pants" 1] ["this" 2])
13:46chousertomoj: even better
13:46LauJensenCan I give some kind of Thread priority to a future ?
13:47tomojoh, he left
13:48chouserLauJensen: don't think so
13:50chouserLauJensen: I don't even see a way for Executors to manage priority, let alone as abstracted by agent or future
13:50LauJensenOk, my best bet is to hog the main thread then ?
13:51chouserI wouldn't assume the "main" thread will get any higher priority than the others.
13:51LauJensenIt doesn't, I can see that now
13:53cgrandchouser: you can pass a ThreadFactory when creating an executor, the factory can set the priority
13:53chousercgrand: ah, thanks.
13:56chousermaybe you could call setPriority on yourself in the future closure?
13:56hoeck1LauJensen: you could patch clojure.lang.Agent to submit your future to a lower/higher priority ExecutorService
13:57LauJensenOk thanks
13:57hoeck1LauJensen: but the book says: "avoid the temptation to use thread priorities..." :)
13:57LauJensenBut I need more juice! :)
13:57chouserhoeck1: which book?
13:58hoeck1chouser: JCIP
13:58chouserah
13:58LauJensenAnybody 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:59chouserLauJensen: I've been using jvisualvm, which comes with sun's jdk I think.
13:59hoeck1chouser: and setting the thread priority in the future is a bad idea, since its thread will be reused (likely)
13:59chouserhoeck1: exactly.
13:59hoeck1+1 for jvisualvm
13:59LauJensenk
13:59chouserLauJensen: I run jvisualvm and it lists all the running clojure repls. I just pick one and 2 clicks later it's profiling.
14:00LauJensenWow - That a little easier than JSWat even
14:00LauJensenI have JDK6 here, but no jvisualvm
14:01chouserLauJensen: here on ubuntu it's /usr/lib/jvm/java-6-sun/bin/jvisualvm
14:02chousernot in the PATH for some reason.
14:02LauJensenah, thanks - Didn't think to check locate
14:04LauJensenI'm already profiling, fantastic
14:09LauJensenSeems like 'future' and 'deref' are hogging 40% of the cpu-time :P
14:09woobyin that count-occurrences blog post's use of 'reduce,' it looks like in that form reduce behaves like foldl... is that correct?
14:11chouserI think so
14:11woobyawesome
14:12woobythanks again for the link, i'm out for now
14:12woobyboiling 30 lines down to 1 rules
14:15LauJensenyea, like fixing 1500 bugs with 1 line of shell-script "rm *.php" :)
14:23rhickeywhere does maven want source code? (dir structure)
14:23clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
14:24chouserrhickey: src/main/clojure/my/great/library.clj
14:24rhickeythanks
14:24chouserif you have a Clojure namespace called my.great.library
14:25chouserhttp://stuartsierra.com/2009/09/03/mavens-not-so-bad
14:26sproingiefunny thing how close "pom.xml" looks to "porn.xml" in some fonts
14:27stuartsierraPOMs probably qualify as XML-porn.
14:27sproingiemore like xml snuff
14:28sproingiemaven doesn't even use a real xml parser. can't validate, because tag content is pretty much arbitrary
14:29stuartsierraIt 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:29LauJensenrhickey: 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:29sproingieyeah the validation is ad-hoc
14:30sproingieLauJensen: is it short enough to pastebin?
14:31LauJensensproingie: Yea, but it's more of a general question, the code is (I think) fully optimized
14:34cgrandLauJensen: it churns too much memory. Transients may help but not with this implementation.
14:34chouserLauJensen: one benefit of higher-level languages in general and functional ones in particular is that more complex algorithms may be easier to implement
14:35LauJensenYes there's no doubt about that - But the performance is still surprisingly bad
14:35chouserI'd recommend pursuing algorithmic improvements before getting down to optimizing a particular approach.
14:38rhickeycgrand: what's the implementation?
14:42LauJensenrhickey: If you're asking about my memory eating code, its this http://gist.github.com/198457
14:42LauJensenlines 28 -> 54 are the interesting ones
14:42hiredmanis this life?
14:43LauJensenBrians brain
14:44hiredmanI see
14:47rhickeyLauJensen: you won't come close to an imperative version like that, but you could do much better with vector for board
14:47dannyhey i need help real quick, is there a way to have the if statement do more than one thing if statement is true?
14:47raekrhickey: the cheat sheet in html: http://raek.se/clojure-cheat-sheet.html
14:48rhickeyraek: awesome! ok if I put on the site?
14:48raekdanny: "do" and "when" might be what you are looking for
14:48chouserdanny: (if true-thing (do step1 step2 step3)) ... or just use 'when'
14:48raekrhickey: of course! go ahead...
14:49raek(when true-thing step1 step2 step3)
14:49raekwhen does not have a false-branch, though
14:51Chousukethat cheatsheet has lazy-cons :P
14:53chouserthat's what comes of cheating
14:55raekrhickey: also, I think that the original pdf version should be linked to
14:55LauJensenalright, thanks rhickey
14:55raekthe layouting in html is, well, unpredictable at some times
14:56raekso, if anyone wants to print it, they should be able to find the good version
14:56dannyk thanks a lot probably should read documentation more lol
16:23rhickeyhttp://clojure.org/cheatsheet - thanks to Steve/Rasmus/Tom!
16:26thickeyrhickey: np
16:27arbschtnice!
16:29rysAn, that's brilliant
16:30dnolen(= 'cheatsheet 'awesome) -> true
16:33rysIn 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:41stuartsierragreat
17:11raekthickey: may I suggest something?
17:11raeka direct link to the PDF (and maybe the gray-scale version too), called something like "printable version" would be really be useful
17:11raekbecause, if people's gonna print the cheat sheet, they should *really* print the PDF
17:31thickeyraek: i agree that a direct link would be good. though google groups file links are always indirect.
17:32thickeyrhickey: would you be fine with me putting the pdfs in the file section of the wiki?
17:33arbschtthickey: isn't there a copy on github?
17:33arbschthttp://cloud.github.com/downloads/richhickey/clojure/clojure-cheat-sheet-a4-grey.pdf
17:34thickeyarbscht: evidently ;)
17:58thickeyraek: added the link to pdf on github in addition to original source zip (thanks for heads-up arbscht)
18:00spuzthickey, are you aware of the problem with the search on clojure.org?
18:01spuzit took me a while before I noticed all the results at the bottom of the page :p
18:02raekthickey: nice!
18:02raekbut now I realized that I forgot to tell you that I imagined the link to be at the top of the page
18:02raekthe cheet sheet is rather long, so people might miss the link if it's at the bottom
18:02raekthis was my thought
18:02raeksorry for nagging... :)
18:02raekyou have done a great job with the website
18:02raeknow I will be quiet.
18:03thickeyspuz: i was not... that's pretty bad! thanks for letting me know
18:03thickeyraek: 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:03spuzheh, glad to help :)
18:04thickeyraek: no need to be quiet, feedback is always welcome
18:04raekok, great!
18:11LauJensenA post about cellular automata, specifically Brians brain, http://www.dzone.com/links/brians_functional_brain_in_clojure.html for those who are interested :)
18:15spuzLauJensen: 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:16LauJensenYea that'll be interesting to see
18:17spuzI 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:18LauJensenI would think so, about 40%. It hogs both my cores pretty effeciently
18:20spuzYou 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:21LauJensenThis 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:22spuzok
18:22LauJensenBut last time I put code up, I got 3 revisions within the following 36 hours - so who knows what will happen :)
18:22spuzhehe :)
18:22spuzwell till tomorrow
18:23LauJensenTa ta :)
18:23mccraigwhat 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:23hiredmanmccraig: into works on non-empty things
18:24hiredman(into [1 2 3] [4 5 6])
18:24hiredman,(into [1 2 3] [4 5 6])
18:24clojurebot[1 2 3 4 5 6]
18:24mccraigaha!
18:29lisppaste8miltonsilva pasted "euler 1" at http://paste.lisp.org/display/88046
18:29miltonsilvahi
18:30hiredmanfor
18:30Chousukemiltonsilva: hi
18:30miltonsilvathat is one solution to the euler problem. but I would like to pass a list of divisors
18:30miltonsilvaeuler problem 1
18:30Chousukemiltonsilva: 1) there's a "range" function for making a range, 2) the vector is not needed :)
18:31miltonsilvaoh.. didn't noticed that
18:33Chousukeor hm, never mind 2). it's not a vector. you calling it vec just confused me :P
18:34Chousukewhich probably means it's time for me to sleep! Good night.
18:39ari__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:39ari__i've googled for hours looking for a decent example that's well-commented enough to work from
18:42arbschtari__: is zip insufficient? there's also clojure.contrib.zip-filter
18:42hiredmanyou can just use filter and map
18:43hiredmanhttp://gist.github.com/184831
18:43hiredmanthe output of zip-soup is clojure.xml/parse output
18:47ari__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:47hiredmaneh?
18:47ari__where :blah is the name of an element, like :currentTime
18:47ari__but I guess I was wrong
18:47ari__i'm fairly new to lisp altogether and programming, so
18:47ari__not really clued
18:48hiredman(:blah get-tree) would work if get-tree is a Map
18:48hiredmanthat is what keywords used as functions do, they look themselves up in a map
18:49ari__but clojure.xml/parse doesn't output as a map, right?
18:49hiredmanit does
18:50dthomasBut the keys are not elements, IIRC.
18:50ari__yeah, I mean that doesn't throw an error or anything, but the output is blank. e.g. (str (:currentTime get-tree))
18:52arbschtyou aren't calling get-tree there
18:53hiredmanand the output of parse is not going to have a key :currentTime
18:53hiredman,(-> "<?xml version="1.0"?>
18:53clojurebotEOF while reading string
18:53hiredmaner
18:53ari__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:56hiredman,(-> "<?xml version=\"1.0\"?> <foo/>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse)
18:56clojurebot{:tag :foo, :attrs nil, :content nil}
18:57hiredmanwell, you have a map there
18:57hiredmanwith the keys ::tag :attrs and :content
18:58hiredmaner, :tag
18:58hiredmanand thats not the whole datastructure
18:58ari__no
18:58ari__it's just a part of it
18:58ari__i'm just wondering, can I get to currenttime's content easily
18:58ari__without using zip
18:58hiredmansure
18:59hiredmanyou take the :content of blah, search for :currentTime and take it's :content
19:00hiredman,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse)
19:00clojurebot{:tag :foo, :attrs nil, :content [{:tag :bar, :attrs nil, :content nil} {:tag :baz, :attrs nil, :content ["some content"]}]}
19:01hiredman,(-> "<?xml version=\"1.0\"?> <foo><bar/> <baz>some content</baz></foo>" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse :content ((partial filter #(= :baz (:tag %)))))
19:01clojurebot({:tag :baz, :attrs nil, :content ["some content"]})
19:01hiredman,(-> "<?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:01clojurebot""
19:01hiredmanbah
19:01hiredman,(-> "<?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:01clojurebotnil
19:01hiredman,(-> "<?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:02clojurebot"some content"
19:03hiredmanyou have a nested structure of maps and vectors that you need to traverse
19:06ari__is most of how to do that covered in programming clojure?
19:06hiredmanari__: uh, it's pretty simple
19:07dthomasari__: 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:08ari__dthomas, that example is pretty helpful
19:08ari__thanks
19:09ari__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:09tomojalso lets you query them easily :)
19:12ari__I guess I probably need to go sit down with SICP, and then programming clojure
19:12ari__it's my first language, probably not the best choice, but it's what I want to use :)
19:13ambientfirst language ever? if i'd be in the similar position i'd perhaps start with scheme and sicp
19:13LauJensenambient: are you nuts?
19:13ambienthow so?
19:13LauJensenYou're telling a guy who wants to pick up Clojure to go hang with the Flintstones?
19:14ambientclojure 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:14ari__isn't SICP a good mechanism to learn functional programming & programming in general?
19:14ari__that's what I understood
19:14LauJensenari__: It sure is
19:15ari__well, last I checked, there was no current entrance into programming from clojure
19:15ari__in book form
19:15LauJensenambient: Ok - I get where you're coming from... still a little nuts, good night guys :)
19:15ari__I thought programming clojure was a little more advanced and required you to have some java knowledge
19:15ambientLauJensen btw nice article, hope you continue writing :)
19:15LauJensenThanks ambient :)
19:16hiredmanhttp://sicpinclojure.com/
19:17ambient"you should not be here yet." heh
19:17hiredmanyeah
19:17hiredmananyway, that is just one of a few efforts
19:18ambientthat might be an interesting read, just to see how much the absence of tail call optimization hurts clojure if any
19:18ari__Wow!
19:19ari__That's awesome hiredman. Thanks!
19:20hiredmanI dunno that he has actually gotten that far
19:21ari__he hasn't
19:21ari__but it's good to know there's an effort
19:49ari__http://lolwat.net/?w=534f0698de5b616377460b8b93dcbec3
20:44kevin__hey all, anyone using the quasiquote form mentioned in this thread: http://groups.google.com/group/clojure/browse_thread/thread/6d0c5f7e37909055/3a8fa4e4d680a38a?hl=en&amp;ie=UTF-8&amp;q=quasiquote+clojure#3a8fa4e4d680a38a
20:54quidnuncIs there a function that will return a function that applies its argument (a function) N times?
20:55hiredman#(dotimes [i n] (f))
20:56quidnuncthanks
20:56hiredmandunno why you'd apply a function more than once, because the answer would always be the same
20:56quidnuncthe function takes args
20:57hiredmanso?
20:57hiredmana function on the same set of args always has the some output
20:57quidnuncEr, I guess your solution doesn't work
20:57quidnuncfor what I want to do. (f (f x))
20:57hiredman,(doc iterate)
20:57clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
20:57kevin__you mean if n is 3 (f (f (f x)))
20:58quidnunciterate is what I want, thanks.
21:50quidnuncIs there a way to use -> with anonymous functions?
21:53arbscht,(-> 5 (#(* % %)))
21:53clojurebot25
21:53arbschtugly :)
21:54quidnuncOkay, thanks.
21:58tomojis ~'foo the proper way to get unhygienic variables in a macro?
22:04chouseryes
22:05chouserto the extent that unhygienic variables can be proper, anyway.
22:05tomojhmm.. how does this look? http://gist.github.com/b99ca5c6e87318540cf5
22:05tomojI felt like I needed them for defn and let
22:06arbschtwhy not gensym?
22:06tomojah, yeah, forgot about that
22:07chouseryeah, use n# instead of ~'n
22:08tomojthat makes it look much better, thanks
22:11tomojhmm, that doesn't seem to work, though
22:12tomojbecause I've got multiple levels of quoting-unquoting
22:12tomojso n# in the nested ` gets a different gensym than n# in the toplevel ` :(
22:13arbscht,(doc gensym)
22:13clojurebot"([] [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:16kevin__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:17kevin__,(gensym)
22:17clojurebotG__5134
22:17tomoj,'G__5134
22:17clojurebotG__5134
22:17tomojwhy wouldn't the same be possible in CL?
22:17kevin__those would be = right?
22:17kevin__cause the second one would not be the same as the first in CL, not = right?
22:18kevin__in CL gensyms are unreadable
22:18tomojand it's impossible to construct them?
22:19tomojarbscht: thanks, using gensym manually worked
22:19kevin__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:20tomoj(deffizzer fizzbuzzbazz {3 "Fizz" 5 "Buzz" 7 "Bazz"}), (fizzbuzzbazz 105) -> "FizzBuzzBazz") :D
22:39iceyare 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:39iceyi mean... without it, it's just like programming in any other language that doesn't have a REPL, right?
22:40ztellmanicey: what sort of problems are you having?
22:41ztellmanI just have slime invoke a script that has an exhaustive list of all the classpath stuff I want
22:41iceyit can't seem to find swank.clj when i fire slime up
22:41ztellmanoh, well that's a little different
22:41ztellmanI dunno about that one
22:42iceyyeah; 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:46tomojI'm using zip-filter.xml, but it seems difficult to reuse parts of filter chains
22:47tomoje.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:47tomojit sucs to have to put the ":foo (attr= :bar "baz") :bing" where you want to do that
22:47tomojany ideas?
23:28ztellmanif a java function takes a variable number of arguments, do I need to pass those arguments in as an array?
23:28ztellmantha
23:28ztellmanthat seems to be what's implied by the error I'm getting
23:33JAS415you shouldn't have to
23:33JAS415what is the error
23:34ztellmancom.nativelibs4java.opencl.CLDevice cannot be cast to [Lcom.nativelibs4java.opencl.CLDevice
23:35ztellmanper the javadoc, the signature is createContext(CLDevice... devices)
23:35JAS415hmm
23:35JAS415you could try using make array or to array
23:36ztellmanto-array doesn't work, because it's an array of objects
23:36ztellmanmake-array will work, but is annoying
23:36JAS415ooh
23:36JAS415yeah that is annoying
23:36ztellmanbecause I have to first make the array, and then fill it in
23:36JAS415yup
23:36JAS415could write a helper fn that does that i guess
23:36ztellmanoh well, if that's what's required
23:36ztellmanyeah, I was just hoping I wouldn't have to
23:37JAS415yeah is kind of annoying to not have plain 'old java array syntax
23:37JAS415for certain things
23:38ztellmanI dunno, I have to assume that there could be an auto-translation for this particular situation
23:38ztellmanand I don't really care about arrays in other situations
23:39JAS415i was expecting to-array would do it, but if it returns array of objects that is annoying
23:39mikem,(doc rfirst)
23:39clojurebotNo entiendo
23:39JAS415into-array
23:39JAS415try that one
23:39JAS415,(doc into-array)
23:39clojurebot"([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:39mikemhm, rfirst is in the cheatsheet in the section "Using a seq": http://clojure.org/cheatsheet
23:40JAS415user=> (to-array ["fred" "ethel"]) [Ljava.lang.Object;@3f472b
23:40JAS415user=> (into-array ["fred" "ethel"]) [Ljava.lang.String;@74e78a
23:49arbschtmikem: is it in clojure 1.0? I seem to recall it existing in old versions
23:49mikemarbscht: hm, perhaps. I'm running a git version, about a month old
23:50mikemand apparently so is clojurebot
23:51mikemanother question: under "Reader Macros" is the entry: "#' | Var quote: @'x -> (var x)"
23:51mikemso is it #' or @'?
23:52mikemlooks like it's #', and there's a typo in the example
23:53arbschtright