chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] and-let* syntax too permissive?


From: John Cowan
Subject: Re: [Chicken-users] and-let* syntax too permissive?
Date: Mon, 24 Jun 2013 11:30:06 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Michele La Monaca scripsit:

> This nonsense seems to be valid syntax:
> 
> #;1> (and-let* ((foobar 1 2 3)) foobar)

I grabbed the Chibi definition and translated it into Chicken.  Unfortunately,
(use and-let) does not override the core definition for some reason.
Here it is with and-let* changed to and-let (no star):

(module and-let (and-let)
  (import scheme)
  (define-syntax and-let
    (syntax-rules ()
      ((and-let () . body)
       (begin #t . body))
      ((and-let ((var expr)))
       expr)
      ((and-let ((expr)))
       expr)
      ((and-let (expr))  ; Extension: in SRFI-2 this can only be a var ref
       expr)
      ((and-let ((var expr) . rest) . body)
       (let ((var expr))
         (and var (and-let rest . body))))
      ((and-let ((expr) . rest) . body)
       (and expr (and-let rest . body)))
      ((and-let (expr . rest) . body)   ; Same extension as above
       (let ((tmp expr))
         (and tmp (and-let rest . body)))))))

It rejects the above example with an undefined-variable error.

-- 
John Cowan <address@hidden>             http://www.ccil.org/~cowan
Sir, I quite agree with you, but what are we two against so many?
    --George Bernard Shaw,
         to a man booing at the opening of _Arms and the Man_



reply via email to

[Prev in Thread] Current Thread [Next in Thread]