forked from alex-eg/sex
rename dir lib -> example
because it is not quite lib yet, but an example dump definitely
This commit is contained in:
36
example/test-list.sex
Normal file
36
example/test-list.sex
Normal file
@@ -0,0 +1,36 @@
|
||||
(include stdlib.h)
|
||||
(include stddef.h)
|
||||
(include stdbool.h)
|
||||
(include stdio.h)
|
||||
|
||||
(load "list.seh")
|
||||
|
||||
(struct foo
|
||||
((float a)
|
||||
(int b)
|
||||
((const char *) c)))
|
||||
|
||||
,(list-T '(int))
|
||||
,(make-list-T '(int) #f)
|
||||
,(add-value-list-T '(int) #f)
|
||||
,(length-list-T '(int) #f)
|
||||
,(is-empty-list-T '(int) #f)
|
||||
|
||||
|
||||
(extern fn void puk ((int a) (float b)))
|
||||
(fn bool bar () false)
|
||||
(pub fn void baz () true)
|
||||
|
||||
(extern var int i)
|
||||
(var int j)
|
||||
(pub var int k)
|
||||
|
||||
(pub fn int main ()
|
||||
(var (* list-int) l (make-list-int))
|
||||
(printf "Size of the list: %zu\n" (length-list-int l))
|
||||
(add-value-list-int l 3)
|
||||
(add-value-list-int l 4)
|
||||
(printf "Size of the list: %zu\n" (length-list-int l))
|
||||
,(list-for-each '((printf "%d " v) l v))
|
||||
(printf "\n")
|
||||
0)
|
||||
Reference in New Issue
Block a user