Skip to content

Instantly share code, notes, and snippets.

View pasberth's full-sized avatar

pasberth pasberth

View GitHub Profile
(* Monad with Coercion *)
Definition relation (A: Type) := A -> A -> Prop.
Hint Unfold relation.
Reserved Notation "x == y" (at level 85, no associativity).
Class Equivalence (A: Type) :=
{
equiv_eq: relation A where "x == y" := (equiv_eq x y);
equiv_refl:
@pasberth
pasberth / Elsie.md
Last active December 19, 2015 06:28
エルシーの物語
  • Underfly series

    • Undersky (2400年頃)
    • Underspace (2600年頃)
  • Interspace series

    • Interspace (2400年〜2600年頃。人類の第2の惑星 Cold Earth への到達へ大きな役割を果たした)
    • Intersperse
    • Interspecies (4000年頃)
  • Transray series

@mathink
mathink / gist:5893703
Created June 30, 2013 03:24
型クラスの引数に型クラス内部で別名を与えることで,異なる実体に共通の記法を提供するというやり方. 既にやっているライブラリとかもあると思いますが,メモ的な意味で投下.
Definition relation (A: Type) := A -> A -> Prop.
(* Definition: Equivalence relation *)
Reserved Notation "x == y" (at level 80, no associativity).
Class Equivalence {A: Type}(eq: relation A) :=
{
equiv_eq := eq
where "x == y" := (equiv_eq x y);
Require Import ssreflect ssrbool eqtype ssrnat seq ssrfun fintype.
Ltac 破 := case.
Ltac 解 := elim.
Ltac 動 := move.
Ltac 割 := split.
Ltac 矣 := done.
Ltac 用 := apply.
Ltac 在 := exists.
class T t where
  t :: t a

instance T X where
  t = tx

instance T Y where
 t = ty

すぐれた PHP ライブラリとリソース

Awesome PHP の記事をフォークして翻訳したものです (2013年4月25日)。おどろくほどすごい PHP ライブラリ、リソースやちょっとした情報のリストです。

【訳者コメント】 PHP 入門者のかたにはクィックリファレンスとして PHP: The Right Way 、セキュリティに関しては2011年3月に出版された 体系的に学ぶ 安全なWebアプリケーションの作り方 をおすすめします。

Composer

@ympbyc
ympbyc / example.factor
Last active December 16, 2015 09:09
Deadly simple concatenative language.
[ :map ([a] (a -- b) -- [b])
[ over
[ [] ]
[ swap dup car rot tuck call swap rot cdr swap map swap drop swap drop swap cons ]
rot
empty? ] define,
[ 1 2 3 4 5 ] [ 2 * ] map . ]
@fumieval
fumieval / chomado.hs
Last active December 16, 2015 05:38
ぶるぶるちょまど(https://twitter.com/chomado/status/323644612357001217 )をコンビネータとして解釈する純粋関数型言語。 oは3-タプル(K, S, K)をチャーチエンコードしたものにあたる。(* ~ *)はコメント。入出力はチャーチエンコードされた自然数のリスト。
import Control.Applicative
import Data.Word
import System.Environment
import Text.Trifecta
import Control.Monad
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import qualified Codec.Binary.UTF8.String as UTF8
infixl 9 :$

Syntax

Receiver message arg1 arg2 arg3 ==  self message receiver aeg1 arg2 arg3

self message returns a function whose type is receiver -> arg1 -> arg2 -> arg3 .

self message is undefined, but the message will be hooked by core function like AUTOLOAD,

(ns macro-combinator
(:refer-clojure :exclude [=]))
(defn prim [x] (fn [a] `(fn [~x] ~a)))
(defn in [v a] (v a))
(defn where [a v] (v a))
(defn = [v b] (fn [a] `(~(v a) ~b)))
(defn <- [v b] (fn [a] `(>>= ~b ~(v a))))
(println (in (= (prim 'x) 42) 'x))
; ((clojure.core/fn [x] x) 42)