mirror of
https://github.com/ProgramSnail/Lama.git
synced 2026-01-01 03:28:19 +00:00
Constructors capitalized
This commit is contained in:
parent
3bf36ae719
commit
4879a02753
18 changed files with 147 additions and 145 deletions
|
|
@ -1,21 +1,21 @@
|
|||
fun append (x, y) {
|
||||
case x of
|
||||
`nil -> return y
|
||||
| `cons (h, t) -> return `cons (h, append (t, y))
|
||||
Nil -> return y
|
||||
| Cons (h, t) -> return Cons (h, append (t, y))
|
||||
esac
|
||||
}
|
||||
|
||||
fun printList (x) {
|
||||
case x of
|
||||
`nil -> skip
|
||||
| `cons (h, t) -> write (h); printList (t)
|
||||
Nil -> skip
|
||||
| Cons (h, t) -> write (h); printList (t)
|
||||
esac
|
||||
}
|
||||
|
||||
n := read ();
|
||||
|
||||
x := `cons (1, `cons (2, `nil));
|
||||
y := `cons (3, `cons (4, `nil));
|
||||
x := Cons (1, Cons (2, Nil));
|
||||
y := Cons (3, Cons (4, Nil));
|
||||
|
||||
printList (x);
|
||||
printList (y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue