Re: ClojureCLR updated

2009-05-31 Thread kinghajj
On May 31, 1:08 am, dmiller wrote: > Proxying and genclass haven't been attempted yet. Can you guess how long they should take to implement? > Speed is still an issue.   For basic code generation, the MSIL > produced by the ClojureCLR compiler is as close as possible to the > bytecodes produced

Re: "Currying" / Partial Application macro

2009-05-30 Thread kinghajj
On May 30, 1:19 pm, Daniel Lyons wrote: > You can't have both partial application and variable arity functions. Uh, yeah you can. Haskell can have variadic functions, like Text.Printf.printf, and with some explicit type signatures you can still partially apply it. import Text.Printf -- Here, I

How to hide functions from being imported?

2009-05-28 Thread kinghajj
In Haskell, it's simple to explicitly state what names should be exported by a module. Is there a way to do this in Clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: "Currying" / Partial Application macro

2009-05-28 Thread kinghajj
ide a > syntax quote expression) : > > (defmacro $ [f & args] >    `(fn [& args2#] >       (eval (cons (quote ~f) (concat (quote ~args) args2#) > > See: > user=> (macroexpand `(args2# args2#)) > (args2__44__auto__ args2__44__auto__) > user=> > >

"Currying" / Partial Application macro

2009-05-28 Thread kinghajj
(defmacro $ [f & args] (let [args2 (gensym)] `(fn [& ~args2] (eval (cons (quote ~f) (concat (quote ~args) ~args2)) Example: (def add5 ($ + 5)) (add5 3) Beware! For this macro evaluates the later parameters before the partially-applied ones, so side-effectful parameters may occu

Is there already a function to apply functions to maps by key?

2009-03-26 Thread kinghajj
If not, I think it's pretty useful. There should be an easy way to apply functions to maps' values by keys. (defn update [m & keyfuns] (let [[key fun & rest] keyfuns] (if (and key fun) (recur (assoc m key (fun (key m))) rest) m))) (def foo {:a 5 :b 7}) (def bar (updat