Skip to content

Instantly share code, notes, and snippets.

View egisatoshi's full-sized avatar

Satoshi Egi egisatoshi

View GitHub Profile
@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;
@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
;; map function
(define $map : [$A $B] ([(A -> B) {A}] -> {B})
(lambda [$fn $xs]
(match xs (list something)
{[<nil> {}]
[<cons $x $rs> {(fn x) @(map fn rs)}]})))
;; Ord type class
(type $Ordering {<Less> <Equal> <Greater>})
@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から来ました

参加の経緯

@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}
@greymd
greymd / gist:26892f933d21dd84c2ac
Last active August 29, 2015 14:13
ジャンケンの結果が「グー パー グー パー」のように4話のうち2回ずつ同じパターンがでたサザエさんの話数
w3m -dump http://www.asahi-net.or.jp/~tk7m-ari/sazae_ichiran.html | \
sed 's/(.*//g' | awk NF | awk '$0=$1" "$3' | sed -n '4,$p' | tr ' ' '\t' | \
egison -T -F1s -s '(match-all-lambda
(list [string string])[
<join _ <cons [$a $te1]
<cons [$b $te2]
<cons [$c ,te1]
<cons [$d ,te2]>>>> _>
[a b c d "=>" te1 te2 te1 te2]
])' | column -t
@greymd
greymd / gist:352f9a6ec70d2a5f607f
Created January 20, 2015 14:30
「メロスは激怒した」と同じような語感を持つ文を「走れメロス」から抜き出す
# 形態素解析器を使うのでmecabを事前にインストールされたし
# % brew install mecab
# 青空文庫から「走れメロス」を取得
$ w3m -dump http://www.aozora.gr.jp/cards/000035/files/1567_14913.html | \
mecab | awk -F',' '$0=$1' | awk 'NF==2' | \
egison -F1s -s '(match-all-lambda (list [string string])[<join _ <cons [$a ,"名詞"] <cons [$b ,"助詞"] <cons [$c ,"名詞"] <cons [$d ,"動詞"] <cons [$e ,"助動詞"]>>>>>> [a b c d e]])'
# Result
# ["メロス" "は" "激怒" "し" "た"]
@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
@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
@greymd
greymd / 2016-04-30_lt.md
Last active May 2, 2016 00:36
2016-04-30 シェル芸勉強会 LT