GNU bug report logs -
#48318
(ice-9 match) does not allow distinguishing between () and #nil
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi guilers,
I've found the following surprising behaviour:
(use-modules (ice-9 match))
(match (identity #nil) (() 'scheme-eol) (#nil 'elisp-eol))
--> scheme-eol, expected elisp-eol
(match '() (#nil 'elisp-eol) (() 'elisp-eol))
--> elisp-eol, expected scheme-eol
Treating () and #nil as equivalent makes sense, but should be
documented.
My suspicion, currently untested: the following code in
ice-9/match.upstream.scm ...
(define-syntax match-two
(syntax-rules (_ ___ ..1 *** quote quasiquote ? $ = and or not set! get!)
((match-two v () g+s (sk ...) fk i)
(if (null? v) (sk ... i) fk))
[..]
should be:
(define-syntax match-two
(syntax-rules (_ ___ ..1 *** quote quasiquote ? $ = and or not set! get!)
((match-two v () g+s (sk ...) fk i)
(if (eq? v '()) (sk ... i) fk))
((match-two v #nil g+s
(sk ...) fk i)
(if (eq? v #nil) (sk ... i) fk))
[...]
And the following might need similar adjustment:
((match-two v (p) g+s sk fk i)
(if (and (pair? v) (null? (cdr v)))
(let ((w (car v)))
(match-one w p ((car v) (set-car! v)) sk fk i))
fk))
Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 4 years and 32 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.