4.3BSD/usr/contrib/icon/book/16/ltree.icn

procedure ltree(stree)
   local a
   stree ?
      if a := [tab(upto('('))] then {	# start with value
         move(1)
					# add subtrees
         while put(a,ltree(tab(bal(',)')))) do
            move(1)
         }
      else a := [tab(0)]		# leaf
   return a
end