Skip to content

2015-4: PDI - Progressive Dyadic Iota

The index-of function X⍳Y returns a simple integer vector that identifies where the major cells of Y are first found in X. If a major cell of Y cannot be found in X, then the corresponding item of the returned array will be 1+≢X.

Example of X⍳Y:

      'DYALOG APL' ⍳ 'AAALLLB' 
3 3 3 4 4 4 11

Progressive dyadic iota is similar to except that it returns the index of subsequent matches in the left argument until they are exhausted. Write a function that implements progressive dyadic iota.

Examples:

      'DYALOG APL' (your_function) 'AAALLLB' 
3 8 11 4 10 11 11
      '' (your_function) 'test'  ⍝ should work with empty left argument 
1 1 1 1 
      ⍬≡'test' (your_function) ''  ⍝ should work with empty right argument
1
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub