- 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
// 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; |
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 [email protected] | |
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
;; 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>}) |
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
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 |
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
# 形態素解析器を使うので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 | |
# ["メロス" "は" "激怒" "し" "た"] |
% egison -T -e '(maclaurin-expansion (cos x) x)'
1
0
(/ (* -1 x^2) 2)
0
(/ x^4 24)
0
(/ (* -1 x^6) 720)
0
OlderNewer