summaryrefslogtreecommitdiff
blob: bc629cb6ddca0190c2342c4a40c116fa4841c25a (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
49
50
51
52
53
54
55
56
57
58
(fate_version 1)

(declare_structure test_struct
   (int i)
   (float f)
   (int j)
   (string str)
)

(global test_struct st0)
(global test_struct st1)

(set_fields! st0
   (i -1)
   (f -5.0)
   (j -2)
   (str nothing)
)

(global (lambda test_struct (test_struct)) update_test_struct)

(set_value update_test_struct
   (lambda ( (test_struct s) )
      (if_else (< (var s.i) 10)
         (eval
            update_test_struct
            (set_fields s
               (i (+ (var s.i) 1))
               (j (+ (var s.j) 10))
            )
         )
         (var s)
      )
   )
)

(set_value st1 (eval update_test_struct (var st0)))

(car (cons 1 (cons 2 (cons 3 (cons 4 5)))))
(car (cdr (cons 1 (cons 2 (cons 3 (cons 4 5))))))
(car (cdr (cdr (cons 1 (cons 2 (cons 3 (cons 4 5)))))))
(car (cdr (cdr (cdr (cons 1 (cons 2 (cons 3 (cons 4 5))))))))
(cdr (cdr (cdr (cdr (cons 1 (cons 2 (cons 3 (cons 4 5))))))))

(global (list int) int_list_a)
(global (list int) int_list_b)
(global (list int) int_list_c)
(global int i)

(for (set i 0) (< (var i) 10) (set i (+ (var i) 1))
   (add! (var i) int_list_a)
   (add! (var i) int_list_c)
)

(set int_list_b (shuffle int_list_a))
(shuffle! int_list_c)

(end)