05-30-2020, 07:23 AM
(This post was last modified: 06-01-2020, 02:44 PM by dale walton.)
I find it confusing that forEach is both an iterator function and a boolean.
So far in the documentation I only see iteration used for moves, but there may be other future uses needed.
Could "forEach" as a boolean be better renamed to "every"?
================
Edit: Its argument is a list is a series of boolean items, if "for" is understood as an iterator, the result depends on whether a list is naturally understood as separated by "or"s or by "and"s.
My understanding is lists are considered as "or" related. But the grammar for the boolean forEach for puzzle types and for use as a boolean is consistent with forEach treating it as "and" related, returning true if all items are true, rather than if any are true. While its use as a filter / iterator is consistent with an "or" related list returning any items that are true.
That is why I was confused and suggested to change "forEach" in the use case for puzzles and as a boolean value to "every" instead.
So far in the documentation I only see iteration used for moves, but there may be other future uses needed.
Could "forEach" as a boolean be better renamed to "every"?
================
Edit: Its argument is a list is a series of boolean items, if "for" is understood as an iterator, the result depends on whether a list is naturally understood as separated by "or"s or by "and"s.
My understanding is lists are considered as "or" related. But the grammar for the boolean forEach for puzzle types and for use as a boolean is consistent with forEach treating it as "and" related, returning true if all items are true, rather than if any are true. While its use as a filter / iterator is consistent with an "or" related list returning any items that are true.
That is why I was confused and suggested to change "forEach" in the use case for puzzles and as a boolean value to "every" instead.