This file contains hidden or 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
{- | |
Reverse Polish Notation | |
>example | |
rpn "10 4 3 + 2 * - " | |
-4.0 | |
rpn "30 4 +" | |
34.0 | |
rpn "4 3 + 10 *" |
This file contains hidden or 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 System.Environment | |
import System.Directory -- openTempFile , removeFile | |
import System.IO | |
import Control.Exception -- bracketOnError | |
import qualified Data.ByteString.Lazy as B | |
{- | |
This code is referenced from "Learn You a Haskell for Great Good!!" | |
-} | |
main = do |
This file contains hidden or 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 System.Environment | |
import Data.List | |
{- | |
>.\arg.exe abc xyz "123 456" | |
The arguments are: | |
abc | |
xyz | |
123 456 | |
The program name is: | |
arg.exe |
This file contains hidden or 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
New-Item -ItemType Directory -Name ディレクトリ名 |
This file contains hidden or 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 System.Random | |
-- getStdGen , newStdGen | |
-- If you use getStdGen 2 times , you can get the same result. | |
-- In this case , you can use newStdGen instead of getStdGen after the first time you use getStdGen. | |
main = do | |
gen <- getStdGen | |
putStrLn $ take 20 (randomRs ('a','z') gen ) | |
gen' <- newStdGen | |
putStrLn $ take 20 (randomRs ('a','z') gen' ) |
This file contains hidden or 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
ghc --make todo.hs |
NewerOlder