Transactions between table rows in the same or two different tables are also supported. As long the transaction operator has no assignment operator (described in the next sections further below), then the destination row is cleared by moving all data 1 line down before the writing take place, so no exiting data gets lost
table initialize( animals1,
{ { Name, Leg count, Special ability },
{ Owl, 2, Night vision },
{ Dog, 4, Sensitive nose },
{ Ape, 2 or 4, Relatively smart } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
[ animals1: Name, Dog, .. ] +<== [ animals2: Name, Cat, ]; // sharp claws will be added
[ animals1: {Name,Leg count}, 3 ] +<== [ animals2: Name, Bee, { Weapon, Name, Leg count } ]; // Only name + leg count will be transferred: Bee
[ animals2: Name, 2 ] +<== [ animals1: Special ability, 1 ]; // No transaction due to mismatching headers. Added row stays blank
table list( animals1 ); // Cat with sensitive nose, relatively smart bee
table list( animals2 ); // No changes. Gnu (row 1) stays a gnu.
0 : Name | Leg count | Special ability | Weapon
1 : Owl | 2 | Night vision |
2 : Cat | 4 | Empathy to humans | sharp claws
3 : Bee | 6 | |
4 : Dog | 4 | Sensitive nose |
5 : Ape | 2 or 4 | Relatively smart |
0 : Name | Leg count | Special ability | Weapon
1 : Bee | 6 | Makes honey | sting
2 : | | |
3 : Gnu | 4 | Knows UNIX | horns
4 : Cat | 4 | Empathy to humans | sharp claws
table initialize( animals1,
{ { Name, Surface, Leg count, Special ability },
{ Owl, Feathers, 2, Night vision },
{ Dog, Fur, 4, Sensitive nose },
{ Ape, Hair, 2 or 4, Relatively smart } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
[ animals2: Name, Gnu, .. ] +<<= [ animals1: Name, Dog, Special ability ]; // Dog: Nose without Dog
[ animals1: Name, Owl, ] +<<= [ animals2: Name, Bee, .. ]; // Bee without sting
table list( animals1 ); // Dog moved to table 2 (just the nose)
table list( animals2 ); // Bee moved to table 1
0 : Name | Surface | Leg count | Special ability | Weapon
1 : Bee | | 6 | Makes honey | sting
2 : Owl | Feathers | 2 | Night vision |
3 : Ape | Hair | 2 or 4 | Relatively smart |
0 : Name | Leg count | Special ability | Weapon
1 : | | Sensitive nose |
2 : Gnu | 4 | Knows UNIX | horns
3 : Cat | 4 | Empathy to humans | sharp claws
table initialize( animals1,
{ { Name, Leg count, Special ability, Strange habit },
{ Owl, 2, Night vision, night time noise in the forest },
{ Dog, 4, Sensitive nose, "Man's best friend" },
{ Ape, 2 or 4, Relatively smart, often funny } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
// The +<=> is very useful for mutual data replication in both tables.
[ animals2: Name, Cat, .. ] +<=> [ animals1: Name, Dog, ]; // Cats and dogs are on both tables
[ animals2: Name, Bee, Name..Special ability ] +<=> [ animals1: Name, Owl, ]; // Owl and be duplicated (names)
table list( animals1 );
table list( animals2 );
0 : Name | Leg count | Special ability | Strange habit | Weapon
1 : Bee | 6 | Makes honey | |
2 : Owl | 2 | Night vision | night time noise in the forest |
3 : Cat | 4 | Empathy to humans | | sharp claws
4 : Dog | 4 | Sensitive nose | Man's best friend |
5 : Ape | 2 or 4 | Relatively smart | often funny |
0 : Name | Leg count | Special ability | Weapon | Strange habit
1 : Owl | 2 | Night vision | |
2 : Bee | 6 | Makes honey | sting |
3 : Gnu | 4 | Knows UNIX | horns |
4 : Dog | 4 | Sensitive nose | | Man's best friend
5 : Cat | 4 | Empathy to humans | sharp claws |