Task[edit]
Find the index of a string (needle) in an indexable, ordered collection of strings (haystack).

Raise an exception if the needle is missing.

If there is more than one occurrence then return the smallest index to the needle.

Extra credit
Return the largest index to a needle that has multiple occurrences in the haystack.

See also
 Search a list of records

(     return the largest index to a needle that has multiple
      occurrences in the haystack and print the needle
  : ?list
& (   !list:? haystack [?index ?
    & out$("The word 'haystack' occurs at 1-based index" !index)
  | out$"The word 'haystack' does not occur"
  )
& (   !list
    : ? %@?needle ? !needle ?
    : ( ? !needle [?index (?&~)
      |   ?
        &   out
          $ ( str
            $ ( "The word '"
                !needle
                "' occurs more than once. The last 1-based index is "
                !index
              )
            )
      )
  | out$"No word occurs more than once."
  )
);