Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSecrets #268
Conversation
bvssvni
added some commits
Jun 5, 2016
This comment has been minimized.
This comment has been minimized.
|
Merging |
bvssvni
merged commit a0fb1d5
into
PistonDevelopers:master
Jun 5, 2016
bvssvni
deleted the
bvssvni:secrets
branch
Jun 5, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
bvssvni commentedJun 5, 2016
•
edited
See #266
This PR adds optional "secret" information in
boolandf64that is automatically derived from any composition of∀/alland∃/anywithmin/maxloops.What is a "secret"?
A secret is when a
boolorf64contains additional information that explains the reason why it has the current value. It allows you to write shorter algorithms with the same expressiveness as a longer algorithm.For example, this is normally how you would solve something:
When using a secret, you only need to look up the data and then unlock the secret with
why:How to use secrets
Dyon will not tell you a secret unless you ask. There are two questions you can ask:
why(bool)- why has this expression atruevalue?where(f64)- where does this number come from?The secret contains the answer to any meaningful question you can ask within the Dyon syntax. There are some questions that do not have meaning, but an error message will help you if it is wrong.
You can add information to a secret:
explain_why(bool, any)explain_where(f64, any)For example, we want to find "the top soccer player who scored most goals in a season where no player scored more than 50 goals":
For detail information on usage, see #266.
Performance
About the same performance as before.
Secrets use unused memory on the stack for
boolandf64, which just adds noise in the CPU in the old design. Now this memory is used for something useful instead.