- 2014/10/25 函数型なんたらの集い 2014 in Tokyo
- @gakuzzzz
- 中村 学
- 株式会社Tech to Value
- Scalaから来ました
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
--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 ) |
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
module EightPuzzle where | |
import Data.List (permutations) | |
-- 参考記事:https://mathtrain.jp/8puzzle | |
{-- | |
8 puzzle | |
1 2 3 |
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
# 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 |
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
; -*- 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? |
% egison -T -e '(maclaurin-expansion (cos x) x)'
1
0
(/ (* -1 x^2) 2)
0
(/ x^4 24)
0
(/ (* -1 x^6) 720)
0
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
// 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; |
NewerOlder