Jeffrey Meunier has an implicit Curry macro here, which uses defmacro. I was wondering if someone has ever written this with syntax-rules?
相关问题
- I want to trace logs using a Macro multi parameter
- Generating powerset in one function, no explicit r
- What is fixed point?
- Relation between Function1 and Reader Monad
- Solaris and Preprocessor Macros
相关文章
- Macro expansion in elixir: how to define 2 macros
- Is there something like the threading macro from C
- Learning F#: What books using other programming la
- Creating a list of functions using a loop in R
- How to import macros in Rust?
- Does learning one Lisp help in learning the other?
- Using C Preprocessing to get integer value of a st
- Using UNREFERENCED_PARAMETER macro
There are a number of curry implementations for Scheme -- none can be as elegant as Haskell, since there functions are always unary functions, so everything can be curried. (But this can of course be implemented in a sufficiently powerful Scheme like Racket.)
As for the macro that you've dug up -- it's a pretty bad one: not only does it use an unhygienic macro, it's also calling
eval
explicitly, and relies on an implementation of environments etc. But it's easy to do that with a simplesyntax-rules
macro. AFAICT, this is what it implements:But there's an important note here. The page that you reference says that an problem of the function version is that it's explicit -- but it also has an important advantage: with the macro implementation you must define a function using
clambda
, whereas the functional version can be used with any built in function. In many Scheme implementations there are facilities to inspect a function's arity, and using this it's possible to implement a currying function version that knows when to call the original function.