2023-2: Put It In Reverse
The find function X⍷Y identifies the beginnings of occurrences of array X in array Y.
In this problem, you're asked to return a result that identifies the endings of occurrences of array X in array Y. To keep things simple, X and Y will be at most rank 1, meaning they'll either be vectors or scalars.
Write a function that:
- takes a scalar or vector left argument
- takes a scalar or vector right argument
- returns a Boolean result that is the same shape as the right argument where 1's mark the ends of occurrences of the left argument in the right argument
Hint: The find function ⍷ and reverse function ⌽ could be helpful in solving this problem.
Examples:
'abra' (your_function) 'abracadabra' 0 0 0 1 0 0 0 0 0 0 1 'issi' (your_function) 'Mississippi' 0 0 0 0 1 0 0 1 0 0 0 'bb' (your_function) 'bbb bbb' 0 1 1 0 0 1 1
(,42) (your_function) 42 0 42 (your_function) 42 1 (,42) (your_function) ,42 1
'are' 'aquatic' (your_function) 'ducks' 'are' 'aquatic' 'avians' 0 0 1 0
your_function ←
Solutions

