Ludii Forum
forEach and forEach - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: forEach and forEach (/showthread.php?tid=64)



forEach and forEach - dale walton - 05-30-2020

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.


RE: forEach and forEach - Eric Piette - 06-22-2020

In the next release, the ludeme "ForEach" as a boolean will be rename "ForAll".
That comes from the logic symbol "for All".

For example
(forAll
Cell
(is Count (hint))
ofSadid "Ball" P1)
)

Means, True if for all the cells the count of the ball owned by the player P1 is equal to the hint.

Note: That forAll ludeme is working for deduction puzzle as described in the language reference. That's why I make an example using the (hint) ludeme.