sourcelibs/Datapath/demos/threshold.xtl
1⍝!/usr/bin/env xetal
2⍝ A select by mask: x where x > t, 0 elsewhere, a comparator and a mux
3⍝ per element. Run with "just demo-lib Datapath threshold".
4ᵈᵖ⁼u̲se< "Datapath"
5x ← 5 -3 12 0 7 -8 20 1
6x > 4 ⍝ the mask: the mux's select lines
74 ᵈᵖt̲hreshold x
8(x > 4) ᵈᵖk̲eep x ⍝ the same, the mask given
9ᵈᵖr̲elu x ⍝ threshold at 0