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 始めました
Search
Yutaka Kinjo
March 02, 2014
Technology
1
430
Haskell 始めました
株式会社OCC 金城裕
社内勉強会用
Yutaka Kinjo
March 02, 2014
Tweet
Share
More Decks by Yutaka Kinjo
See All by Yutaka Kinjo
エンディングまで連れて行くプレイ体験 - unity 1 week 共有会 #7
yutakakinjyo
0
190
調査対象■■■山脈 - unity1week online 共有会 #2 -
yutakakinjyo
0
1k
無限跳躍 - unity1week online 共有会 -
yutakakinjyo
2
900
Structure of English
yutakakinjyo
1
130
才能がなくても確実に学習するためのオレオレ学習法
yutakakinjyo
2
2.1k
自動化勉強会 vol.1
yutakakinjyo
1
87
github導入した話.pdf
yutakakinjyo
1
240
Other Decks in Technology
See All in Technology
Introduction to Bill One Development Engineer
sansan33
PRO
0
300
衛星画像超解像化によって実現する2D, 3D空間情報の即時生成と“AI as a Service”/ Real-time generation spatial data enabled_by satellite image super-resolution
lehupa
0
190
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
12
81k
[Codex Meetup Japan #1] Codex-Powered Mobile Apps Development
korodroid
2
990
事業開発におけるDify活用事例
kentarofujii
2
310
Findy Team+ QAチーム これからのチャレンジ!
findy_eventslides
0
450
それでも私が品質保証プロセスを作り続ける理由 #テストラジオ / Why I still continue to create QA process
pineapplecandy
0
130
新規事業におけるGORM+SQLx併用アーキテクチャ
hacomono
PRO
0
380
能登半島地震で見えた災害対応の課題と組織変革の重要性
ditccsugii
0
1k
なぜAWSを活かしきれないのか?技術と組織への処方箋
nrinetcom
PRO
5
980
WEBサービスを成り立たせるAWSサービス
takano0131
1
180
OAuthからOIDCへ ― 認可の仕組みが認証に拡張されるまで
yamatai1212
0
140
Featured
See All Featured
Facilitating Awesome Meetings
lara
56
6.6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Embracing the Ebb and Flow
colly
88
4.9k
Typedesign – Prime Four
hannesfritz
42
2.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
620
Designing Experiences People Love
moore
142
24k
What's in a price? How to price your products and services
michaelherold
246
12k
Building Applications with DynamoDB
mza
96
6.7k
Docker and Python
trallard
46
3.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
369
20k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Transcript
HASKELL࢝Ί·ͨ͠ גࣜձࣾ OCC Yutaka Kinjo
֓ཁ abstract
•Haskell ͱ •७ਮؔܕݴޠ •cɺjavaɺrubyͳͲͱ͍ͩͿҧ͏ •(ͳʹ͔ɺՄೳੑΛײ͡Δ!!)
•ͨͿΜɺࣾͰৄ͍͠ਓ͍ͳ͍ •Haskell ͷϓϩάϥϛϯάύϥμΠϜڵຯਂ ͍ •ৄ͘͠ͳ͓ͬͯ͘ͱཱͯΔ͔ •ͪΐͬͱͬͯΈͯɺ໘ന͔ͬͨ
͜ΕͰษڧͪ͏
֊ͷܭࢉ factorial
fac 0 = 1 fac n = n * fac(n-1)
main = print (fac 42) 1405006117752879898543142606244511569936384000000000 $ ghc fac.hs $ ./fac
fac 0 = 1 fac n = n * fac(n-1)
main = print (fac 42) 引数のパターン を記述できる fac n = if n == 0 then 1 else n * fac(n-1) if文かかなくてもいい
FizzBuzz
None
ແݶϦετ Infinite list
list = [1,2,3,4] inf_list = [1..]
ԆධՁ lazy evaluation
inf_list = [1..] take 3 inf_list [1,2,3]
inf_list = [1..] take 52 inf_list [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21, 22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,3 9,40,41,42,43,44,45,46,47,48,49,50,51,52]
ΧϦʔԽ currying
•Haskell ͷ࣮ؔ 1 ͭͷҾ͔͠औΒͳ͍ • ෳͷҾΛͱΔ࣮ؔΧϦʔԽ͞Ε͍ͯΔ
max 1 2 > 2 ෳͷҾΛͱΔؔΧϦʔԽ͞Ε͍ͯΔ
(max 1) 2 > 2 ͜͏͡Ό!!
1と引数を比べる関数になる (max 1) 2
これは関数 (max 1)
部分適応された関数 (max 1) デフォルトですでに 1が設定された max
関数名をつけれる let maxOne = (max 1) maxOne 2 > 2
ちょっといじる let maxOne = (max 1.0) maxOne 0.5 > 1.0
࣮༻ྫ application
•৽మॅۚιϦϡʔγϣϯζ • ࣌ՁձܭύοέʔδʮBancMeasureʯ •GREE • ͷKVSσʔλϕʔεͷཧ • ը૾αʔόͷϑϩϯτΤϯυ
·ͱΊ summary
• ؒҧͬͯͨΒ͝ΊΜͳ͍͞ • for จ ࠶ؼͰফ͑ͨ • if จ ύλʔϯϚονͰফ͑ͨ
• ͳΜ͔ɺΧϦʔԽมଶ • ࣮༻ྫ࣮͋Δ • ূ໌ͱ͔Ͱ͖ͦ͏ • (ͳʹ͔ɺՄೳੑΛײ͡Δ!!)
ࢀߟ reference
• http://maoe.hatenadiary.jp/entry/2013/12/12/195322 • http://itpro.nikkeibp.co.jp/article/COLUMN/20130112/449224/ • ॻ੶ : ͍͢͝Haskell ͨͷֶ͘͠΅͏