Commit d6ce036a authored by Laszlo Domoszlai's avatar Laszlo Domoszlai

avoid array creation in matchAt

parent d95d5e65
......@@ -58,7 +58,10 @@ matchAt :: !String !String !Int -> Bool
matchAt s1 s2 p
| ((size s1) + p) > (size s2)
= False
= and [s1.[i] == s2.[p + i] \\ i <- [0..((size s1) - 1)]]
= eqS ((size s1) - 1)
where
eqS 0 = s1.[0] == s2.[p + 0]
eqS i = s1.[i] == s2.[p + i] && eqS (i - 1)
countCharBackwards :: !Char !String -> Int
countCharBackwards chr str
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment