| Did you know ... | Search Documentation: |
| Counting |
Counting long strings in a chain
The following example assumes a chain of string objects. It will count all strings that are longer than 80 characters.
number_of_long_strings(Chain, N) :-
new(Number, number(0)),
send(Chain, for_all,
if(@arg1?size > 80,
message(Number, plus, 1))),
get(Number, value, N),
send(Number, done).
->for_all