Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message
_tom said...

Here is some code to test append:

-- given 
sequence s = {1,2,3,4,5,6,7,8,9,10} 
 
-- want 
--> {2,4,6,8,10}  that is reduce s to all even items 
--> use a recursive function to do this 

Tom,
the append() function is not the appropriate functionality to use in this case because it appends the second argument as a single element to the result, and if the extract function is returning a list of things, then using its returned object in this manner is not what is required. The concatenate operator is a better choice for this exercise. To use append(), the extract function would have to return only a single element from the original list each time it was called.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu