Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Haskell Introduction
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Seiya
July 14, 2018
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Haskell Introduction
プログラミング言語のHaskellの紹介スライドです。
JOI2017夏季セミナーで作った資料な気がします。
Seiya
July 14, 2018
Transcript
11 slides
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 !!!
More Decks by Seiya
See All by Seiya
Re:ゼロから始めるシェアハウスのペットな鯖
silmin_
0
270
ATProtocol ざっくり概要把握してみた @ DWeb Tokyo Meetup #2
silmin_
0
110
おうちGitLabのススメ
silmin_
5
2.1k
Git入門
silmin_
40
30k
暗号について
silmin_
0
240
LinuxCommand入門
silmin_
0
470
LinuxCommand入門2
silmin_
0
320
Webについて
silmin_
3
240
ネットワークとは
silmin_
0
310
Other Decks in Technology
See All in Technology
メール到達性を支える、リンク先URLのドメイン評価の扱い方
wind111
0
200
AI-Ready なデータ基盤ってなに? & 新卒未経験が、いま考えていること
imuta
0
1.1k
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
4
2.2k
AIフレンドリーなGenerative UIをJSXで
uhyo
2
180
gradle-best-practices 使ってみた
mikanichinose
0
230
実測データからサービスの成長余力を測る。負荷シナリオ・テストデータ・限界値の設計
kazatohiei
1
180
Webメール開発を大幅に変えたJMAPというゲームチェンジャー
tascript
5
3.1k
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
280
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
210
メディアアートを〈拡張〉する——器官学と個体化論を手がかりに
_kotobuki_
0
280
Welcome JXL!
dynamis
0
160
正しくWeb サイトを守るためのコンテンツセキュリティーポリシー
hinalin
0
130
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
How to make the Groovebox
asonas
2
2.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Done Done
chrislema
187
17k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Six Lessons from altMBA
skipperchong
29
4.6k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500
Building the Perfect Custom Keyboard
takai
2
970
Producing Creativity
orderedlist
PRO
348
41k