Skip to content

Instantly share code, notes, and snippets.

View pasberth's full-sized avatar

pasberth pasberth

View GitHub Profile
@pasberth
pasberth / mp.v
Created December 31, 2013 05:27
Modus ponens
Theorem Modus_ponens: forall (P Q: Prop), (P -> Q) -> P -> Q.
Proof.
intro P.
intro Q.
intro H.
apply H.
Qed.
import qualified System.Environment as E
import qualified Data.HashMap.Strict as M
mathematicalScriptMap :: M.HashMap Char Char
mathematicalScriptMap = M.fromList [
('A', '\x1D49C'),
('B', '\x0212C'),
('C', '\x1D49E'),
('D', '\x1D49F'),
('E', '\x02130'),
@pasberth
pasberth / a.rb
Created December 23, 2013 15:43
# ユーザに文字列を入力させ、それが"true"か"真"なら"OK"それ以外なら"NG"と表示させなさい
# -*- coding: utf-8 -*-
s = gets.chomp
if s == "true" || s == "真" then
puts "OK"
else
puts "NG"
end
@pasberth
pasberth / a.rb
Created December 23, 2013 14:42
# メソッド random はtrueかfalseを返す # trueならば"OK"falseならば"NG"と表示させなさい
def random
[true, false].sample
end
if random then
puts "OK"
else
puts "NG"
end
--ちんちんっぽいことするやつ
import System.Random
chimpo :: String -> IO String
randomString :: String -> IO String
chimpo c = do s <- randomString c
if take 4 c == "ABCDE"
then return $ c ++ ("なんか終わりました" ++ (show (length c )))
else chimpo s
@pasberth
pasberth / lazyk.coffee
Last active December 28, 2015 04:49
Lazy K in CoffeeScript
lazy = (x) -> () -> x
thaw = (x) -> x()
app = () -> [].slice.call(arguments, 0).reduce (x, y) -> () -> thaw(x)(y)
S = (x) -> (y) -> (z) -> thaw app(x, z, app(y, z))
K = (x) -> (y) -> thaw x
I = (x) -> thaw x
parseLazyK = (source) ->
stack = [[]]
@pasberth
pasberth / README.md
Created October 25, 2013 03:19
TypedCoffeeScript
$ ./bin/coffee --js < a.coffee

Cannot read property 'args' of undefined

USE_OCAMLFIND = true
OCAMLPACKS[] =
llvm
FILES[] =
types
lambda
parser
lexer
@pasberth
pasberth / a.bash
Last active December 26, 2015 10:39
#! bin/bash
MANSECT="1 2 3 4 5 n"
for i in $MANSECT
do
echo 'aaa'
done
# aaa
# aaa
# aaa
@pasberth
pasberth / a.hs
Created October 22, 2013 13:18
型レベルで計算するやつ
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where