Very nice suggestion.  Now it also works on tables
returning the values as elements.  

(... Makes me wonder if there is already a routine
that grabs table keys ...)


But it introduces something else that may not be
desirable

Consider ...

x := [a, b, ...., z]
y := list(x)


Now y is a 1 deep copy of x!   

We're also ignoring arguments 2+ if present.

David

--- Steve Wampler <[EMAIL PROTECTED]> wrote:

> DAVID GAMEY wrote:
> > 
> > Works a charm.  With a little wrapping, the
> asymmetry
> > is fixed ...
> > 
> > procedure list(x[])
> > local L
> > static LIST
> > initial LIST := proc("list",0)
> > 
> > if type(x[1]) ~== "set" then return LIST!x
> > else {
> >    every put(L := [], !x[1])
> >    return L
> > }
> > end
> 
> Nice!
> How about changing the test to (something like):
> 
>   if (*x = 0) | numeric(x[1]) then return LIST!x
>   else {...
> 
> that way, you could pass in records, strings (cute,
> converts a string to a list of characters!), etc.
> and not just sets.
> 
> 
> -- 
> Steve Wampler -- [EMAIL PROTECTED]
> The gods that smiled on your birth are now laughing
> out loud.
> 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to