fix syntax "define"
This commit is contained in:
parent
37cff92d0c
commit
3b70624610
2 changed files with 8 additions and 1 deletions
|
@ -46,7 +46,7 @@ struct Object *syntax_define(
|
|||
struct Object *const environment
|
||||
) {
|
||||
assert(Object_is_pair(environment));
|
||||
assert(OBJECT_IS_NULL(environment->pair.cdr));
|
||||
assert(OBJECT_IS_LIST_HEAD(environment->pair.cdr));
|
||||
assert(OBJECT_IS_LIST_HEAD(environment->pair.car));
|
||||
|
||||
assert(Object_is_pair(args));
|
||||
|
|
|
@ -24,6 +24,13 @@
|
|||
(define (sum a b) (+ a b))
|
||||
(define (inc a) (+ a 1))
|
||||
(sum (inc 1) (inc 2))))
|
||||
(assert-equal
|
||||
11
|
||||
(begin
|
||||
(define (make-inc const-num) (lambda (var-num) (+ var-num const-num)))
|
||||
(define inc1 (make-inc 1))
|
||||
(define inc10 (make-inc 10))
|
||||
(inc1 (inc10 0))))
|
||||
|
||||
;;; if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(assert-equal 123 (if #true 123 456))
|
||||
|
|
Loading…
Reference in a new issue