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 Data.Char | |
-- main = putStrLn "Hello, World" | |
-- main = do | |
-- putStrLn "Hello, what's your name?" | |
-- name <- getLine | |
-- putStrLn ("Hey " ++ name ++ ", you rock!") | |
main = do | |
putStrLn "What's your first name?" |
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
{ | |
"description": "vi mode (opt + hjkl)", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "h", | |
"modifiers": { | |
"mandatory": [ | |
"left_option" | |
], |
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
data Vector a = Vector a a a deriving (Show) | |
vplus :: (Num a) => Vector a -> Vector a -> Vector a | |
(Vector i j k) `vplus` (Vector l m n) = Vector (i+l) (j+m) (k+n) | |
dotProd :: (Num a) => Vector a -> Vector a -> a | |
(Vector i j k) `dotProd` (Vector l m n) = i*l + j*m + k*n | |
vmult :: (Num a) => Vector a -> a -> Vector a | |
(Vector i j k) `vmult` m = Vector (i*m) (j*m) (j*m) |
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 Shapes (Point, Shape, area, nudge, baseCircle, baseRect) where | |
-- data Shape = Circle Float Float Float | | |
-- Rectangle Float Float Float Float | |
-- data Shape = Circle Float Float Float | | |
-- Rectangle Float Float Float Float | |
-- deriving (Show) | |
data Point = Point Float Float deriving (Show) | |
data Shape = Circle Point Float | Rectangle Point Point deriving (Show) | |
-- area :: Shape -> Float |
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
-- data Person = Person String String Int Float String String deriving (Show) | |
-- レコード構文 | |
-- ex.) | |
-- *Main> let guy = Person "Buddy" "Finklestein" 43 184.2 "526-2928" "Chocolate" | |
-- *Main> flavor guy | |
-- "Chocolate" | |
-- *Main> :t flavor | |
-- flavor :: Person -> String | |
data Person = Person { | |
firstName :: String, |
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
-- 引数の数字が 100 よりも大きいか返す関数 | |
-- -> 数字の比較 | |
-- -> 100よりも大きいか | |
gt100 :: Int -> Ordering | |
-- compare 1 2 | |
-- compare 100 x | |
gt100 = compare 100 |
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
fib :: Int -> Int | |
-- Pattern match | |
-- fib 0 = 0 | |
-- fib 1 = 1 | |
-- | |
-- fib n = fib (n-1) + fib (n-2) | |
-- Guard | |
fib n |
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
### Keybase proof | |
I hereby claim: | |
* I am mizukmb on github. | |
* I am mizukmb (https://keybase.io/mizukmb) on keybase. | |
* I have a public key ASDIJCpIGZGau3t-dTFB0lNkkojZRJDQPogWkwlShZ39uQo | |
To claim this, I am signing this object: |
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
fizzBuzz :: Integer -> String | |
fizzBuzz 0 = "0" | |
fizzBuzz fz | |
| fz `mod` 15 == 0 = "FizzBuzz" | |
| fz `mod` 3 == 0 = "Fizz" | |
| fz `mod` 5 == 0 = "Buzz" | |
| otherwise = show fz |
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 MS | |
def print(token) | |
case token | |
when MAtom | |
token.token | |
when Array | |
"( #{token.map{ |t| print(t) }.join(' ')} )" | |
else | |
raise 'Syntax Error!!' | |
end |