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
Theorem syllogism : forall (A B C : Prop), (B -> C) -> (A -> B) -> A -> C. | |
Proof. | |
intros A B C H H0 H1. | |
apply H. | |
apply H0. | |
apply H1. | |
Qed. |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Data.ByteString | |
default (ByteString) | |
s = "hello world" | |
-- :: ByteString | |
-- デフォルトが ByteSTring になる |
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
#include <string> | |
#include <vector> | |
#include <list> | |
#include <iostream> | |
template<class Iterator> | |
void print_all(Iterator first, Iterator last) | |
{ | |
while (first != last) | |
{ |
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
#include <iostream> | |
typedef void (*f_t)(); | |
class Base { | |
public: | |
virtual void f(); | |
}; | |
struct Derivied : public Base { |
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.IORef | |
doWhile :: Monad m => m Bool -> m a -> m a | |
doWhile test body = do | |
x <- body | |
testResult <- test | |
if testResult | |
then doWhile test body | |
else return x |
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
Theorem Modus_ponens: forall (P Q: Prop), (P -> Q) -> P -> Q. | |
Proof. | |
intro P. | |
intro Q. | |
intro H. | |
apply H. | |
Qed. |
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 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'), |
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
# -*- coding: utf-8 -*- | |
s = gets.chomp | |
if s == "true" || s == "真" then | |
puts "OK" | |
else | |
puts "NG" | |
end |
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
def random | |
[true, false].sample | |
end | |
if random then | |
puts "OK" | |
else | |
puts "NG" | |
end |
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 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 |