0:18 scramflot: Thanks Chouser
0:39 Chouser: jh06 you probably defined user/if, and then ended up calling clojure/if
0:40 or maybe it's because the built if isn't a macro
0:41 er, I mean isn't a function
0:41 (defmacro if [a b] `(+ ~a ~b))
0:41 (if 5 6)
0:41 => 11
3:39 bgeron: huh?
9:04 Chouser: jh06 was trying to redefine "if", so I demonstrated by using defmacro.
9:05 rhickey: I strongly discourage trying to redefine if, what's the objective?
9:29 Chouser: heh, yeah, I would tend to agree. I don't know why jh06 thought he wanted to.
11:14 rhickey: as of rev 675:
11:14 user=> (map #(* 2 %) [1 2 3])
11:14 (2 4 6)
11:14 user=> (map #(* 2 %1 %2) [1 2 3] [4 5 6])
11:14 (8 20 36)
11:15 user=> (map #(/ 1 %) [1 2 3 4])
11:15 (1 1/2 1/3 1/4)
11:15 user=> (quote #(foo % %2 (bar %&)))
11:15 (fn* [p1__764 p2__765 & rest__766] (foo p1__764 p2__765 (bar rest__766)))
11:16 i.e. anonymous function and arg reader syntax
11:17 Chouser: ok!
11:18 care to share your thoughts on the choice of syntax?
11:18 # and % specifically, I suppose.
11:19 rhickey: # usually designates reader magic
11:19 % is from printf :)
11:20 I like the similar capability in Mathematica
11:20 Chouser: looks good to me.
11:20 handles multiple args much more nicely than arc's [ ... _ ... ]
11:21 rhickey: does arc handle multiple args?
11:21 Chouser: And presumabely handles multiple refs to the same arg better than Scala's ( ... _ ... )
11:21 as far as I know, arc's syntax only works to produce a single-arg function.
11:22 pretty much exactly as yours if you couldn't put a number after %
11:23 rhickey: I have & too for rest args
11:23 Chouser: I suppose they could extend arc to allow [ * 2 _1 _2 ]
11:23 yep, I saw that. Complete. I like.
11:24 May I ask how you have time to work on clojure?
11:24 rhickey: No
11:24 It's a question I avoid myself
11:24 Chouser: well, I don't need to. I'd rather have clojure than an answer to that question. :-)
11:26 * Chouser switches to SVN version
11:29 Chouser: beautiful.
15:10 rhickey: do you use a Mac?
15:11 rhickey: yup
15:29 Chouser: Ah! Well, that explains it.
15:29 No, I'm totally kidding. I just noticed a path starting with "/User" in a .clj file.
15:55 * bgeron made the same error
15:56 bgeron: fortunately we have version control to save the error, long after we corrected it
15:56 well, /me sleep, bye
16:15 ffailla: netjure
16:16 Chouser: "Did you mean: nature"
16:18 ffailla: sorry wrong irc
16:22 Chouser: :-)
17:30 ericthorsen: rich, what is the dispatch char for the named arg function feature?
17:30 rhickey: #
17:30 (map #(* 2 %) [1 2 3])
17:30 -> (2 4 6)
17:31 ericthorsen: too easy :) thanks
19:38 ericthor: rich, what do i need to do to get an intellJ run config to see the boot.clj? (not really a clojure question)
20:23 rhickey: put -cp clojure.jar on the VM parameters, on before launch uncheck make, check run ant target jar
20:24 ericthor: i was halfway there
20:44 I have a couple of questions on the java var binding. Is this a good place to ask them?
20:45 rhickey: sure
20:45 ericthor: clojure=>(in-ns 'fred)
20:45 java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set
20:45 at clojure.lang.Var.set(Var.java:140)
20:45 at clojure.lang.RT$1.invoke(RT.java:136)
20:45 at clojure.lang.AFn.applyToHelper(Unknown Source)
20:45 at clojure.lang.AFn.applyTo(Unknown Source)
20:45 at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2245)
20:45 at clojure.lang.Compiler.eval(Compiler.java:3204)
20:45 at beansclojure.ClojureEvaluator.run(ClojureEvaluator.java:73)
20:45 at java.lang.Thread.run(Thread.java:613)
20:45 you need more..1 sec
20:46 this is how I'm binding to the current namespace var from outside
20:46 final static Var CURRENT_NS = Var.intern(CLOJURE_NS, Symbol.create("*ns*"),
20:48 Prior to starting the repl loop I'm calling the same functions for pushing the thread bindings, then calling what appears to be the same init code and I'm getting that message...
20:48 rhickey: If you are going to change *ns* it will have to be on a thread in which you've bound it with pushtrhreadbindings as does repl
20:48 ericthor: Is this the correct way to bind into the clojure vars?
20:48 that's it
20:49 rhickey: you should call RT.inNamespace.invoke as does repl
20:49 rather than directly manipulating *ns*
20:49 ericthor: not visible
20:50 tried that
20:50 can that change?
20:51 rhickey: you can make your own mapping to the same var Var.intern(CLOJURE_NS, Symbol.create("in-ns"))
20:51 that's true of all vars, you don't need the actual static member vars of Clojure's runtime
20:52 ericthor: i did that as well....but i was not using the same thread to make the change as when the binding were put on...let me correct that
21:11 does the TR.init() call also need to be on the same thread?
21:13 rhickey: no - that's a one shot that loads boot.clj from the jar. It must be run before using the rest of Clojure
21:13 ericthor: ok
22:27 to create a var i can reference between java and clojure:
22:27 Var WARN_ON_REFLECTION = Var.intern(CLOJURE_NS, Symbol.create("*warn-on-reflection*"));
22:27 where the name-space would be a user different namespace, etc.
22:29 rhickey: yes
22:30 ericthor: i'm making progress...you'll be up for a few more hours yes?
22:30 rhickey: nope
22:30 ericthor: i think i will...fun stuff
22:52 jonathan__: what are you building eric?
23:18 ericthor: tools!!!