22 lines
561 B
Plaintext
22 lines
561 B
Plaintext
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;
|