With the "let" assignment
StreamsOfUnit[(u & '_' & t)] := StreamsOfUnit[(u & '_' & t)] union {(u & '_' & t & '_' & 'q')};
you have a reference to StreamsOfUnit[(u & '_' & t)] on the right side of the := operator. Hence this assignment cannot be carried out until StreamsOfUnit[(u & '_' & t)] has a value; by adding "default {}" to your definition of StreamsOfUnit you are guaranteeing that it will have the value {} when the assignment is executed, even if no value has been explicitly given to it.
For the assignments in
handler.in I would normally favor
for {u in UnitsOfType["SOWE"], t in temp}
{ let Units := Units union {(u & '_' & t)};
let Streams := Streams union {(u & '_' & t & '_' & 'q')};
let StreamsOfUnit[(u & '_' & t)] := StreamsOfUnit[(u & '_' & t)] union {(u & '_' & t & '_' & 'q')};
}
because this is the clearest description. However, if {u in UnitsOfType["SOWE"], t in temp} is a very large set and you are running into trouble with the for loop being slow to execute, then it makes sense to use three indexed "let" statements instead. The indexed "let" statements will perform the assignments in a different order, but I don't see any problem with that.
Bob Fourer
am...@googlegroups.com