guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: and-let* is not composable?


From: Panicz Maciej Godek
Subject: Re: and-let* is not composable?
Date: Wed, 11 Sep 2013 14:25:07 +0200


2013/9/10 Ian Price <address@hidden>

I have a few notes unrelated to those I've already mentioned in the
thread.

1. Guile already has curried definitions in (ice-9 curried-definitions)

Yes, but those are completely different. I wouldn't call "define-curried"
a curried definition, but a definition of a curried macro for generating
procedures.
 
2. By turning your functions definitions into a macro, you've lost the
ability to use them in a first class manner.

That's not entirely true. I just need an extra pair of parentheses
to do so. The semantics is certainly different than the one of
Guile's curried definitions, but that's fine.
 
3. I would strongly recommend _not_ using define-macro, and even more
so, not mixing define-macro and syntax-rules in a macro. Syntax-case is
as powerful as defmacro, and in most practical cases, about as much
writing.

Well, while syntax-rules macros are quite easy to understand
(at least from the user's point of view), although sometimes a little
tricky, the syntax-case system I find still too difficult to use.
define-macro, on the other hand, is very easy to explain
even to beginner programmers, although the resulting macros
are much more difficult to analyse.
The main problem with syntax-rules/syntax-case macros is
the treatment of ellipses, which makes it difficult to create
macros that create macros.
Still, I didn't post to comp.lang.scheme for no reason :)

4. What your macro does is not currying, it is partial
application. Those are different things. Currying refers to the process
of turning a function of n arguments into an n-nested set of 1 argument
functions. Partial application is, well, not supplying all the arguments
to a function. You can have partial application without currying, as
your macro shows.

OK, you got me here. But it's still difficult for me to come up
with a good name for that macro (and if so, the Guile's curried
definitions are not curried either, at least in general: because
you can (define ((f a b) c d) ...), getting a chain of 2-argument
functions)

Thanks,
M.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]