Murat Kasimov

More about me

Я language (β)

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

You can iterate over values of almost 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'hjd'eq` B = Break `har` B > [ A , B , C ] `yokl` Forth `ha` Check `ha` Stops `ha` not `ha'hjd'eq` D = Valid `har` [ A `hjd` D , B `hjd` D , C `hjd` D ]