Nested templated data: Difference between revisions

add SETL
(Add Refal)
(add SETL)
 
Line 1,843:
Payload 8 is not defined</pre>
 
=={{header|SETL}}==
<syntaxhighlight lang="setl">program substitution;
template := [[[1,2],[3,4,1],5]];
payload := {
[0,"Payload#0"], [1,"Payload#1"], [2,"Payload#2"], [3,"Payload#3"],
[4,"Payload#4"], [5,"Payload#5"], [6,"Payload#6"]
};
 
print(subst(template, payload));
 
proc subst(template, payload);
if not is_tuple(template) then
return(payload(template));
end if;
 
result := [];
loop for item in template do
result with:= subst(item, payload);
end loop;
return result;
end proc;
end program;</syntaxhighlight>
{{out}}
<pre>[[['Payload#1' 'Payload#2'] ['Payload#3' 'Payload#4' 'Payload#1'] 'Payload#5']]</pre>
=={{header|VBA}}==
VBA allows arrays of variant, so the elements of an array can be both scalars as arrays of different sizes.
2,115

edits