How to implement lambda as a function called "lambda" in Clojure?
        Posted  
        
            by dirtyvagabond
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dirtyvagabond
        
        
        
        Published on 2010-03-23T04:02:14Z
        Indexed on 
            2010/03/23
            4:11 UTC
        
        
        Read the original article
        Hit count: 536
        
I'd like to be able to define lambdas using common Lisp syntax, in Clojure. For example:
(lambda (myarg)
  (some-functions-that-refer-to myarg))
This needs to result in the same as:
#(some-functions-that-refer-to %)
In my case, I know I'll always have exactly one arg, so perhaps that simplifies things. (But it can be called anything -- "myarg" or whatever.)
I suspect a workable solution is to "(defmacro lambda ...". If so, I'm not sure of the best way to proceed. How to cleanly translate the arg name to %? And how to end up with the correct function?
Or, is there a simpler solution than writing my own macro that actually re-implements Clojure's... lambda?
© Stack Overflow or respective owner