Flatten a list: Difference between revisions

Content added Content deleted
(Flatten a list en Qbasic)
(Flatten a list en True BASIC)
Line 3,909: Line 3,909:


=={{header|TI-89 BASIC}}==
=={{header|TI-89 BASIC}}==

There is no nesting of lists or other data structures in TI-89 BASIC, short of using variable names as pointers.
There is no nesting of lists or other data structures in TI-89 BASIC, short of using variable names as pointers.


Line 3,916: Line 3,915:


{{omit from|UNIX Shell}}
{{omit from|UNIX Shell}}

=={{header|True BASIC}}==
<lang qbasic>LET sstring$ = "[[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8 []]"
FOR sicount = 1 TO LEN(sstring$)
IF pos("[] ,",(sstring$)[sicount:sicount+1-1]) = 0 THEN
LET sflatter$ = sflatter$ & scomma$ & (sstring$)[sicount:sicount+1-1]
LET scomma$ = ", "
END IF
NEXT sicount
PRINT "["; sflatter$; "]"
END</lang>


=={{header|TXR}}==
=={{header|TXR}}==

An important builtin.
An important builtin.
<lang txr>@(bind foo ((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ()))
<lang txr>@(bind foo ((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ()))