Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
by inference, the cause is probably me, but here it is, neither remove_from_list and removeItemInList seem to be removing the requested item from the list
typeof list1 =[I r1];;
typeof list2 =[I r1];;
fun remove_from_list(l,p)=
if l==nil then nil
else let l -> [a nxt] in
if a==p then nxt
else a::remove_from_list nxt p;;
fun removeItemInList (list, item)=
if list == nil then
nil
else
if item == hd list then
tl list
else
(hd list) :: removeItemInList tl list item;;
fun main()=
_showconsole;
set list1= 2::8::561::591::nil;
set list2= 2::8::561::591::nil;
_fooS "we are starting with list1 below:";
_fooIdList list1;
remove_from_list list1 561;
_fooS "the list after remove_from_list is below";
_fooIdList list1;
_fooS "we are starting with list2 below:";
_fooIdList list2;
removeItemInList list2 561;
_fooS "the list after removeItemInList is below";
_fooIdList list2;;
Offline
This is normal. The returned list is your result.
set list1 = remove_from_list list1 561;
and you are happy
yes I am thx!
Offline