Murat Kasimov

More about me

Я language (β)

/Я language (β)/Snippets/Finding elements-within-data-structures/

You can iterate over values of all parametric primitives since they are functors (except Fixed).

Using Check behaviour we can short-circuiting iteration process once some condition is fulfilled:

> [ A , B , C ] `yokl` Forth `ha` Check `ha` Stops `ha` not `ha` ( `lu'q` B ) = Break `hv` B > [ A , B , C ] `yokl` Forth `ha` Check `ha` Stops `ha` not `ha` ( `lu'q` D ) = Valid `hv` [ A `lu` D , B `lu` D , C `lu` D ]