Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Haskell Introduction
Search
Seiya
July 14, 2018
Technology
0
98
Haskell Introduction
プログラミング言語のHaskellの紹介スライドです。
JOI2017夏季セミナーで作った資料な気がします。
Seiya
July 14, 2018
Tweet
Share
More Decks by Seiya
See All by Seiya
おうちGitLabのススメ
silmin_
3
1.2k
Git入門
silmin_
30
17k
暗号について
silmin_
0
140
LinuxCommand入門
silmin_
0
350
LinuxCommand入門2
silmin_
0
240
Webについて
silmin_
3
160
ネットワークとは
silmin_
0
210
コンピュータとは|初心者向け資料
silmin_
1
160
ビットについて|入門者向け資料
silmin_
0
190
Other Decks in Technology
See All in Technology
Retrospectiveを振り返ろう
nakasho
0
150
Okta Identity Governanceで実現する最小権限の原則
demaecan
0
230
CLIPでマルチモーダル画像検索 →とても良い
wm3
2
720
ゼロコード計装導入後のカスタム計装でさらに可観測性を高めよう
sansantech
PRO
1
610
知覚とデザイン
rinchoku
1
710
【SORACOM UG Explorer 2025】さらなる10年へ ~ SORACOM MVC 発表
soracom
PRO
0
200
datadog-incident-management-intro
tetsuya28
0
110
ソースを読む時の思考プロセスの例-MkDocs
sat
PRO
1
350
現場の壁を乗り越えて、 「計装注入」が拓く オブザーバビリティ / Beyond the Field Barriers: Instrumentation Injection and the Future of Observability
aoto
PRO
1
760
様々なファイルシステム
sat
PRO
0
280
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
2
210
進化する大規模言語モデル評価: Swallowプロジェクトにおける実践と知見
chokkan
PRO
3
410
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.2k
Facilitating Awesome Meetings
lara
57
6.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
116
20k
How GitHub (no longer) Works
holman
315
140k
[RailsConf 2023] Rails as a piece of cake
palkan
57
6k
How to Think Like a Performance Engineer
csswizardry
27
2.2k
It's Worth the Effort
3n
187
28k
Optimizing for Happiness
mojombo
379
70k
The Language of Interfaces
destraynor
162
25k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
2.9k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Embracing the Ebb and Flow
colly
88
4.9k
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 !!!