aboutsummaryrefslogtreecommitdiff
path: root/src/example/test1.lux
blob: 8e740eabde541fa7db5c2aeffcaebe9065018126 (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
(* 5 6)

## My first function definition!
(def (repeat n val)
  (if (<=' n 0)
    (#Nil [])
    (#Cons [val (repeat (-' n 1) val)])))

## Testing one, two, three...
(repeat 5 5)

(def (fold f init inputs)
  (case inputs
    #( Outer comment #( Inner comment )# )#
    (#Nil [])            init
    (#Cons [head tail]) (fold f (f init head) tail)))

## It's alive!
(fold * 1 (repeat 5 5))

3.14

(def pi 3.14)

pi

(def (foo x)
  (let [y (*' 2 x)]
    (+' x y)))

(foo 10)

(def bar {#x 10 #y 20})
bar
(get@ #x bar)
(set@ #z 30 bar)
(remove@ #y bar)