Nested templated data: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: fixed routine name) |
|||
Line 127: | Line 127: | ||
The unused payloads have indices of : [0 6] |
The unused payloads have indices of : [0 6] |
||
</pre> |
|||
=={{header|Julia}}== |
|||
The array structure needs to be specified as Any type of data, to allow later assignment of strings to the paces in the array where there are integers. |
|||
<lang julia>t = ([Any[Any[1, 2], |
|||
Any[3, 4, 1], |
|||
5]]) |
|||
p = ["Payload#$x" for x in 0:6] |
|||
for (i, e) in enumerate(t) |
|||
if e isa Number |
|||
t[i] = p[e + 1] |
|||
else |
|||
for (j, f) in enumerate(e) |
|||
if f isa Number |
|||
e[j] = p[f + 1] |
|||
else |
|||
for (k, g) in enumerate(f) |
|||
if g isa Number |
|||
f[k] = p[g + 1] |
|||
end |
|||
end |
|||
end |
|||
end |
|||
end |
|||
end |
|||
show(t) |
|||
</lang>{{output}}<pre> |
|||
Array{Any,1}[[Any["Payload#1", "Payload#2"], Any["Payload#3", "Payload#4", "Payload#1"], "Payload#5"]] |
|||
</pre> |
</pre> |
||