in rex :
cons(F,R) [F|R]
in Java : [] is used for arrays ;
we just use cons
How cons works in Java:
cons(F,R)
ÅÍ Î existing list (ref)
Î first cell of a new list
F: some value R Æ refers to something(or null)
cons(F,R) creates
return value whatever R refers to
cons(3,nil) ~[3|[]] = [3]
cons(2,cons(3,nil))