-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Rules store a second function for updating
Now `Rule`s store two things: one callable thing, which is used for evaluating the rule, and one other thing, which can be `nothing` or a function with the signature `u(value, args...)` that evaluates the rule for the given arguments and adds the result to `value`, doing so in place when possible. The advantage of this is that we can more easily define custom ways of accumulating the results of rules, and we can even share intermediate steps between the regular rule evaluation and custom updating. As a test/proof of concept, the `rrule` for `svd` now also has an updating function that handles `NamedTuple`s appropriately.
- Loading branch information
Showing
4 changed files
with
82 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters