Skip to content

Instantly share code, notes, and snippets.

y x = x (y x)の型推論

  1. y :: bとおく。
  2. x :: cとおく。
  3. y x :: dとおく。
  4. (1.)(2.)(3.)よりbc -> dは等しい。
  5. (4.)よりy :: c -> dである。
  6. x (y x) :: aとおく。
  7. (2.)(3.)(6.)よりcd -> aは等しい。
  8. (2.)(7.)よりx :: d -> aである。
import System.Random (RandomGen, getStdGen, randoms)
import Control.Concurrent (threadDelay)
import System.Process (callCommand)
import Data.List.Split (chunksOf)
import Data.Maybe (fromMaybe)
type Cell = Bool
type CellTable = [[Cell]]
type Score = Int
type Pos = (Int, Int)
@AyaMorisawa
AyaMorisawa / hage.hs
Last active December 23, 2015 14:11
import System.Random
main = do
gen <- getStdGen
let xs = ["hage", "はげ", "ハゲ", "ハゲ" ,"禿" ,"彡⌒ミ"]
mapM_ putStr [xs !! i | i <- randomRs (0, length xs - 1) gen]
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Web.Scotty
import Data.Aeson.TH
data Person = Person { name :: String, country :: String }
$(deriveJSON defaultOptions ''Person)
const valueSource = 'hage';
const keysSource = 'a/b/c';
const keys = keysSource.split('/');
const result = keys.reduceRight((value, key) => {
return { [key]: value };
}, valueSource);
console.log(result);
((x,w,d,i,g,b,p)=>{i=d.createElement('iframe');i.onload=()=>{g=Object.keys(i.contentWindow);for(b in window){p=w[b];if(w.hasOwnProperty(b)&&p&&!g.includes(b)){x[b]=p}}console.log(x)};i.src='about:blank';d.body.appendChild(i)})({},window,document);
Require Import Arith.Mult.
Definition is_even (n : nat) : Prop :=
exists (k : nat), n = 2 * k.
Theorem even_plus_even_is_even :
forall (n m : nat), is_even n /\ is_even m -> is_even (n + m).
Proof.
intro n.
intro m.
import { OAuth1Session } from 'requests_oauthlib';
import json from 'json';
let savedSession = json.load(open('./twitter.json', 'r'));
let sess = OAuth1Session(
savedSession.ck
savedSession.cs
savedSession.at
savedSession.cs
);
class Human {
private age: number = 42;
getAge() {
return this.age;
}
}
let f = new Human().getAge
console.log(f());
class TailRec<T> {
private next: () => TailRec<T>;
private done: boolean;
private result: T;
constructor(next: () => TailRec<T>, done: boolean, result: T) {
this.next = next;
this.done = done;
this.result = result;
}