I was testing the following piece of code:
datatype my_int_list = Empty
| Cons of int * my_int_list
fun append (xs, ys) =
case xs of
Empty => ys
| Cons(x, xs') => Cons(x, append(xs', ys))
If I create list of one element, or of two elements, everything is normal. If I create list of three elements it introduces the #
symbol.
- Cons(1, Empty);
val it = Cons (1,Empty) : my_int_list
- Cons(1, Cons(2, Empty));
val it = Cons (1,Cons (2,Empty)) : my_int_list
- Cons(1, Cons(2, Cons(3, Empty)));
val it = Cons (1,Cons (2,Cons #)) : my_int_list
And this is what happens when I try to use the append
function:
- val l1 = Cons(1, Cons(2, Cons(3, Empty)));
val l1 = Cons (1,Cons (2,Cons #)) : my_int_list
- val l2 = Cons(4, Cons(5, Cons(6, Empty)));
val l2 = Cons (4,Cons (5,Cons #)) : my_int_list
- append(l1, l2);
val it = Cons (1,Cons (2,Cons #)) : my_int_list
Is this just SML
way of telling that there are more elements but it's not gonna bother to print them? If so, can I ask it to print everything? If not, did I do something wrong?
Is this just SML way of telling that there are more elements but it's not gonna bother to print them?
Yes!
If so, can I ask it to print everything?
If not, did I do something wrong?
No!