unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: "Linus Björnstam" <linus.bjornstam@veryfast.biz>,
	guile-user <guile-user@gnu.org>,
	guile-devel <guile-devel@gnu.org>
Subject: Re: expression and definition context in Scheme
Date: Sun, 4 Sep 2022 10:08:24 +0200	[thread overview]
Message-ID: <CADEOaddRJDXxg5R5nNLCETqX9Zi3JxWBQG2vbnhWzEgPwxxMxA@mail.gmail.com> (raw)
In-Reply-To: <CADEOadeGmqwx3goq-26oZsLHpwGsdzRUP_580dkGxb6n-TyZcQ@mail.gmail.com>

i finalize my ideas about 'controls' and loops (with break and continue, as
while feature them ,even if scheme and macro do not allow ? (if someone
else have idea and solution about it?) implements of 'continue and 'break
because hygiene forbid it)
https://github.com/damien-mattei/library-FunctProg/blob/master/while-do-when-unless.scm

;; scheme@(guile-user)> (for/break-cont break continue ({i <+ 0} {i < 5} {i
<- {i + 1}}) {x <+ 7} (display x) (newline))
;; 7
;; 7
;; 7
;; 7
;; 7

;; scheme@(guile-user)> (for/break-cont break continue ({i <+ 0} {i < 5} {i
<- {i + 1}}) {x <+ 7} (display x) (newline) (break))
;;7

;; scheme@(guile-user)> (for/break-cont break continue ({i <+ 0} {i < 5} {i
<- {i + 1}}) {x <+ 7} (continue) (display x) (newline) (break))

(define-syntax for/break-cont

  (syntax-rules ()

    ((_ <break-id> <continue-id> (init test incrmt) b1 ...)

     (call/cc (lambda (<break-id>)
(let ()
 init
 (let loop ()
   (when test
 (call/cc (lambda (<continue-id>) b1 ...))
 incrmt
 (loop)))))))))

https://github.com/damien-mattei/library-FunctProg/blob/master/for-next-step.scm

Damien

On Thu, Sep 1, 2022 at 10:21 PM Damien Mattei <damien.mattei@gmail.com>
wrote:

> On Wed, Aug 31, 2022 at 5:29 PM Maxime Devos <maximedevos@telenet.be>
> wrote:
>
>>
>> On 31-08-2022 09:01, Damien Mattei wrote:
>> > I always try to keep compatibility with RnRS and in fact except cond
>> > none of when, unless, cond, case, while, and do are in standart RnRS
>> schem
>>
>> 'when', 'unless' and 'do' are actually RnRS, see (rnrs control).
>>
>
> oh your're right...i was sticked to R5RS ,time i was student...
>
>>
>> 'case' is also RnRS, see (rnrs base).
>>
>> However, looking at (guile)while do, 'while' is indeed non-standard.
>>
>
> and i had rewritten last week a 'while ... do' like in C or Pascal:
> https://www.tutorialspoint.com/pascal/pascal_while_do_loop.htm
> https://www.tutorialspoint.com/cprogramming/c_while_loop.htm
>
> in my Scheme+:
>
> ;; (define do '())
> ;; (while {i < 4}
> ;;    do
> ;;      (display i)
> ;;      (newline)
> ;;      {i <- {i + 1}})
> ;; 0
> ;; 1
> ;; 2
> ;; 3
> ;; $1 = #f
> (define-syntax while
>   (syntax-rules (while do)
>     ((_ pred do b1 ...)
>      (let loop () (when pred b1 ... (loop))))))
>
> i will have to forget it! as i want to keep compatibility with standard
> Scheme also but i will rewrite all with (let () ...) instead of (begin ...)
> unless it can cause some incompatibilities, for now , i do not see problems
> as "who can do more can do less"......
>
> Regards,
> Damien
>
>>
>>


  reply	other threads:[~2022-09-04  8:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-27 16:48 expression and definition context in Scheme Damien Mattei
2022-08-27 17:00 ` Maxime Devos
2022-08-27 19:02   ` Damien Mattei
2022-08-27 19:14     ` Maxime Devos
2022-08-27 19:20     ` Maxime Devos
     [not found]       ` <CADEOadfCCLaqEvzLYUzEYhg94pqN3r9=c6LT=FmCivJsPudUzg@mail.gmail.com>
     [not found]         ` <b95df274-b727-5bb9-4657-f263a837e0f1@telenet.be>
     [not found]           ` <CADEOadfKR_u3qS5N5MwRuCRTxPjKi_wyWzgv-xJJ96e56X2meg@mail.gmail.com>
2022-08-29 10:10             ` Fwd: " Damien Mattei
2022-08-30 10:47 ` Linus Björnstam
2022-08-31  7:01   ` Damien Mattei
2022-08-31 15:29     ` Maxime Devos
2022-09-01 20:21       ` Damien Mattei
2022-09-04  8:08         ` Damien Mattei [this message]
2022-09-07 23:12   ` Aleix Conchillo Flaqué

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=CADEOaddRJDXxg5R5nNLCETqX9Zi3JxWBQG2vbnhWzEgPwxxMxA@mail.gmail.com \
    --to=damien.mattei@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=linus.bjornstam@veryfast.biz \
    --cc=maximedevos@telenet.be \
    /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).