mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 11:46:35 +02:00
Adding list section
This commit is contained in:
parent
a14d899e00
commit
e1df435b7d
1 changed files with 8 additions and 1 deletions
|
@ -13,6 +13,13 @@
|
||||||
(assert "Testing assert function" #t)
|
(assert "Testing assert function" #t)
|
||||||
(assert "Testing assert function" 1)
|
(assert "Testing assert function" 1)
|
||||||
|
|
||||||
|
;; Lists
|
||||||
|
(define l (list 'a 'b 'c))
|
||||||
|
; TODO: seems to break eval below, is there a GC problem with a circular list?
|
||||||
|
;(set-cdr! l l)
|
||||||
|
(set-cdr! l '(c b)) ; Above seems to break if it replaces this line
|
||||||
|
(assert:equal "list? on circular list" (list? l) #t)
|
||||||
|
|
||||||
;; Adder example
|
;; Adder example
|
||||||
(define (make-adder x)
|
(define (make-adder x)
|
||||||
(lambda (y) (+ x y)))
|
(lambda (y) (+ x y)))
|
||||||
|
@ -220,7 +227,7 @@
|
||||||
(assert:equal "eval compiled - x" (eval 'x) x)
|
(assert:equal "eval compiled - x" (eval 'x) x)
|
||||||
(eval '(set! x 'mutated-x))
|
(eval '(set! x 'mutated-x))
|
||||||
(assert:equal "Access var with a mangled name" (eval '*z*) *z*)
|
(assert:equal "Access var with a mangled name" (eval '*z*) *z*)
|
||||||
(assert:equal "Access compile var mutated by eval" x 'mutated-x)
|
(assert:equal "Access compiled var mutated by eval" x 'mutated-x)
|
||||||
;; END eval
|
;; END eval
|
||||||
|
|
||||||
; TODO: use display, output without surrounding quotes
|
; TODO: use display, output without surrounding quotes
|
||||||
|
|
Loading…
Add table
Reference in a new issue