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: Ian Price
Subject: Re: and-let* is not composable?
Date: Wed, 11 Sep 2013 15:05:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Panicz Maciej Godek <address@hidden> writes:

> 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.
An identifier macro would be even better, but it's still not first
class.

> 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.
If you, or the other people who are confused by syntax-case, can point
to the parts of the manual that confuse you, so we can clear them up, I
think we'd all appreciate it.

Fundamentally, syntax-case shouldn't be harder to use than define-macro
99% of the time, if you remember

- macros are functions from "syntax-objects" to syntax-objects
- syntax-objects are smart symbols
- syntax->datum to remove the smartness
- datum->syntax is for when you want to break hygiene (but syntax
  parameters are better where applicable)
- use quasisyntax to construct lists of syntax-objects instead of
  quasiquote to construct lists of symbols.

> The main problem with syntax-rules/syntax-case macros is
> the treatment of ellipses, which makes it difficult to create
> macros that create macros.
You can expand into ellipses with (... ...), it's ugly, but it's there.

> 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)
Indeed, I wasn't sure whether or not I should have mentioned it, but I
was told this is the "correct" name for that feature on comp.lang.scheme
a while back. I think it might have been Will Clinger, but I'd need to
double check.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



reply via email to

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