Up

set_nth_list

Set an element of a list from its index.

Prototype :

fun [[u0 r1] I u0] [u0 r1]

Return : [u0 r1] this list or nil if an error occurs.

See also :

nth_list

Example :

fun fList (elt, index, list)=
	_fooId index;					// display the current index
	if elt == 'z then
		(
		set list = set_nth_list list index 'e;	// replace z to e
		_fooS listtostr list;			// display the new content (or use _fooSList directly)
		nil					// stop the loop (returning nil, see forList doc)
		)
	else
		set list = set_nth_list list index elt;;

fun main ()=
	_showconsole;
	let "Hzllo World" -> string in
	let strtolist string -> list in
	_fooId forList mkfun3 @fList list list;
	0;;