The document describes Picrin, a R7RS-compatible Scheme implementation, and EROS, a new object system being developed for Picrin. EROS is based on set theory and relations, allowing classes to define their membership rather than objects knowing their class. This inversion allows class-of to be a simple method lookup. EROS also uses generic functions and methods, with methods dispatched based on argument types. The author hopes to merge EROS into Picrin but notes define-relation needs to be implemented first.
86. • (define (fact n)
(fact-tc n 1))
• (define (fact-tc n m)
(if (= n 0) m
(fact-tc (- n 1)
(* n m))))
• (define (fact n)
(if (= n 0) 1
(* n (fact (- n 1))))
末尾再帰
非末尾再帰版fact 末尾再帰版fact