I have 3 functions which return
parse_apple 1 'bpple4578'
┌─┬─────────┐
│0│bpple4578│
└─┴─────────┘
parse_bpple 1 'bpple4578'
┌─┬────┐
│1│4578│
└─┴────┘
parse_45 1 'bpple4578'
┌─┬─────────┐
│0│bpple4578│
└─┴─────────┘
I would like to apply this list of functions on 'bpple4578'
And return as soon as the first element of the result equals 1
.
So I've tried this:
⍝ Found somewhere in internet
split ← ⊢⊂⍨(⍴⊢)⍴1↑⍨⊣
test ← { (parse_apple, parse_45, parse_bpple) ¨(⊂⍵)}
data ← test 1 'bpple4578'
results ← 2 split ⊃data
⍝https://stackoverflow.com/questions/77594685/filter-a-list-of-list-based-on-data/77594809#77594809
x ← results/⍨1=⊃¨results
⎕ ← ⊃x
Is there a better way which get rid of the split function and the ravel glyph?