Skip to content

Instantly share code, notes, and snippets.

// each state element is of the form [value, bitmask, expression]
// - `expression` is a string representing an arithmetic expressoin
// - `value` is the arithmetic value of `expression`
// - `bitmask` is a bitmask recording which of the 4 numbers (6,6,5,2) we've
// used
const state = [[6,1,"6"],[6,2,"6"],[5,4,"5"],[2,8,"2"]];
// combines compatible states using arithmetic operations to produce new states.
//
// x and y are states (see above)
@rntz
rntz / gist:9fcab35ba7baa428c5f1
Last active October 27, 2015 14:56 — forked from jamii/gist:4107eb8dce3b90f55fff
expression-oriented syntax for imp/datalog
?an:id can fly
= ?an is a bird
- ?an is a penguin
+ ?an is Harry the Rocket Penguin
// nb. left-associative; a - b + c = (a - b) + c.
safe path from ?a to ?c
= edge from ?a to ?c
+ (edge from ?a to ?b
- ?b is dangerous