Files
lysp/examples/syntax.lysp
T

50 lines
469 B
Plaintext

;; Conditional
(if #t 1 2)
(cond
[(= 1 2 3) #f]
[(= 1 1 1) #t]
[`otherwise 1234]
)
;; Loops
(while #f
1
2
3)
(loop
1
2
3
(break))
;; Functions
(defun a (x y z w) 1 2 3 x)
(lambda (x y z w) 1 2 3 x)
;; Macros
(defmacro my-quote (x) `(quote ,x))
(print (my-quote (a b c)))
;; vectors
#[1 2 3]
;; progn
(progn
1
2
3)
;; setq
(setq glob-value "my-global")
;; let
(let
(x 1 y 2)
x
)
(let* (x 1 y x) y)
;; Quoting
`(ok ,glob-value)