姫路 IT 系勉強会 Vol. 11 L1 グランプリ Haskell

Kazkuki Oakamoto
Kazkuki OakamotoStudent at University
姫路 IT 系勉強会 Vol.11
           L1 グランプリ
               Haskell

                               @kakkun61


姫路 IT 系勉強会 Vol. 11 @kakkun61               1/27
自己紹介
 ●   岡本和樹
 ●   @kakkun61
 ●   23 歳
 ●   大阪府立大学 4 回生
 ●   Haskell 歴 本格的には半年ぐらい



姫路 IT 系勉強会 Vol. 11 @kakkun61   2/27
Haskell




姫路 IT 系勉強会 Vol. 11 @kakkun61   3/27
Haskell




姫路 IT 系勉強会 Vol. 11 @kakkun61   4/27
Haskell
 ●   純粋関数型
 ●   遅延評価
 ●   参照透明
 ●   代数的データ型
 ●   モナド



姫路 IT 系勉強会 Vol. 11 @kakkun61   5/27
Haskell
 ●   純粋関数型
 ●   遅延評価
 ●   参照透明
 ●   代数的データ型
 ●   モナド
                      こわくないよ !
姫路 IT 系勉強会 Vol. 11 @kakkun61     6/27
Haskell
 ●   とりあえず『すごい Haskell たのしく学
     ぼう!』読む
 ●   読んだら気付いたら分かってる




姫路 IT 系勉強会 Vol. 11 @kakkun61   7/27
Haskell




姫路 IT 系勉強会 Vol. 11 @kakkun61   8/27
Haskell
 ●   会議で委員会が発足しそこで作られた珍
     しい言語
 ●   学術的な方面からの要請
 ●   1990 年に最初のバージョン




姫路 IT 系勉強会 Vol. 11 @kakkun61   9/27
Haskell
 ●   デファクトスタンダード
 ●   The Glorious Glasgow Haskell
     Compilation System
 ●   GHC
 ●   Simon Peyton Jones と Simon Marlow




姫路 IT 系勉強会 Vol. 11 @kakkun61             10/27
Haskell
 ●   Simon Peyton Jones
 ●   Microsoft Research in Cambridge
 ●   C-- の作者でもある




姫路 IT 系勉強会 Vol. 11 @kakkun61           11/27
問題 1 Fizz Buzz
 ●   1-100 の Fizz Buzz




姫路 IT 系勉強会 Vol. 11 @kakkun61   12/27
問題 1 Fizz Buzz




姫路 IT 系勉強会 Vol. 11 @kakkun61   13/27
問題 1 Fizz Buzz
 ●   fizzbuzz
 ●   数値を取って文字列を返す関数
 ●   1→"1"
 ●   3→"fizz"
 ●   5→"buzz"
 ●   ……


姫路 IT 系勉強会 Vol. 11 @kakkun61   14/27
問題 1 Fizz Buzz
 ●   map fizzbuzz [1..100]
 ●   [1, 2, 3, 4, 5, …… 100]
 ●                ↓
 ●   ["1", "2", "fizz", 4, "buzz", ……
     "buzz"]




姫路 IT 系勉強会 Vol. 11 @kakkun61            15/27
問題 1 Fizz Buzz
 ●   mapM_ putStrLn ["1", "2", "fizz", 4,
     "buzz", …… "buzz"]
 ●   それぞれの要素を 1 行に表示する




姫路 IT 系勉強会 Vol. 11 @kakkun61                16/27
問題 2 GPA 計算
 ●   A-D, F→4-1, 0 に変換し平均
 ●   出典
 ●   AtCoder Regular Contest #3 A 問題




姫路 IT 系勉強会 Vol. 11 @kakkun61           17/27
問題 2 GPA 計算




姫路 IT 系勉強会 Vol. 11 @kakkun61   18/27
姫路 IT 系勉強会 Vol. 11 @kakkun61   19/27
問題 2 GPA 計算




姫路 IT 系勉強会 Vol. 11 @kakkun61   20/27
問題 2 GPA 計算




姫路 IT 系勉強会 Vol. 11 @kakkun61   21/27
問題 3 tail -n 5
 ●   tail -n 5




姫路 IT 系勉強会 Vol. 11 @kakkun61   22/27
問題 3 tail -n 5




姫路 IT 系勉強会 Vol. 11 @kakkun61   23/27
問題 3 tail -n 5
 ●   args -> getArgs
 ●   引数に束縛




姫路 IT 系勉強会 Vol. 11 @kakkun61   24/27
問題 3 tail -n 5
 ●   contents ->
 ●          if null args
 ●                  then getContents
 ●                  else readFile $ head args
 ●   args が null なら標準入力を
 ●   じゃなかったら args の 1 つめのファイル
     名のファイルを読んで contents を束縛
姫路 IT 系勉強会 Vol. 11 @kakkun61                    25/27
問題 3 tail -n 5
 ●   putStr . unlines . reverse . take 5 .
     reverse . lines $ contents
 ●   contents (文字列)を lines で行のリス
     トに変換
 ●   reverse で反転
 ●   take 5 で頭から 5 つだけにする
 ●   reverse で反転

姫路 IT 系勉強会 Vol. 11 @kakkun61                 26/27
問題 3 tail -n 5
 ●   putStr . unlines . reverse . take 5 .
     reverse . lines $ contents
 ●   unlines で行のリストを改行区切りの 1
     つの文字列に
 ●   putStr で出力




姫路 IT 系勉強会 Vol. 11 @kakkun61                 27/27
1 of 27

Recommended

OSC Kansai @Kyoto 2012 LT 競技プログラミングからひとつまみ by
OSC Kansai @Kyoto 2012 LT 競技プログラミングからひとつまみOSC Kansai @Kyoto 2012 LT 競技プログラミングからひとつまみ
OSC Kansai @Kyoto 2012 LT 競技プログラミングからひとつまみKazkuki Oakamoto
2.1K views22 slides
姫路 IT 系勉強会 Vol.6 プログラミングコンテストという名のオンラインゲームがあるらしい by
姫路 IT 系勉強会 Vol.6 プログラミングコンテストという名のオンラインゲームがあるらしい姫路 IT 系勉強会 Vol.6 プログラミングコンテストという名のオンラインゲームがあるらしい
姫路 IT 系勉強会 Vol.6 プログラミングコンテストという名のオンラインゲームがあるらしいKazkuki Oakamoto
1.6K views82 slides
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク by
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトークオープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトークKazkuki Oakamoto
552 views23 slides
すごい Haskell 読書会 in 大阪 #5 by
すごい Haskell 読書会 in 大阪 #5すごい Haskell 読書会 in 大阪 #5
すごい Haskell 読書会 in 大阪 #5Kazkuki Oakamoto
934 views20 slides
姫路 IT 系勉強会 Vol.4 SKK by
姫路 IT 系勉強会 Vol.4 SKK姫路 IT 系勉強会 Vol.4 SKK
姫路 IT 系勉強会 Vol.4 SKKKazkuki Oakamoto
562 views21 slides
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク (まじめ版) by
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク (まじめ版)オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク (まじめ版)
オープンースカンファレンス 2011 関西 @神戸 学生ライトニングトーク (まじめ版)Kazkuki Oakamoto
487 views19 slides

More Related Content

Recently uploaded

Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向 by
Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向
Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向Hitachi, Ltd. OSS Solution Center.
110 views26 slides
光コラボは契約してはいけない by
光コラボは契約してはいけない光コラボは契約してはいけない
光コラボは契約してはいけないTakuya Matsunaga
30 views17 slides
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」 by
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」PC Cluster Consortium
29 views36 slides
パスキーでリードする: NGINXとKeycloakによる効率的な認証・認可 by
パスキーでリードする: NGINXとKeycloakによる効率的な認証・認可パスキーでリードする: NGINXとKeycloakによる効率的な認証・認可
パスキーでリードする: NGINXとKeycloakによる効率的な認証・認可Hitachi, Ltd. OSS Solution Center.
13 views22 slides
定例会スライド_キャチs 公開用.pdf by
定例会スライド_キャチs 公開用.pdf定例会スライド_キャチs 公開用.pdf
定例会スライド_キャチs 公開用.pdfKeio Robotics Association
154 views64 slides

