Skip to content

Instantly share code, notes, and snippets.

View egisatoshi's full-sized avatar

Satoshi Egi egisatoshi

View GitHub Profile
--Roughly based on https://github.com/Gabriel439/Haskell-Morte-Library/blob/master/src/Morte/Core.hs by Gabriel Gonzalez et al.
data Expr = Star | Box | Var Int | Lam Int Expr Expr | Pi Int Expr Expr | App Expr Expr deriving (Show, Eq)
subst v e (Var v') | v == v' = e
subst v e (Lam v' ta b ) | v == v' = Lam v' (subst v e ta) b
subst v e (Lam v' ta b ) = Lam v' (subst v e ta) (subst v e b )
subst v e (Pi v' ta tb) | v == v' = Pi v' (subst v e ta) tb
subst v e (Pi v' ta tb) = Pi v' (subst v e ta) (subst v e tb)
subst v e (App f a ) = App (subst v e f ) (subst v e a )
@righ1113
righ1113 / EightPuzzle.hs
Last active July 5, 2023 19:58
8パズルは181440通り in Egison, Haskell
module EightPuzzle where
import Data.List (permutations)
-- 参考記事:https://mathtrain.jp/8puzzle
{--
8 puzzle
1 2 3
@necrobious
necrobious / gist:14d78ee9b4caff766152
Created July 12, 2014 18:56
Ubuntu 14.04 + GHC 7.8.3 + cabal-install 1.20.0.3
# build with
# docker build -t 'necrobious/haskell-ghc-7.8-64' .
FROM ubuntu:14.04
MAINTAINER necrobious@gmail.com
ENV DEBIAN_FRONTEND noninteractive
####### Install Dependencies ###################################################
RUN apt-get -y update
@gakuzzzz
gakuzzzz / slide.md
Last active June 11, 2019 01:59
パターンマッチいろいろ (函数型なんたらの集い 2014 in Tokyo)

パターンマッチいろいろ

  • 2014/10/25 函数型なんたらの集い 2014 in Tokyo
  • @gakuzzzz
  • 中村 学
  • 株式会社Tech to Value
  • Scalaから来ました

参加の経緯

; -*- mode: scheme;-*-
; Implementation of resolution principle for first-order logic in Egison
(define $unordered-pair
(lambda [$m]
(matcher
{[<pair $ $> [m m] {[[$x $y] {[x y] [y x]}]}]
[$ [something] {[$tgt {tgt}]}]})))
(define $positive?
@wkentaro
wkentaro / how-to-install-omake-on-osx.rst
Last active February 20, 2018 15:14
How to install omake on OS X

How to install omake on OS X

brew update && brew upgrade
brew install opam
@greymd
greymd / 2016-04-30_lt.md
Last active May 2, 2016 00:36
2016-04-30 シェル芸勉強会 LT
@egisatoshi
egisatoshi / maclaurin-expansion.md
Last active April 14, 2016 06:23
MacLaurin expansion on shell
% egison -T -e '(maclaurin-expansion (cos x) x)'                                        
1
0
(/ (* -1 x^2) 2)
0
(/ x^4 24)
0
(/ (* -1 x^6) 720)
0
@egisatoshi
egisatoshi / Egison_command_tutorial_ja.md
Last active January 1, 2016 07:24
Egisonコマンドラインチュートリアル

Egisonコマンドラインチュートリアル

式を評価

--evalまたは-eオプションで引数の式を評価できます。 式はシングルクォート(`)で囲みます。

$ egison -e '(take 10 primes)'
{2 3 5 7 11 13 17 19 23 29}
@foota
foota / count_lattice_path_dfs.cpp
Created September 14, 2012 11:25
Count paths from (0, 0) to (N, N) in the NxN lattice graph using DFS.
// Count paths from (0, 0) to (N, N) in the NxN lattice graph using DFS.
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
static unsigned long long cnt = 0;