[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expression and definition context in Scheme
From: |
Damien Mattei |
Subject: |
Re: expression and definition context in Scheme |
Date: |
Thu, 1 Sep 2022 22:21:09 +0200 |
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
>
>
- Re: expression and definition context in Scheme,
Damien Mattei <=