Skip to content

Instantly share code, notes, and snippets.

View taisyo7333's full-sized avatar

Daisuke Inoue taisyo7333

View GitHub Profile
@taisyo7333
taisyo7333 / rpn.hs
Last active August 29, 2015 14:25
Haskell : Reverse Polish Notation
{-
Reverse Polish Notation
>example
rpn "10 4 3 + 2 * - "
-4.0
rpn "30 4 +"
34.0
rpn "4 3 + 10 *"
@taisyo7333
taisyo7333 / copy.hs
Created July 17, 2015 13:50
Haskell ByteString Samle
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
@taisyo7333
taisyo7333 / arg.hs
Created July 15, 2015 15:03
Haskell : Arguments and program name are ... .
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
@taisyo7333
taisyo7333 / make_directory.ps1
Last active August 29, 2015 14:25
Powershell :カレントディレクトリをディレクトリ"ディレクトリ名"を作成する
New-Item -ItemType Directory -Name ディレクトリ名
@taisyo7333
taisyo7333 / Random2Times.hs
Last active August 29, 2015 14:24
Haskell : random
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' )
@taisyo7333
taisyo7333 / make.cmd
Last active August 29, 2015 14:24
Haskell : todo
ghc --make todo.hs