# APL (13)

    ∇R←F X
    R←*/ιX
    ∇

May need a `⎕IO←1` line to be sure ι starts at 1 - it's been awhile since I last used APL.