[Haskell-cafe] Re: Function to find a substring

2010-06-08 Thread Jon Fairbairn
R J writes: > What's an elegant definition of a Haskell function that takes > two strings and returns "Nothing" in case the first string > isn't a substring of the first, or "Just i", where i is the > index number of the position within the first string where the > second string begins? f n h =

[Haskell-cafe] Re: Function to find a substring

2010-06-08 Thread Paul R
>>> What's an elegant definition of a Haskell function that takes two strings >>> and returns "Nothing" in case the first string isn't a substring of the >>> first, or "Just i", where i is the index number of the position within the >>> first string where the second string begins? my quick take, w