* "traveral" here is from Lazy Depth First Traversal
* "lazily take each" here is from Iterators
To lazily group the connected components given a collection of nodes:
First, mark all nodes unseen.
Then, with a traversal that can stop early when unmarkable
lazily take each node from unseen,
grouping the traversal of that node into a component
and yielding that component
mark is a concept used in grouping connected components.
to mark a collection as unseen means to copy it into unseen.
to mark as seen successfully given a value, remove the value from unseen.
to mark as seen will fail if the node is not in unseen
unmarkable means a given node cannot be marked as seen
marked means mark
"collect into" means to append to the list of connected components
"all nodes" means the collection of nodes
###
Lazy Depth First Traversal is a concept.
To do lazy depth first traversal given a node:
yield this node,
then, yield the results from traversal for each of this node's bonds
If depth first traversal can stop early:
when it should stop early given the node, there is no result
otherwise the result is traversing the node
traversal means depth first traversal
traversing means traversal
###
Iterators is a concept
To lazily take each from a collection:
while the collection is not empty,
remove an item from the collection,
and yield that item
Last active
October 15, 2020 00:25
-
-
Save micimize/f996d34e16f517ce27cdeee8b5036a52 to your computer and use it in GitHub Desktop.
idea for how programming could be written in almost english
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this has been done: https://osmosianplainenglishprogramming.blog/
but why isn't it done more? To do it really well you'd want:
So instead of creating a custom language, you piggyback on another. The obvious gain is accessibility.
could be something like: