mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-24 15:48:47 +00:00
Pattern matching in X86
This commit is contained in:
parent
9f8391607d
commit
bbe403de26
18 changed files with 179 additions and 3 deletions
12
regression/test043.expr
Normal file
12
regression/test043.expr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
fun sum (x) {
|
||||
case x of
|
||||
`nil -> return 0
|
||||
| `cons (x, tl) -> return x + sum (tl)
|
||||
esac
|
||||
}
|
||||
|
||||
x := read ();
|
||||
|
||||
write (sum (`nil));
|
||||
write (sum (`cons (100, `nil)));
|
||||
write (sum (`cons (100, `cons (200, `nil))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue