[Openmcl-devel] Macro named λ won't expand in Slime REPL

Stas Boukarev stassats at gmail.com
Wed May 20 23:53:38 PDT 2009


Daniel Gackle <danielgackle at gmail.com> writes:

> We defined a macro named λ (Greek lambda character, in case this email isn't Unicode-friendly) to expand into a lambda form, partly to
> save typing and partly to add a couple extra features our system needs. This works fine when you compile files, but not in a Slime REPL or
> when using the command slime-compile-defun. For example,
>
> (defun foo ()
>   (λ (x) (1+ x)))
>
> works the way you'd expect if you compile the file it's in. But in the REPL bad things happen:
>
> (defun foo ()
>    (λ (x) (1+ x)))
> ;Compiler warnings :
> ;   In FOO: Undefined function Λ
> ;   In FOO: Undefined function X
> ;   In FOO: Undeclared free variable X
> => FOO
>
> (foo)
> => Undefined function X called with arguments () .
>    [Condition of type CCL::UNDEFINED-FUNCTION-CALL]
>
> (macroexpand '(λ (x) (1+ x)))
>  => (Λ (X) (1+ X))
>
> And if you use slime-compile-defun on the (defun foo...) form, the following occurs:
>
> While compiling FOO :
> #1=(X) is not a symbol or lambda expression in the form (#1# (1+ X)) .
>    [Condition of type CCL::COMPILE-TIME-PROGRAM-ERROR]
>
> I'm posting this here because none of the above errors happen in SBCL, so there would seem to be something specific about the combination
> of Slime and CCL that doesn't like this macro. Does anyone have any ideas or suggestions?
>
> Thank you,
>
> Daniel Gackle
>
Are you sure that your macro is defined?
(defmacro λ (arguments &body body) `(lambda ,arguments , at body))

(funcall (λ (x) (+ x 1)) 5) => 6

Works fine here.

-- 
With best regards, Stas.



More information about the Openmcl-devel mailing list