# # name: newlist.icn # # desc: newlist overrides and extends the built-in procedure list # additionally, # # list(), list(numeric), list(numeric,x) # these behave exactly as the built-in procedure # # Otherwise, list(x) will convert x to a list. # # This gives list() symmetric functionality with set(). It is more # obvious than the old trick of using sort to convert a set to a list. # # list(x) turn will convert other types to a list including # strings and csets (as single character strings), and tables (as values). # # Note: if you want the keys of a table, include "link tables" # and use list(keyset(T)). # # list(list) will return itself and not a 1 deep copy of itself # # # author: Steve Wampler, David Gamey # date: July 2005 # status: This file is in the public domain.
procedure list(x[]) #: create a list or convert type to list local L static LIST initial LIST := proc("list",0) if (*x = 0) | numeric(x[1]) then return LIST!x else if type(x) == "list" then return x else { every put(L := [], !x[1]) return L } end ------------------------------------------------------- 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