unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: Panicz Maciej Godek <godek.maciek@gmail.com>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: and-let* is not composable?
Date: Wed, 11 Sep 2013 15:05:04 +0100	[thread overview]
Message-ID: <8761u7o3n3.fsf@Kagami.home> (raw)
In-Reply-To: <CAMFYt2bYp51FRHKHddTAEuLTZDCsK53TszMe-AzQxSzZXa04OA@mail.gmail.com> (Panicz Maciej Godek's message of "Wed, 11 Sep 2013 14:25:07 +0200")

Panicz Maciej Godek <godek.maciek@gmail.com> 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	other threads:[~2013-09-11 14:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 17:35 and-let* is not composable? Panicz Maciej Godek
2013-09-09 20:26 ` Stefan Israelsson Tampe
2013-09-09 21:34   ` Ian Price
2013-09-10 13:42     ` Stefan Israelsson Tampe
2013-09-10 13:51       ` Ian Price
2013-11-02  2:39     ` Ian Price
2013-11-02 19:01       ` Ian Price
2013-09-10 17:57 ` Ian Price
2013-09-11 12:25   ` Panicz Maciej Godek
2013-09-11 14:05     ` Ian Price [this message]
2013-09-13 18:40       ` Panicz Maciej Godek
2013-09-14  8:19         ` Stefan Israelsson Tampe
2013-10-04 22:27       ` Panicz Maciej Godek
2013-10-05  8:00         ` Ian Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761u7o3n3.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=godek.maciek@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).