-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinteractions.lisp
More file actions
77 lines (55 loc) · 1.65 KB
/
Copy pathinteractions.lisp
File metadata and controls
77 lines (55 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
(in-package :cl-user)
(asdf:load-system :bard)
(in-package :bard)
;;; ---------------------------------------------------------------------
;;; compiling expressions
;;; ---------------------------------------------------------------------
(comp-show 3)
(comp-show '(2 3 4))
(setf $code2 (compiler '(begin (display "some text")(newline) (* 3 4))))
;;; ---------------------------------------------------------------------
;;; testing with bard repl:
;;; ---------------------------------------------------------------------
(bard)
;;; bard expressions
;;; -------------------
101
'(2 3 4)
(begin (display "some text")(newline) (* 3 4))
((fn (x)(+ 1 x)) 100)
(define $x nothing)
(set! $x 1)
(define (add1 x)(+ x 1))
(set! $x (add1 $x))
(let ((x 10)
(y 12))
(+ x y))
(let ((x 13)
(y 12))
(newline)
(if (> x y)
(begin (display 'yep)
(newline))
(begin (display 'nope)
(newline))))
(let ((x 10)
(y (+ x 2)))
(+ x y))
(define mul (fn (x y)(* x y)))
(define div /)
;; should return 4
(+ 1 (call/cc (fn (k) (+ 2 (k 3)))))
;; should count to 10 then return using the captured continuation
(call/cc (fn (return)
(let ((count 0))
(define (testloop)
(if (>= count 10)
(return (begin (newline)
(display "called return")
(newline)
count))
(begin (newline)
(set! count (+ 1 count))
(display count)))
(testloop))
(testloop))))