Skip to content

Instantly share code, notes, and snippets.

@rntz
Forked from jamii/gist:4107eb8dce3b90f55fff
Last active October 27, 2015 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rntz/9fcab35ba7baa428c5f1 to your computer and use it in GitHub Desktop.
Save rntz/9fcab35ba7baa428c5f1 to your computer and use it in GitHub Desktop.
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
& safe path from ?b to ?c)
?p:text works at alice corp but not evil eve studios
= ?p works at "alice corp" for _ USD
- ?p works at "evil eve studios" for _ USD
?p:text only works at alice corp
= ?p works at "alice corp" for _ USD
- (?p works at ?c for _ USD
& ?c != "alice corp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment