Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Haskell Introduction
mina
July 14, 2018
Technology
0
33
Haskell Introduction
プログラミング言語のHaskellの紹介スライドです。
JOI2017夏季セミナーで作った資料な気がします。
mina
July 14, 2018
Tweet
Share
More Decks by mina
See All by mina
おうちGitLabのススメ
silmin_
1
270
Git入門
silmin_
0
47
暗号について
silmin_
0
19
LinuxCommand入門
silmin_
0
69
LinuxCommand入門2
silmin_
0
36
Webについて
silmin_
3
18
ネットワークとは
silmin_
0
27
コンピュータとは|初心者向け資料
silmin_
0
20
ビットについて|入門者向け資料
silmin_
0
16
Other Decks in Technology
See All in Technology
Apa itu DevOps & Kenapa perlu belajar DevOps?
dicodingevent
0
120
俺の Laravel がこんなに速いわけがない! / My Laravel Too Fast
hanhan1978
0
120
機械学習システムのアーキテクチャとデザインパターン
washizaki
1
700
SlackBotで あらゆる業務を自動化。問い合わせ〜DevOpsまで #CODT2022
kogatakanori
0
1k
個人的に全然使わなかったUiPathのアクティビティ
saoritakita
0
100
Power Virtual Agentsのハジメ
miyakemito
1
160
データ分析で切り拓け! エンジニアとしてのデータ分析職キャリア戦略
ksnt
0
190
開発組織の生産性を可視化する State of DevOpsとFour Keysとは / deep dive into State of DevOps
yfcgpsebp
0
310
ZephyrRTOSのLongan Nanoへの移植
tokitahiroshi
0
110
PUTとPOSTどっち使う?
hankehly
0
280
Retca Cloud
bau
0
590
JAWS-UG re:Habilitaion 報告 / JAWS-UG OITA rehabilitation
hiranofumio
0
140
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_i
23
15k
Designing Experiences People Love
moore
130
22k
A Modern Web Designer's Workflow
chriscoyier
689
180k
10 Git Anti Patterns You Should be Aware of
lemiorhan
638
52k
Debugging Ruby Performance
tmm1
65
10k
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
What’s in a name? Adding method to the madness
productmarketing
11
1.6k
KATA
mclloyd
7
8.7k
Designing the Hi-DPI Web
ddemaree
272
32k
Git: the NoSQL Database
bkeepers
PRO
415
59k
Thoughts on Productivity
jonyablonski
43
2.3k
Learning to Love Humans: Emotional Interface Design
aarron
261
37k
Transcript
Haskell Introduction mina @silmin_
はじめに 「純粋関数型データ構造」という本で純粋関数型(ryを学んだ () これは ➢ 参照透過性 ➢ 永続性 ➢ 副作用のNASA
➢ なんでも関数 ➢ 簡潔かつ混沌() などが特徴(らしい) 今回はHaskellで実装した
Haskell とは 芸術
型宣言 Haskellは美しい data Color = Red | Blue | Yellow
toJpn :: Color -> String toJpn Red = “aka” toJpn Blue = “ao” toJpn Yellow = “ki” main = print $ toJpn Red パターンマッチ 関数実行 & 出力 enum Color { Red, Blue, Yellow };
関数のいろいろ 関数名 引数1 引数2.......で呼び出し temp a b -> a `temp` b とも書ける (
1 + ) , ( 5 * ) : 一引数関数 ( 1 + ) . ( 5 * ) : 関数合成 ( 5倍して1足す関数) f x y = print $ gcd x y f x = print . gcd x f = (print .) . gcd
実行してみる 関数合成
二分探索木(木の定義) data Tree a = Leaf | Node (Tree a)
a (Tree a) Leaf - 末端ノードの先にいる 実質虚無 末 Node - ただのノード 子を持ってる a ... ... 葉 葉
二分探索木(search関数) search::Ord a => Tree a -> a -> Bool
search Leaf b = False search (Node tl a tr) b = if b < a then search tl b else if b > a then search tr b else True 型宣言 パターンマッチ
最後に 興味を持った方は「Haskell Platform」で検索 ※UNIX / Mac の方はパッケージがあるのでinstallしましょう Haskellには光と闇が存在します
Haskell とは 芸術
Thank you for listening !!!