Caught a silly typo; now sufficient to support classic factorials with recursions.
This commit is contained in:
parent
54de465dbe
commit
34fef03ba8
|
@ -77,6 +77,8 @@
|
||||||
(defprimitive car car 1)
|
(defprimitive car car 1)
|
||||||
(defprimitive set-cdr! set-mcdr! 2)
|
(defprimitive set-cdr! set-mcdr! 2)
|
||||||
(defprimitive + + 2)
|
(defprimitive + + 2)
|
||||||
|
(defprimitive - - 2)
|
||||||
|
(defprimitive * * 2)
|
||||||
(defpredicate lt < 2)
|
(defpredicate lt < 2)
|
||||||
(defpredicate eq? eq? 2)
|
(defpredicate eq? eq? 2)
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@
|
||||||
; silly patch because of the mutatable lists
|
; silly patch because of the mutatable lists
|
||||||
|
|
||||||
(define-syntax mcaar (syntax-rules () ((_ e) (mcar (mcar e)))))
|
(define-syntax mcaar (syntax-rules () ((_ e) (mcar (mcar e)))))
|
||||||
(define-syntax mcadr (syntax-rules () ((_ e) (mcdr (mcar e)))))
|
(define-syntax mcdar (syntax-rules () ((_ e) (mcdr (mcar e)))))
|
||||||
|
|
||||||
; Iterate through the environment, find an ID, return its associated
|
; Iterate through the environment, find an ID, return its associated
|
||||||
; value.
|
; value.
|
||||||
|
@ -186,3 +188,5 @@
|
||||||
(begin (display result) (toplevel))
|
(begin (display result) (toplevel))
|
||||||
#f)))
|
#f)))
|
||||||
(toplevel))
|
(toplevel))
|
||||||
|
|
||||||
|
; (set! fact (lambda (x) (if (eq? x 0) 1 (* x (fact (- x 1))))))
|
||||||
|
|
Loading…
Reference in New Issue