mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-15 11:18:43 +00:00
Added pattern-matching in lectures
This commit is contained in:
parent
dad4c35a80
commit
d89cd76cd9
11 changed files with 247 additions and 27 deletions
|
|
@ -1,4 +1,4 @@
|
|||
TESTS=$(basename $(wildcard test*.expr))
|
||||
TESTS=$(sort $(basename $(wildcard test*.expr)))
|
||||
|
||||
RC=../../src/rc.opt
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ fun insert (tree, value) {
|
|||
esac
|
||||
}
|
||||
|
||||
tree := Empty;
|
||||
local i, tree = Empty;
|
||||
|
||||
for i := 0, i <= 10, i := i+1 do
|
||||
printf ("%s\n", tree.string);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
fun collect_ints_acc (v, tail) local i {
|
||||
fun collect_ints_acc (v, tail) {
|
||||
local i;
|
||||
|
||||
case v of
|
||||
a@#unboxed -> return Cons (a, tail)
|
||||
| #string -> return tail
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
lists := [
|
||||
local lists = [
|
||||
{},
|
||||
{1, 2, 3, 4},
|
||||
{{1}, {2, 3}, {4, {5, 6}}},
|
||||
1 : 2 : 3 : 4 : {}
|
||||
];
|
||||
], i;
|
||||
|
||||
for i := 0, i<lists.length, i:=i+1 do
|
||||
printf ("%s\n", lists[i].string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue