Mercurial > hg > Members > atton > delta_monad
changeset 138:1f218e2d9de0
Rename function in example
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Feb 2015 11:31:47 +0900 |
parents | 2bf1fa6d2006 |
children | 957496efbe5d |
files | haskell/Example/DeltaM.hs |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/haskell/Example/DeltaM.hs Sun Feb 15 11:08:33 2015 +0900 +++ b/haskell/Example/DeltaM.hs Sun Feb 15 11:31:47 2015 +0900 @@ -25,22 +25,22 @@ -- example : prime filter --- usage : runWriter $ checkOut 0 $ primeCountM 30 -- run specific version --- : dmap runWriter $ primeCountM 30 -- run all version +-- usage : runWriter $ checkOut 0 $ numberCountM 30 -- run specific version +-- : dmap runWriter $ numberCountM 30 -- run all version generatorM :: Int -> DeltaWithLog [Int] generatorM x = let intList = [1..x] in DeltaM $ deltaFromList $ fmap returnW $ replicate 2 intList -primeFilterM :: [Int] -> DeltaWithLog [Int] -primeFilterM xs = let primeList = filter isPrime xs - refactorList = filter even xs in - DeltaM $ deltaFromList $ fmap returnW [primeList, refactorList] +numberFilterM :: [Int] -> DeltaWithLog [Int] +numberFilterM xs = let primeList = filter isPrime xs + evenList = filter even xs in + DeltaM $ deltaFromList $ fmap returnW [primeList, evenList] countM :: [Int] -> DeltaWithLog Int -countM xs = let primeCount = length xs in - DeltaM $ deltaFromList $ fmap returnW $ replicate 2 primeCount +countM xs = let numberCount = length xs in + DeltaM $ deltaFromList $ fmap returnW $ replicate 2 numberCount -primeCountM :: Int -> DeltaWithLog Int -primeCountM x = generatorM x >>= primeFilterM >>= countM +numberCountM :: Int -> DeltaWithLog Int +numberCountM x = generatorM x >>= numberFilterM >>= countM