* (case ...)
@ 2007-05-22 17:04 Marijn Schouten (hkBst)
2007-05-22 17:54 ` Marijn Schouten (hkBst)
2007-05-23 7:44 ` Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-05-22 17:04 UTC (permalink / raw)
To: stklos, bug-guile
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
it seems that stklos and guile have some problems with (case ...). I concocted
the following testcase:
define (num->bool i)
(case i
('0 #f)
('1 #t)))
(define (num->bool2 i)
(case i
((0) #f)
((1) #t)))
(display (num->bool2 1))(newline)
(display (num->bool2 0))(newline)
(newline)
(display (num->bool 1))(newline)
(display (num->bool 0))(newline)
running this through my schemes produces:
gambit compiler:
compiling...
running...
#t
#f
#t
#f
mzscheme:
#t
#f
#t
#f
bigloo:
#t
#f
#t
#f
gauche:
#t
#f
#t
#f
chicken compiler:
compiling...
running...
#t
#f
#t
#f
guile:
#t
#f
ERROR: In procedure memoization:
ERROR: Duplicate case label quote in expression (case i ((quote 0) #f) ((quote
1) #t)).
stklos with full-syntax:
**** Error while evaluating "(begin (require \"full-syntax\") (load
\"casetest.scm\"))"
Where: in error
Reason: case: duplicate case value quote in ('1 '#t)
- error
- compiler-error
- for-each
- car
- for-each
- <<let/call>>
- rewrite-case-clauses
- compile-case
- compile-user-lambda
- =
- ...
Set shell variable STKLOS_FRAMES to set visible frames
EXIT
stklos:
**** Error while executing file "casetest.scm"
Where: in error
Reason: case: duplicate case value quote in ('1 #t)
- error
- compiler-error
- for-each
- car
- for-each
- <<let/call>>
- rewrite-case-clauses
- compile-case
- compile-user-lambda
- =
- ...
Set shell variable STKLOS_FRAMES to set visible frames
EXIT
elk:
#t
#f
#t
#f
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGUyKKp/VmCx0OL2wRAhS0AKCSP3e5TWjIA/27e3pOR/OANvUiQACgtgqj
4CSpORi/SJv3OL8d4KRm5k8=
=gag8
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (case ...)
2007-05-22 17:04 (case ...) Marijn Schouten (hkBst)
@ 2007-05-22 17:54 ` Marijn Schouten (hkBst)
2007-05-23 7:44 ` Ludovic Courtès
1 sibling, 0 replies; 5+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-05-22 17:54 UTC (permalink / raw)
To: bug-guile
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Marijn Schouten (hkBst) wrote:
> Hi list,
>
> it seems that stklos and guile have some problems with (case ...). I concocted
> the following testcase:
Sorry about that. The duplicate quote clauses in (case ...) make my code
invalid. I am surprised that not more implementations reported the error, but
apparently this is only encouraged by the standard.
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGUy5Sp/VmCx0OL2wRAk76AJ0f5RYnPTQQblnwa+2M5HMmuYpLXgCgxA/P
VnPanFqUFn4YHmPzPMCK3nY=
=S75v
-----END PGP SIGNATURE-----
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (case ...)
2007-05-22 17:04 (case ...) Marijn Schouten (hkBst)
2007-05-22 17:54 ` Marijn Schouten (hkBst)
@ 2007-05-23 7:44 ` Ludovic Courtès
2007-05-23 11:07 ` Marijn Schouten (hkBst)
1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2007-05-23 7:44 UTC (permalink / raw)
To: Marijn Schouten (hkBst); +Cc: bug-guile
Hi,
"Marijn Schouten (hkBst)" <hkBst@gentoo.org> writes:
> define (num->bool i)
> (case i
> ('0 #f)
> ('1 #t)))
Is this valid R5RS code? I would say no since it is neither a <clause>
nor an "else clause".
(Your next message seems to imply that it is indeed incorrect.)
Thanks,
Ludovic.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (case ...)
2007-05-23 7:44 ` Ludovic Courtès
@ 2007-05-23 11:07 ` Marijn Schouten (hkBst)
2007-05-23 11:40 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-05-23 11:07 UTC (permalink / raw)
To: Marijn Schouten (hkBst), bug-guile
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ludovic � wrote:
> Hi,
>
> "Marijn Schouten (hkBst)" <hkBst@gentoo.org> writes:
>
>> define (num->bool i)
>> (case i
>> ('0 #f)
>> ('1 #t)))
>
> Is this valid R5RS code? I would say no since it is neither a <clause>
> nor an "else clause".
>
> (Your next message seems to imply that it is indeed incorrect.)
>
> Thanks,
> Ludovic.
The datums of the clauses are "(quote 0)" and "(quote 1)", each of which is
valid on its own, but since the datum "quote" is contained in both clauses,
the two of them together are invalid,
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGVCBZp/VmCx0OL2wRAsoeAKCgvV9jdptLh52DN2mx5R87zlFAfACgsAeT
x6GKuMKg3h33zajP5aWcPiM=
=ectF
-----END PGP SIGNATURE-----
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (case ...)
2007-05-23 11:07 ` Marijn Schouten (hkBst)
@ 2007-05-23 11:40 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2007-05-23 11:40 UTC (permalink / raw)
To: Marijn Schouten (hkBst); +Cc: bug-guile
Hi,
"Marijn Schouten (hkBst)" <hkBst@gentoo.org> writes:
> The datums of the clauses are "(quote 0)" and "(quote 1)", each of which is
> valid on its own, but since the datum "quote" is contained in both clauses,
> the two of them together are invalid,
Ok, thanks for the clarification.
Ludovic.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-05-23 11:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-22 17:04 (case ...) Marijn Schouten (hkBst)
2007-05-22 17:54 ` Marijn Schouten (hkBst)
2007-05-23 7:44 ` Ludovic Courtès
2007-05-23 11:07 ` Marijn Schouten (hkBst)
2007-05-23 11:40 ` Ludovic Courtès
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).