Recently uploaded(7)

光コラボは契約してはいけない by Takuya Matsunaga
光コラボは契約してはいけない光コラボは契約してはいけない
光コラボは契約してはいけない
Takuya Matsunaga30 views
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」 by PC Cluster Consortium
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」
PCCC23:東京大学情報基盤センター 「Society5.0の実現を目指す『計算・データ・学習』の融合による革新的スーパーコンピューティング」
PCCC23:富士通株式会社 テーマ1「次世代高性能・省電力プロセッサ『FUJITSU-MONAKA』」 by PC Cluster Consortium
PCCC23:富士通株式会社 テーマ1「次世代高性能・省電力プロセッサ『FUJITSU-MONAKA』」PCCC23:富士通株式会社 テーマ1「次世代高性能・省電力プロセッサ『FUJITSU-MONAKA』」
PCCC23:富士通株式会社 テーマ1「次世代高性能・省電力プロセッサ『FUJITSU-MONAKA』」

Featured

ChatGPT and the Future of Work - Clark Boyd by
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
28.7K views69 slides
Getting into the tech field. what next by
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
6.7K views22 slides
Google's Just Not That Into You: Understanding Core Updates & Search Intent by
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
7K views99 slides
How to have difficult conversations by
How to have difficult conversations How to have difficult conversations
How to have difficult conversations Rajiv Jayarajah, MAppComm, ACC
5.7K views19 slides
Introduction to Data Science by
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
82.6K views51 slides
Time Management & Productivity - Best Practices by
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
169.8K views42 slides

Featured(20)

ChatGPT and the Future of Work - Clark Boyd by Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd28.7K views
Getting into the tech field. what next by Tessa Mero
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero6.7K views
Google's Just Not That Into You: Understanding Core Updates & Search Intent by Lily Ray
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray7K views
Time Management & Productivity - Best Practices by Vit Horky
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky169.8K views
The six step guide to practical project management by MindGenius
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius36.7K views
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright... by RachelPearson36
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson3612.8K views
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present... by Applitools
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools55.5K views
12 Ways to Increase Your Influence at Work by GetSmarter
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter401.7K views
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G... by DevGAMM Conference
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference3.6K views
Barbie - Brand Strategy Presentation by Erica Santiago
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago25.1K views
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well by Saba Software
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software25.3K views
Introduction to C Programming Language by Simplilearn
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn8.5K views
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr... by Palo Alto Software
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
Palo Alto Software88.4K views
9 Tips for a Work-free Vacation by Weekdone.com
9 Tips for a Work-free Vacation9 Tips for a Work-free Vacation
9 Tips for a Work-free Vacation
Weekdone.com7.2K views
How to Map Your Future by SlideShop.com
How to Map Your FutureHow to Map Your Future
How to Map Your Future
SlideShop.com275.1K views

姫路 IT 系勉強会 Vol. 11 L1 グランプリ Haskell

  • 1. 姫路 IT 系勉強会 Vol.11 L1 グランプリ Haskell @kakkun61 姫路 IT 系勉強会 Vol. 11 @kakkun61 1/27
  • 2. 自己紹介 ● 岡本和樹 ● @kakkun61 ● 23 歳 ● 大阪府立大学 4 回生 ● Haskell 歴 本格的には半年ぐらい 姫路 IT 系勉強会 Vol. 11 @kakkun61 2/27
  • 3. Haskell 姫路 IT 系勉強会 Vol. 11 @kakkun61 3/27
  • 4. Haskell 姫路 IT 系勉強会 Vol. 11 @kakkun61 4/27
  • 5. Haskell ● 純粋関数型 ● 遅延評価 ● 参照透明 ● 代数的データ型 ● モナド 姫路 IT 系勉強会 Vol. 11 @kakkun61 5/27
  • 6. Haskell ● 純粋関数型 ● 遅延評価 ● 参照透明 ● 代数的データ型 ● モナド こわくないよ ! 姫路 IT 系勉強会 Vol. 11 @kakkun61 6/27
  • 7. Haskell ● とりあえず『すごい Haskell たのしく学 ぼう!』読む ● 読んだら気付いたら分かってる 姫路 IT 系勉強会 Vol. 11 @kakkun61 7/27
  • 8. Haskell 姫路 IT 系勉強会 Vol. 11 @kakkun61 8/27
  • 9. Haskell ● 会議で委員会が発足しそこで作られた珍 しい言語 ● 学術的な方面からの要請 ● 1990 年に最初のバージョン 姫路 IT 系勉強会 Vol. 11 @kakkun61 9/27
  • 10. Haskell ● デファクトスタンダード ● The Glorious Glasgow Haskell Compilation System ● GHC ● Simon Peyton Jones と Simon Marlow 姫路 IT 系勉強会 Vol. 11 @kakkun61 10/27
  • 11. Haskell ● Simon Peyton Jones ● Microsoft Research in Cambridge ● C-- の作者でもある 姫路 IT 系勉強会 Vol. 11 @kakkun61 11/27
  • 12. 問題 1 Fizz Buzz ● 1-100 の Fizz Buzz 姫路 IT 系勉強会 Vol. 11 @kakkun61 12/27
  • 13. 問題 1 Fizz Buzz 姫路 IT 系勉強会 Vol. 11 @kakkun61 13/27
  • 14. 問題 1 Fizz Buzz ● fizzbuzz ● 数値を取って文字列を返す関数 ● 1→"1" ● 3→"fizz" ● 5→"buzz" ● …… 姫路 IT 系勉強会 Vol. 11 @kakkun61 14/27
  • 15. 問題 1 Fizz Buzz ● map fizzbuzz [1..100] ● [1, 2, 3, 4, 5, …… 100] ● ↓ ● ["1", "2", "fizz", 4, "buzz", …… "buzz"] 姫路 IT 系勉強会 Vol. 11 @kakkun61 15/27
  • 16. 問題 1 Fizz Buzz ● mapM_ putStrLn ["1", "2", "fizz", 4, "buzz", …… "buzz"] ● それぞれの要素を 1 行に表示する 姫路 IT 系勉強会 Vol. 11 @kakkun61 16/27
  • 17. 問題 2 GPA 計算 ● A-D, F→4-1, 0 に変換し平均 ● 出典 ● AtCoder Regular Contest #3 A 問題 姫路 IT 系勉強会 Vol. 11 @kakkun61 17/27
  • 18. 問題 2 GPA 計算 姫路 IT 系勉強会 Vol. 11 @kakkun61 18/27
  • 19. 姫路 IT 系勉強会 Vol. 11 @kakkun61 19/27
  • 20. 問題 2 GPA 計算 姫路 IT 系勉強会 Vol. 11 @kakkun61 20/27
  • 21. 問題 2 GPA 計算 姫路 IT 系勉強会 Vol. 11 @kakkun61 21/27
  • 22. 問題 3 tail -n 5 ● tail -n 5 姫路 IT 系勉強会 Vol. 11 @kakkun61 22/27
  • 23. 問題 3 tail -n 5 姫路 IT 系勉強会 Vol. 11 @kakkun61 23/27
  • 24. 問題 3 tail -n 5 ● args -> getArgs ● 引数に束縛 姫路 IT 系勉強会 Vol. 11 @kakkun61 24/27
  • 25. 問題 3 tail -n 5 ● contents -> ● if null args ● then getContents ● else readFile $ head args ● args が null なら標準入力を ● じゃなかったら args の 1 つめのファイル 名のファイルを読んで contents を束縛 姫路 IT 系勉強会 Vol. 11 @kakkun61 25/27
  • 26. 問題 3 tail -n 5 ● putStr . unlines . reverse . take 5 . reverse . lines $ contents ● contents (文字列)を lines で行のリス トに変換 ● reverse で反転 ● take 5 で頭から 5 つだけにする ● reverse で反転 姫路 IT 系勉強会 Vol. 11 @kakkun61 26/27
  • 27. 問題 3 tail -n 5 ● putStr . unlines . reverse . take 5 . reverse . lines $ contents ● unlines で行のリストを改行区切りの 1 つの文字列に ● putStr で出力 姫路 IT 系勉強会 Vol. 11 @kakkun61 27/27