[ESL - Index ]
General sequence operations
?
s = find_all(x, s)
Like Euphoria's find(), but doesn't only return the first place where x was found in s,
but a sequence that is a list of all places where x was found in s.
new
Status: proposed
s = replace_element(source, whatToReplace, replaceWith, matchCase)
Looks for all cases where find(whatToReplace,source) returns a value != 0, and replaces
the sequence 'whatToReplace' with the sequence 'replaceWith'. If and only if the boolean flag
'matchCase' is TRUE, find()ing is case-sensitive. The (maybe changed) source sequence is returned.
new
Status: proposed
see also : replace_word(),
replace_substring()
i = count(x, s)
Counts how often object x is contained in sequence s.
new
Status: proposed
i = depth(s)
Returns the "depth" of an object. An atom returns 0, a string returns 1, a composite sequence
returns 2 or more.
(Ricardo Forno had posted such a function in March 2002 on EUforum.)
new
Status: proposed
s = flatten(s)
Takes a sequence of arbitrary depth, and returns its contents as flat sequence (depth = 1).
(Derek Parnell had posted such a function in June 2003 on EUforum.)
new
Status: proposed