Re: [Scheme-reports] [scheme-reports-wg1] Erratum for letrec* definition
John Cowan 01 Dec 2013 18:23 UTC
Jussi Piitulainen scripsit:
> Not sure what there is already but I donate the following.
Thanks. I rewrote this using letrec* as:
(define (means ton)
(letrec*
((mean
(lambda (f g)
(f (/ (sum g ton) n))))
(sum
(lambda (g ton)
(if (null? ton)
(+)
(if (number? ton)
(g ton)
(+ (sum g (car ton))
(sum g (cdr ton)))))))
(n (sum (lambda (x) 1) ton)))
(values (mean values values)
(mean exp log)
(mean / /))))
and added your example to both the errata page and the errata branch.
See LetrecStar on the wiki for which Schemes implement letrec*,
which implement letrec as letrec*, and how they handle internal defines.
--
John Cowan http://ccil.org/~cowan cowan@ccil.org
'My young friend, if you do not now, immediately and instantly, pull
as hard as ever you can, it is my opinion that your acquaintance in the
large-pattern leather ulster' (and by this he meant the Crocodile) 'will
jerk you into yonder limpid stream before you can say Jack Robinson.'
--the Bi-Coloured-Python-Rock-Snake
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports