Nested templated data: Difference between revisions

no edit summary
m (REXX - correct lang tag)
No edit summary
Line 161:
Array{Any,1}[[Any["Payload#1", "Payload#2"], Any["Payload#3", "Payload#4", "Payload#1"], "Payload#5"]]
</pre>
 
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Font "Courier New"
cls
Module Checkit {
t=(((1,2), (3,4,1),5),) ' use (1,) for one item tuple
Payload = lambda (a)->{
k=each(a)
res=(,)
link a to a()
while k {
if type$(a(k^))="mArray" then
Append res, (Lambda(array(a, k^)),)
else
Append res, ("Payload#"+trim$(str$(array(k))),) ' one item tuple append to res
end if
}
=res
}
Expand$ = lambda$ (a, feed$=" ")->{
k=each(a)
lim=len(a)-1
res$="["
link a to a() ' to use type$()
while k {
if type$(a(k^))="mArray" then
res$+=Lambda$(array(a, k^),feed$+" ")
if k^<lim then
res$+={,
}+feed$
end if
else
res$+= "'"+array$(k)+"'"
if k^<lim then res$+=", "
end if
}
=res$+"]"
}
Clipboard Expand$(Payload(t))
}
Checkit
report Clipboard$
</lang>
{{out}}
<pre style="height:30ex;overflow:scroll">
[[['Payload#1', 'Payload#2'],
['Payload#3', 'Payload#4', 'Payload#1'],
'Payload#5']]
</pre >
 
=={{header|Perl}}==
Anonymous user