# HG changeset patch # User Yasutaka Higa # Date 1412053826 -32400 # Node ID b4d3960af9015703d3c2498425a8f5ad629ff466 # Parent f0400c4c953fd8cfc7e80a904e4cb4fa8ae339c3 Define similar constructor for different element diff -r f0400c4c953f -r b4d3960af901 similar.hs --- a/similar.hs Fri Sep 26 15:02:23 2014 +0900 +++ b/similar.hs Tue Sep 30 14:10:26 2014 +0900 @@ -30,6 +30,9 @@ returnS :: (Show s) => s -> Similar s returnS x = Similar [(show x)] x [(show x)] x +returnSS :: (Show s) => s -> s -> Similar s +returnSS x y = Similar [(show x)] x [(show y)] y + -- samples generator :: Int -> Similar [Int] @@ -38,8 +41,8 @@ primeFilter :: [Int] -> Similar [Int] primeFilter xs = let primeList = filter isPrime xs - refactorList = filter even xs in - Similar [(show primeList)] primeList [(show refactorList)] refactorList + refactorList = filter even xs in + returnSS primeList refactorList count :: [Int] -> Similar Int count xs = let primeCount = length xs in