From: Wade B. <sta...@yc...> - 2005-11-22 05:25:44
|
DAVID GAMEY writes: >> Were you thinking of using ++ and -- for table union >> and intersection (both >> based on the table keys) respectively? I imagine >> that would be useful. > > Yes - exactly. In some cases it would be useful, but > balancing and generalizing it raises all kinds of > interesting questions, think of all the cases like > this ... > > T1["X"] := [1,2,3,4,4] > T2["X"] := [: 5 :] # excuse the new notation > T3 := T1 ++ T2 I've worked with set-logic-with-arrays before. Using the new notation, I think you'd probably want T2 ++ T1 to evaluate to [ "X" : [1,2,3,4,4] ] and T1 ++ T2 to evaluate to [ "X" : [: 5 :] ] But that's not a very complete example. If you had: T1 := [ "A":"apple", "B":"banana", "C":"pear" ] T2 := [ "B":"orange", "C":"apricot", "D":"plum" ] then T1 ++ T2 should be [ "A":"apple", "B":"orange", "C":"apricot", "D":"plum" ] and T2 ++ T1 should be [ "A":"apple", "B":"banana", "C":"pear", "D":"plum" ] and then T1 -- T2 should be [ "B":"orange", "C":"apricot" ] and T2 -- T1 should be [ "B":"banana", "C":"pear" ] (I note that this is also an interesting experiment in the visual utility of the proposed table constant notation. :-) Wade. |