26 lines
383 B
Text
26 lines
383 B
Text
|
fun concat (l1, l2) =
|
||
|
match (l1) {
|
||
|
| N -> l2
|
||
|
| C (x, xs) -> C (x, concat (xs, l2))
|
||
|
}
|
||
|
|
||
|
let l = C (1, C (2, N))
|
||
|
let l = concat (l, l)
|
||
|
let l = concat (l, l)
|
||
|
let l = concat (l, l)
|
||
|
let l = concat (l, l)
|
||
|
let l = concat (l, l)
|
||
|
let l = concat (l, l)
|
||
|
|
||
|
fun len (l) =
|
||
|
match (l) {
|
||
|
| N -> 0
|
||
|
| C (x, xs) -> 1 + len (xs)
|
||
|
}
|
||
|
|
||
|
let test =
|
||
|
print_int (len (l));
|
||
|
print_string ("\n")
|
||
|
|
||
|
|