sequence function: for
description:
for(sp1, operators)
for(sp1, sp2, operators)
for(sp1, sp2, sp3, operators)
the for loop function
nested loops over the given superpositions, applying operators specified in 'operators'
examples:
-- just some abstract tests:
merge-elts (*,*) #=> |_self1> _ |: > _ |_self2>
merge-dots (*,*) #=> |_self1> _ | .. > _ |_self2>
for(|0> + |1>, |2> + |3>, |op: merge-elts>)
|0: 2> + |0: 3> + |1: 2> + |1: 3>
for(|0> + |1>, |2> + |3>, |op: merge-elts> + |op: merge-dots>)
|0: 2> + |0 .. 2> + |0: 3> + |0 .. 3> + |1: 2> + |1 .. 2> + |1: 3> + |1 .. 3>
bracket (*) #=> |[> _ smerge[", "] |_self1> _ |]>
print (*) #=> print bracket |_self1>
print (*,*) #=> print bracket(|_self1> . |_self2>)
print (*,*,*) #=> print bracket(|_self1> . |_self2> . |_self3>)
for(|a> + |b> + |c>, |op: print>)
[a]
[b]
[c]
for(split |a b c>, split |a b c>, |op: print>)
[a, a]
[a, b]
[a, c]
[b, a]
[b, b]
[b, c]
[c, a]
[c, b]
[c, c]
for(split |a b>, split |a b>, split |a b>, |op: print>)
[a, a, a]
[a, a, b]
[a, b, a]
[a, b, b]
[b, a, a]
[b, a, b]
[b, b, a]
[b, b, b]
see also:
sfor, smap
Home