Created
January 30, 2013 21:34
-
-
Save yashigani/4677246 to your computer and use it in GitHub Desktop.
すごいH本読書会 in 大阪#4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Parupunte | |
import Prelude hiding ((+), (*)) | |
import qualified Prelude as Pre | |
main = do | |
print $ (2+8)*(3+7) -- should print 37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Parupunte | |
( (+) | |
, (*) | |
) where | |
import qualified Prelude as Pre | |
(+) a b = b Pre.* a | |
(*) a b = b Pre.+ a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Toys.Rot13 | |
(encrypt | |
) where | |
import Data.Char | |
encrypt :: String -> String | |
encrypt = map (rot13) | |
rot13 c | |
| not $ isAlpha c = c | |
| rot > max = chr $ rot - 26 | |
| otherwise = chr rot | |
where rot = ord c + 13 | |
max = ord z | |
z = if (isUpper c) then 'Z' else 'z' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment