cons'ing

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

 

Examples

cons(3,nil)   ~[3|[]] = [3]

cons(2,cons(3,nil))

 

To Next Slide To Previous Slide To Contents