1. Subsripts
Just can't resist this topic--the following were included as convienience
functions in Object Euphoria from version 1.0 on:
global function subscript(sequence Param,sequence subsc)
object returnValue
returnValue=Param
for i=1 to length(subsc) do
returnValue=returnValue[subsc[i]]
end for
return returnValue
end function
global function slice(sequence Param,sequence subsc,atom Min,atom Max)
Param=subscript(Param,subsc)
return Param[Min..Max]
end function
Notice that by using an object variable, no special processing for an atom
is required.
Subscript() will work whenever standard subscripting works, and will crash
whenver standard subscripting crashes. Once subscript() is defined, slice()
is trivial.
-- Mike Nelson