On Thu, May 28, 2009 at 9:57 AM, kinghajj <kingh...@gmail.com> wrote:
>
> (defmacro $ [f & args]
>  (let [args2 (gensym)]
>    `(fn [& ~args2]
>       (eval (cons (quote ~f) (concat (quote ~args) ~args2))))))
>
> Example:
> (def add5 ($ + 5))
>
> (add5 3)

This already exists :)

user=> (doc partial)
-------------------------
clojure.core/partial
([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more])
  Takes a function f and fewer than the normal arguments to f, and
  returns a fn that takes a variable number of additional args. When
  called, the returned function calls f with args + additional args.
nil
user=> (def add5 (partial + 5))
#'user/add5
user=> (add5 3)
8

-- 
Michael Wood <esiot...@gmail.com>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to