Up

liststor2

From two lists, create a list with a level of recursivity equal to 2. Lists can have a different size, the missing elements will be nil.

Prototype :

fun [[u0 r1] [u1 r1]] [u0 [u1 r2]]

Return : [u0 [u1 r2]] the new list of level 2 or nil if error

See also :

r2tolists

Example :

The result is : 2::"a"::5::"z"::6::"e"::7::"r"::nil::"t"::nil::"y"::nil ( [I [S r2]] )

// fun [[I [S r2]]] I
fun display (l)=
	if l == nil then
		0
	else
		let l -> [first [second next]] in
		(
		_fooId first;
		_fooS second;
		display next
		);;
		
fun main ()=
	_showconsole;
	let 2::5::6::7::nil -> l1 in			// a first list : [I r1]
	let "a"::"z"::"e"::"r"::"t"::"y"::nil -> l2 in	// a second list : [S r1]
	let liststor2 l1 l2 -> l in			// a new list of level 2 : [I [S r2]]
	display l;
	0;;

Note