aboutsummaryrefslogtreecommitdiffstats
path: root/test/simple.scm
blob: 41babb538a2e0cb95f06000c775417e03673707e (plain)
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

; This comment should be skipped

(begin
  (display #t)
  (newline))

; anonymous lambda
(define add1 (lambda (x) (+ 1 x)))
(display (eq? (add1 4) 5))
(newline)

; named/defined lambda, spread over multiple lines
(define
  add1
  (lambda
    (x)
    (+ 1 x)))
(display (eq? (add1 4) 5))
(newline)

; this checks that cond is a special form
(define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))
(display (eq? 479001600 (fact 12)))
(newline)

(display (eq? (add1 (car (cons 4 (cons 0 ())))) 5))
(newline)

(car (car (quote (lambda (x) (+ 1 x)))))

(define dummy-var 5)
(set! dummy-var 6)
(display (eq? dummy-var 6))
(newline)

(display (string? "short string with spaces"))
(newline)

(display (pair? (cons 1 (cons 2 ()))))
(newline)

(display (symbol? 'lambda))
(newline)

(display (procedure? add1))
(newline)