-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The goal here is to allow, in addition to "Adding" inputs dynamically, "Removing" inputs dynamically from MapN nodes. The key implications of removing nodes: We need to make sure that we remove the input as a parent, and the map node as a child, from the removed node We need to make sure the map node is marked as stale and is recomputed We need to make sure that the removed node is detected as "unnecessary" and removed from the graph if the map node was its only child Things we don't need to do in practice: Because inputs are "parents", we don't need to invalidate or propagate invalidity for the node; this extends from the fact that if a map node is "observed" it will continue to be observed regardless of what its children are. We do not need to update the map node's height, even if logically it would have changed, because it will never get lower in practice (and staying the same, even if strictly higher than it should be, is ok)
- Loading branch information
Showing
5 changed files
with
113 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package incr | ||
|
||
func remove[A INode](nodes []A, id Identifier) []A { | ||
output := make([]A, 0, len(nodes)) | ||
func remove[A INode](nodes []A, id Identifier) (output []A, removed A) { | ||
output = make([]A, 0, len(nodes)) | ||
for _, n := range nodes { | ||
if n.Node().id != id { | ||
output = append(output, n) | ||
} else { | ||
removed = n | ||
} | ||
} | ||
return output | ||
return | ||
} |
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