Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/lib/indexExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,33 +321,3 @@ export const datalogExample = `def reachable(g: List[(String, Int32, String)], m
Path(x, z) :- Path(x, y), Road(y, maxSpeed, z), if maxSpeed >= minSpeed.
};
query facts, rules select (src, dst) from Path(src, dst) |> Foldable.toList`;

export const latticeExample = `let p = #{
/// Parts and the components they depend on.
PartDepends("Car", "Chassis").
PartDepends("Car", "Engine").
PartDepends("Engine", "Piston").
PartDepends("Engine", "Ignition").

/// Time required to assemble a part from its components.
AssemblyTime("Car", 7).
AssemblyTime("Engine", 2).

/// Expected delivery date for certain components.
DeliveryDate("Chassis"; 2).
DeliveryDate("Piston"; 1).
DeliveryDate("Ignition"; 7).

/// A part is ready when it is delivered.
ReadyDate(part; date) :-
DeliveryDate(part; date).

/// Or when it can be assembled from its components.
ReadyDate(part; assemblyTime + componentDate) :-
PartDepends(part, component),
AssemblyTime(part, assemblyTime),
ReadyDate(component; componentDate).
};

// Computes the delivery date for each component.
let r = query p select (c, d) from ReadyDate(c; d)`;