progress with versioning
This commit is contained in:
parent
618cdf7314
commit
e106ced1ec
8 changed files with 151 additions and 238 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import { newDynamic } from "../lib/primitives/dynamic.js";
|
||||
import { Int } from "../lib/primitives/primitive_types.js";
|
||||
import { Char, Int } from "../lib/primitives/primitive_types.js";
|
||||
import { fnType } from "../lib/structures/type_constructors.types.js";
|
||||
import { pretty } from "../lib/util/pretty.js";
|
||||
import { merge, newLiteral, newSlot, read, transform, write } from "../lib/versioning/types.js";
|
||||
import { newLiteral, newSlot, read, transform, write } from "../lib/versioning/value_slot.js";
|
||||
import { merge, mergeN } from "../lib/versioning/merge.js";
|
||||
import { union } from "../lib/structures/set.js";
|
||||
|
||||
const inc = x => x + 1n;
|
||||
const incLiteral = newLiteral(newDynamic(inc)(fnType(_=>Int)(_=>Int)));
|
||||
|
|
@ -64,20 +66,23 @@ console.log("###############");
|
|||
console.log("## Branching ##");
|
||||
console.log("###############");
|
||||
|
||||
const fiveSlot = write
|
||||
(newSlot("Counter__4a029b3d758bcd1fffbf495531c95537"))
|
||||
(newLiteral(newDynamic(5n)(Int)));
|
||||
const sixSlot = write(fiveSlot)(newLiteral(newDynamic(6n)(Int)));
|
||||
const sevenSlot = write(fiveSlot)(newLiteral(newDynamic(7n)(Int)));
|
||||
const eightSlot = write(fiveSlot)(newLiteral(newDynamic(8n)(Int)));
|
||||
const initialSlot = newSlot("Slot__4a029b3d758bcd1fffbf495531c95537");
|
||||
|
||||
const sixSevenSlot = merge(sixSlot)(sevenSlot);
|
||||
const slotA = write(initialSlot)(newLiteral(newDynamic("a")(Char)));
|
||||
const slotB = write(slotA )(newLiteral(newDynamic("b")(Char)));
|
||||
const slotC = write(initialSlot)(newLiteral(newDynamic("c")(Char)));
|
||||
|
||||
console.log(pretty(sixSevenSlot));
|
||||
const slotAB = merge(slotA)(slotB);
|
||||
const slotAC = merge(slotA)(slotC);
|
||||
const slotBC = merge(slotB)(slotC);
|
||||
|
||||
// const sevenEightSlot = merge(sevenSlot)(eightSlot);
|
||||
console.log({slotAB, slotAC, slotBC});
|
||||
|
||||
// const sixSevenEightSlot = merge(sixSevenSlot)(sevenEightSlot);
|
||||
const un = union(slotAC)(slotBC);
|
||||
|
||||
const merged = mergeN(un);
|
||||
|
||||
console.log("merged:", merged);
|
||||
|
||||
// // console.log(compareSlots(intCompare)(fiveSlot)(fiveSlot));
|
||||
// // console.log(compareSlots(intCompare)(sixSlot)(sixSlot));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue