Up |
list2Build
Create a new list from two lists. Each element of the new list is a tuple with
an element of each initial list.
The lists can have a different size. In this case, nil values will complete all
missing elements.
Prototype :
fun [[u0 r1] [u1 r1]] [[u0 u1] r1]
- [u0 r1] : the first list.
- [u1 r1] : the second list.
Return : [[u0 u1] r1] the new list or nil if error
See also :
Example :
fun display (l)=
if l == nil then
0
else
(
_fooS sprintf "first = %d second = %s" hd l;
display tl l
);;
fun main ()=
_showconsole;
let 2::5::6::7::nil -> l1 in
let "a"::"z"::"e"::"r"::"t"::"y"::nil -> l2 in
let list2Build l1 l2 -> l in // [2 "a"] :: [5 "z"] :: [6 "e"] :: [7 "r"] :: [nil "t"] :: [nil "y"] :: nil
display l;
0;;
Note