Scolring - Forum

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.

#1 16-Dec-2014 19:52:26

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

what does the listcat function do?

colleagues:

what does the listcat function do? i wrote a simple app to display the output of a listcat function with the second argument set to 'NIL'...and the output is the same...what does that second argument do?

here is my simple app:

typeof lcatlist = [S r1];;

fun listcat (p, q)=

  if p==nil

  then

    q

  else let p -> [h nxt] in

    h::listcat nxt q;;
    
    
 

fun main ()=
	//_cacheActivate; 
	set lcatlist = "henry"::"martha"::"john"::nil;
	_showconsole;
	_fooSList (listcat lcatlist nil);
	_fooSList  lcatlist;
	0;;

iri you used listcat in getting the list of all files in a partition....what reason is it needed for?

Offline

#2 16-Dec-2014 19:57:11

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: what does the listcat function do?

ok, i did another test....

fun main ()=
	//_cacheActivate; 
	set lcatlist = "henry"::"martha"::"john"::nil;
	let "jimmy"::"johnny"::nil -> second_parameter_list in
	(
	_showconsole;
	_fooSList (listcat lcatlist second_parameter_list);
	_fooSList  lcatlist;
	);
	0;;

does the listcat just put two lists together without including the 'nil', (the last element) of the first list?

Last edited by hebdemnobad (16-Dec-2014 19:58:00)

Offline

#3 16-Dec-2014 20:14:06

Bob Le Gob
Scol language & Scol applications developer
Registered: 9-Apr-2009
Posts: 26

Re: what does the listcat function do?

yes, this is exactly what it does.

Offline

#4 17-Dec-2014 10:57:26

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: what does the listcat function do?

listcat => lists concatenation

fun main ()=
	//_cacheActivate; 
	set lcatlist = "henry"::"martha"::"john"::nil;
	_showconsole;
	_fooSList (listcat lcatlist nil);
	_fooSList  lcatlist;
	0;;

Of course, if you set the argument to nil ... wink
You are right, it is also very important to check that the behavior is correct with unexpected values smile

Offline

Board footer

Powered by FluxBB