I know they were just introduced, but I have a question about the conceptual validity of the following statements in S03, which appear in the newly edited hyper-operators section:

    Bag(3,8,[2,Seq(9,3]],8) >>-<< 1;         # Bag(2,7,[1,Seq(8,2)],7)
    Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,1,1); # Bag(2,7,[1,Seq(8,2)],7)
    Bag(3,8,[2,Seq(9,3)],8) >>-<< (1,1,2,1); # Bag(2,7,[0,Seq(7,1)],7)

First of all, my concept of a Bag is that it is like a Set, in that it is an *un-ordered* collection of things, but unlike a Set, each distinct element can appear more than once in a Bag (eg, the '8'). Correct me if you think differently about that.

Now, say you phrased the lines above slightly differently, like this:

    $bag1 = Bag(3,8,[2,Seq(9,3]],8);
    $bag2 = Bag(3,8,[2,Seq(9,3)],8);
    $bag3 = Bag(3,8,[2,Seq(9,3)],8);

    $bag1 >>-<< 1;         # Bag(2,7,[1,Seq(8,2)],7)
    $bag2 >>-<< (1,1,1,1); # probably the same
    $bag3 >>-<< (1,1,2,1); # ?

Now, the $bag1 example is unambiguous; all Bag members are having 1 added to them. But $bag3 does not seem predictable to me.

Since a Bag is unordered, how do we know, with the $bag3 example, which elements are having a 2 added to them and which elements are having a 1?

The only way that $bag3 could be predictable is if a Bag is ordered. But in that case, how is a Bag different than a Seq?

Now, I realize that technically the source code in the actual S03 does display the members of each Bag in a sequence (the sequence they appear in the code itself), but what would that example compile to (would that seq info be lost), and what information would the compiled code carry to associate the values on the left and right hand sides of the hyper-operator?

So I would appreciate if the S03 examples could be explained as to why they would work, or alternately please replace 'Bag' with 'Seq'.

Thank you. -- Darren Duncan

Reply via email to