adds ++find/++fand (tape/list search)

This commit is contained in:
Joseph Bryan 2016-06-28 13:36:13 -04:00
parent 40365667c7
commit 057227eca1

View File

@ -670,6 +670,37 @@
?~ a b
$(a t.a, b +(b))
::
++ find :: first index
~/ %find
|= {nedl/(list) hstk/(list)}
=| i/@ud
|- ^- (unit @ud)
=+ [n=nedl h=hstk]
|-
?: |(?=($~ n) ?=($~ h))
~
?: =(i.n i.h)
?~ t.n
`i
$(n t.n, h t.h)
^$(i +(i), hstk +.hstk)
::
++ fand :: all indices
~/ %fand
|= {nedl/(list) hstk/(list)}
=| i/@ud
=| fnd/(list @ud)
|- ^+ fnd
=+ [n=nedl h=hstk]
|-
?: |(?=($~ n) ?=($~ h))
(flop fnd)
?: =(i.n i.h)
?~ t.n
^$(i +(i), hstk +.hstk, fnd [i fnd])
$(n t.n, h t.h)
^$(i +(i), hstk +.hstk)
::
++ levy
~/ %levy :: all of
|* {a/(list) b/$-(* ?)}