unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: Taylan Kammer <taylan.kammer@gmail.com>
Cc: guile-user <guile-user@gnu.org>, guile-devel <guile-devel@gnu.org>
Subject: Re: case source code
Date: Tue, 13 Sep 2022 11:18:57 +0200	[thread overview]
Message-ID: <CADEOadcHGGCZD9FHYY2WJA8B_K=oma6XNW1LEuB3rbE1JmZEOA@mail.gmail.com> (raw)
In-Reply-To: <603460d9-e0a3-b5d5-e38a-977dfbc20285@gmail.com>

thanks, if just replaced the 'begin by 'let () to allow internal
definitions but i haven't test it yet (finally no need in my code of define
internal at this point)
regards,
Damien

On Mon, Sep 12, 2022 at 10:47 AM Taylan Kammer <taylan.kammer@gmail.com>
wrote:

> On 12.09.2022 09:42, Damien Mattei wrote:
> >
> > Hello,
> > i can not find in the scheme community a definition of 'case in term of
> macro as for when, unless,while,do... does anyone have it?
> > thanks,
> > Damien
>
> The RnRS often contain such definitions.  The following is taken from
> R7RS-small:
>
> (define-syntax case
>   (syntax-rules (else =>)
>     ((case (key ...) clauses ...)
>      (let ((atom-key (key ...)))
>        (case atom-key clauses ...)))
>     ((case key (else => result))
>      (result key))
>     ((case key
>        (else result1 result2 ...))
>      (begin result1 result2 ...))
>     ((case key
>        ((atoms ...) result1 result2 ...))
>      (if (memv key ’(atoms ...))
>          (begin result1 result2 ...)))
>     ((case key
>        ((atoms ...) => result))
>      (if (memv key ’(atoms ...))
>          (result key)))
>     ((case key
>        ((atoms ...) => result)
>        clause clauses ...)
>      (if (memv key ’(atoms ...))
>          (result key)
>          (case key clause clauses ...)))
>     ((case key
>        ((atoms ...) result1 result2 ...)
>        clause clauses ...)
>      (if (memv key ’(atoms ...))
>          (begin result1 result2 ...)
>          (case key clause clauses ...))))
>
> --
> Taylan
>
>


      reply	other threads:[~2022-09-13  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  7:42 case source code Damien Mattei
2022-09-12  7:46 ` Zelphir Kaltstahl
2022-09-12  8:27   ` Damien Mattei
2022-09-12  8:30     ` Damien Mattei
2022-09-12  8:47 ` Taylan Kammer
2022-09-13  9:18   ` Damien Mattei [this message]

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='CADEOadcHGGCZD9FHYY2WJA8B_K=oma6XNW1LEuB3rbE1JmZEOA@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=taylan.kammer@gmail.com \
    /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).