KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I started learning Common Lisp recently, and (just for fun) decided to rename the lambda macro. My attempt was this: > (defmacro λ (args &body body) `(lambda ,args ,@body)) It seems to expand correctly when by itself: > (macroexpand-1 '(λ (x) (* x x))) (LAMBDA (X) (* X X)) But when it's nested inside an expression, execution fails: > ((λ (x) (* x x)) 2) (Λ (X) (* X X)) is not a function name; try using a symbol instead I am probably missing something obvious about macro expansion, but couldn't find out what it is. Maybe you can help me out? edit: It does work with lambda: > ((lambda (x) (* x x)) 2) 4 edit 2: One way to make it work (as suggested by Rainer): > (set-macro-character #\λ (lambda (stream char) (quote lambda))) (tested in Clozure CL)
Tags (comma-separated)
Save Edits
Cancel