13 lines
350 B
Text
13 lines
350 B
Text
to flatten :l
|
|
if not list? :l [output :l]
|
|
if empty? :l [output []]
|
|
output sentence flatten first :l flatten butfirst :l
|
|
end
|
|
|
|
; using a template iterator (map combining results into a sentence)
|
|
to flatten :l
|
|
output map.se [ifelse or not list? ? empty? ? [?] [flatten ?]] :l
|
|
end
|
|
|
|
make "a [[1] 2 [[3 4] 5] [[[]]] [[[6]]] 7 8 []]
|
|
show flatten :a
|