El dom, 06-06-2010 a las 15:51 +, R J escribió:
> 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
Hi,
R J wrote:
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?
The naive alg
R J wrote:
>> 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?
Thomas Ha
If you want to use libs to make your life easier, maybe something
along these lines?
Prelude Data.List.Split Safe> fmap length . headMay . split (onSublist
"asdf") $ "blee blah asdf bloo"
Just 10
If they are big strings, it's probably faster to use bytestrings, or
arrays of some kinds, rather tha
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?