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

Re: [Scheme-reports] Formal definitions [con'd]



On Fri, Nov 30, 2012 at 8:29 AM, Jean-Michel HUFFLEN <jmhuffle@x> wrote:
    Hello,

    I went up with reading the formal definitions of R7RS.

- p. 72, the definition of the auxiliary macro "guard-aux"; the 5th
clause reads:

((guard-aux reraise (test)) test)

    It seems to me that the correct expansion should be:

((guard-aux reraise (test)) (or test reraise))

- p. 70, "define-values"; the 1st clause

((define-values () expr) ...)

seems to me to be useless, "define-values" cannot be used with an
empty list of variables, and no recursive call yields this situation;

- p. 71, "make-parameter": your definition accepts any positive number
of arguments with :

(define (make-parameter init . o) ...)

Why not using "case-lambda", for "make-parameter" as well as its
result?

Because this is actually longer than the cond version.

-- 
Alex
 
That is,

(define make-parameter
   (let ((make-parameter-aux
          (lambda (init converter)
            (let ((value (converter init)))
              (case-lambda
               (() value)
               ((control) (if (eq? control <param-convert>)
                              converter
                              (error "bad parameter syntax")))
               ((control value-0) (if (eq? control <param-set!>)
                                      (set! value value-0)
                                      (error "bad parameter syntax"))))))))
     (case-lambda
      ((init) (make-parameter-aux init values))
      ((init converter) (make-parameter-aux init converter)))))

    Cheers,

J.-M.


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports