praxis

Various programming exercises.
Log | Files | Refs

commit f18cf769d0c8696cae95075231e75747428203e7
parent 421a84350238990006031c627652518ea71f137d
Author: Jared Tobin <jared@jtobin.ca>
Date:   Thu, 12 Mar 2015 22:51:51 +1300

Matches.

Diffstat:
A20150310_matches/Matches.hs | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/20150310_matches/Matches.hs b/20150310_matches/Matches.hs @@ -0,0 +1,11 @@ + +module Matches where + +appears :: Eq a => [a] -> [a] -> Int +appears = go where + go [] _ = 1 + go _ [] = 0 + go ab@(b:bs) (c:cs) + | b == c = appears bs cs + appears ab cs + | otherwise = appears ab cs +