Hello,
I've created an alias for lambda:
(define-syntax procedure
(syntax-rules ()
[(procedure (arg ...) expr1 expr ...)
(lambda (arg ...) expr1 expr ...)]))
but, when I use it, the indentation changes:
(lambda (x y)
(+ x y))
(procedure (x y)
(+ x y))
Is there a way to fix this?
Probably if there's a way it's in the documentation, but I don't know where to look.
Thank you
Matteo
| matteo-daddio
March 11 |
Hello,
I've created an alias for lambda:
(define-syntax procedure
(syntax-rules ()
[(procedure (arg ...) expr1 expr ...)
(lambda (arg ...) expr1 expr ...)]))
BTW, if you only want to change the name without changing anything else, a better definition would be
(define-syntax procedure
(syntax-rules ()
((_ args expr1 expr ...)
(lambda args expr1 expr ...))))
Your version:
((procedure x x) 1 2 3)
Exception: invalid syntax (procedure x x)
This version:
((procedure x x) 1 2 3)
(1 2 3)
1 Like
I was thinking there should be a way to tell how to indent a syntax when it’s defined.
For example, something like this:
(define-syntax procedure
#:indent-like ‘lambda
(syntax-rules ()
[(procedure args expr1 expr ...)
(lambda args expr1 expr ...)]))
What do you think?
Matteo
EmEf
6
@rfindler is working on such an extension.
2 Likes