I’m adding a list and when I use MyArray|MyElement I print to screen and I get:
[obj1,obj2] | obj3
which isn’t correct, is it? Ideally I want it to be:
[Obj1,Obj2,Obj3]
if I use MyArray|[MyElement]printing out gives me:
[Obj1,Obj2] | [Obj3]
is this the equivalent to [Obj1,Obj2,Obj3] ?
Using the syntax
[ MyElement | MyArray ], you’d getThis is what’s known as “consing” an element onto a list. You could also use an
append/3predicate, like this:which produces