RE: Sequence depths please explain

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

Maybe i'm a tiny bit off topic but this may be inspiring. Take a look a this
(recursive) function:
--------------------------------------------------
global function skeleton(object o)
-- if the input is a sequence, the output is a printable representation of the
"skeleton" of the sequence
-- where the atoms are represented by dots (or whatever you like). ex:
{1,2,{3},"four",{5,6}} --> "{..{.}{....}{..}}"

sequence skel
object skeli

if atom(o) then return o end if

skel = ""
for i = 1 to length(o) do
	skeli = skeleton(o[i])
	if atom(skeli) then
		skel &= '.'  --<--change here if you prefer stars or dashes or...
	else
		skel &= skeli
	end if
end for

return '{' & skel & '}'
end function

Henri Goffin

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

Search



Quick Links

User menu

Not signed in.

Misc Menu