Toggle navigation
Egison
ドキュメント
デモ
オンライン・デモ
ポーカーの役判定
麻雀の上がり判定
双子素数の列挙
ツリー
グラフ
3-SATを解く乱択アルゴリズム
時系列データ解析
オンライン・ツール
オンライン Egison
オンライン・チュートリアル
数式処理
ブログ
コミュニティ
lib/core/base.egi
-- -- -- Base -- -- def eq := matcher | #$val as () with | $tgt -> if val = tgt then [()] else [] | $ as (something) with | $tgt -> [tgt] def bool := eq def char := eq def integer := eq def float := eq -- -- Utility -- def id := 1#%1 def fst (x, _) := x def snd (_, y) := y infixr expression 0 $ def ($) f x := f x def compose f g := \x -> g (f x) def flip fn := \$x $y -> fn y x def eqAs a x y := match x as a with | #y -> True | _ -> False def curry f x y := f (x, y) def uncurry f (x, y) := f x y -- -- Boolean -- infixr expression 3 && infixr expression 2 || def (&&) b1 b2 := if b1 then b2 else False def (||) b1 b2 := if b1 then True else b2 def not b := if b then False else True -- -- Unordered Pair -- def unorderedPair m := matcher | ($, $) as (m, m) with | ($x, $y) -> [(x, y), (y, x)] | $ as (eq) with | $tgt -> [tgt]