Skip to content

Instantly share code, notes, and snippets.

@smwhr
Created November 15, 2022 15:34
Show Gist options
  • Save smwhr/8fe3ef7db707eb6f8068a1b3c7222689 to your computer and use it in GitHub Desktop.
Save smwhr/8fe3ef7db707eb6f8068a1b3c7222689 to your computer and use it in GitHub Desktop.
// KNOWLEDGE FUNCTIONS
VAR knowledgeState = ()
=== function learn(x) ===
// learn this fact
~ knowledgeState += x
=== function learnt(x) ===
// have you learnt this fact, or indeed a stronger one
~ return highest_state_for_set_of_state(x) >= x
=== function between(x, y) ===
// are you between two ideas? Not necessarily in the same knowledge tree.
~ return learnt(x) && not learnt(y)
=== function think(x) ===
// is this your current "strongest" idea in this knowledge set?
~ return highest_state_for_set_of_state(x) == x
=== function highest_state_for_set_of_state(x) ===
~ return LIST_MAX(knowledgeState ^ LIST_ALL(x))
=== function did_learn(x) ===
// did you learn this particular fact?
~ return knowledgeState ? x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment