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
NDS_36_RubyCurry
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kasacchiful
PRO
March 15, 2014
Programming
1.5k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NDS_36_RubyCurry
NDS#36 の言語セッションでしゃべった内容です。
kasacchiful
PRO
March 15, 2014
More Decks by kasacchiful
See All by kasacchiful
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
480
Step Functions Express ワークフローの使い所 / 20260725jawsug-niigata-sado
kasacchiful
PRO
1
96
Step FunctionsでAIエージェント × 人の承認を試す / 20260705jawsug-hokurikushinkansen-agentcore-hitl-workflow
kasacchiful
PRO
0
120
上越のサメ食文化を訪ねて - 新潟市民の初体験レポ / ssmjp-shark
kasacchiful
PRO
1
89
Rust on AWS でデータ分析 / 20260523iotlt-niigata-rust-on-aws
kasacchiful
PRO
0
67
Step Functionsで始めるサーバーレス入門 〜 つないで動かすAWSサーバーレス
kasacchiful
PRO
0
79
Amazon Q Developer CLI (現Kiro CLI) で作った 新潟ランチマップWebアプリのこれまでとこれから / 20260207jawsug-tochigi
kasacchiful
PRO
0
140
Amazon SageMaker Catalogの、AIエージェントによる自動データ分類機能を試してみようとしたが、できなかったので、代わりに最近構築したデータ連携基盤を紹介します / 20260117jawsug-fukui
kasacchiful
PRO
0
180
データファイルをAWSのDWHサービスに格納する / 20251115jawsug-tochigi
kasacchiful
PRO
2
300
Other Decks in Programming
See All in Programming
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
490
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
320
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.7k
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.1k
新卒PdEのリアル
ryu1013
1
500
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
190
AIエージェント時代のコードレビューを設計する
nogu66
6
2.7k
速習iPhone Duo対応
yuukiw00w
1
550
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
210
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
700
iOSDC2026登壇資料.pdf
riofujimon
0
170
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
410
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
The SEO Collaboration Effect
kristinabergwall1
1
570
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Ethics towards AI in product and experience design
skipperchong
2
380
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1k
Deep Space Network (abreviated)
tonyrice
0
310
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Transcript
RubyͷCurryΛ গ͠৯ͯΈͨ ּݪɹʢ@kasacchifulʣ
ࣗݾհ • ּݪɹʢ@kasacchifulʣ • ৽ׁࢢࡏॅ • SIerۈʢΠϯϑϥඋ͕ଟΊʣ • Ruby͕͓ؾʹೖΓ •
VB.NET, Javascript, SQL, PHP, PowerShell
એ
JaSST’14 Niigata • ࣌ɿ20144݄11ʢۚʣ10:00 ʙ 16:50 • ձɿगϝοηɹதձٞࣨ302B • جௐߨԋɿদඌ୩
ప ࢯʮςετͷલʹνʔϜͷݱྗΛσόοά!!ɹɹ ʙݱྗΛܭଌ͠ɼ߹ཧతͳຏ͖ํΛֶͿʙʯ • ϫʔΫγϣοϓɿ૿ా ྱࢠ ࢯʮݱྗͱνʔϜϏϧσΟϯάɹɹɹɹ ʙνʔϜΛ࡞ͬͯɼຏ͍͍ͯͨ͘Ίʹʙʯ • ਃࠐకɿ20144݄4ʢۚʣ • Webɿhttp://jasst.jp/symposium/jasst14niigata.html
Ruby • 19932݄24ੜ·Εɺ1995ެ։ • ΦϒδΣΫτࢦʢ͕ͯ͢ΦϒδΣΫτʣ • ڧ͍ಈతܕ͚ • ެࣜϖʔδɿhttps://www.ruby-lang.org/ja/
Ruby ͷ Curry ͬͯԿʁ
Ruby ͷ Curry hoge = -> (x,y,z) { x +
y * z } ## hoge = lambda {|x,y,z| x + y * z} ͱಉ͡ curry_hoge = hoge.curry ! hoge.call(1,2,3) #=> 7 hoge[2,3,4] #=> 14 ! curry_hoge.call(1).call(2).call(3) #=> 7 curry_hoge[2][3][4] #=> 14
ͦͦ Curry ͬͯԿʁ
Curry ʮΧϦʔԽʯͷ͜ͱ ΧϦʔԽ (currying) ͱɺܭࢉػՊֶͷٕ๏ͷҰͭɻ ෳͷҾΛͱΔؔΛɺҾ͕ʮͱͷؔͷ࠷ॳͷ ҾʯͰΓ͕ʮͱͷؔͷΓͷҾΛऔΓ݁Ռ Λฦؔ͢ʯͰ͋ΔΑ͏ͳؔʹ͢Δ͜ͱɻ ʢग़యɿʮΧϦʔԽ -
Wikipediaʯʣ http://ja.wikipedia.org/wiki/%E3%82%AB%E3%83%AA%E3%83%BC%E5%8C%96
Ruby ͷ Curry hoge = ->(x,y,z) { x + y
* z } curry_hoge = hoge.curry ## curry_hoge = ->(x) { ->(y) { ->(z) { x + y * z }}} ͱಉ͡ ! ɾProc#curry Ruby 1.9 ͔Β͑Δ
Curry ͓͍͍ͬͯ͠ͷʁ
͓͍͍͖ͨͩ͘͠·͠ΐ͏ ΧϦʔԽ͢Δ͜ͱͰɺطଘͷؔʹҾͷΛ෦ద༻͠ ͯɺผͷؔΛ࡞Δ͜ͱ͕ग़དྷ·͢ɻ ! طଘͷؔͷ࠶ར༻ɹɹɹɹɹʮDRYʯɹ ! ͏·͑͘ɺ͓͍͘͠ͳΓ·͢ɻ
Wikipedia ͷྫΛ Ruby Ͱ div = ->(x,y) { x /
y } ## currying cdiv = div.curry #=> ->(x) {->(y) { x/ y }} ## partial application inv = cdiv[1.0] #=> ->(y) { 1.0 / y } inv[3] #=> 0.3333333333333333 inv[10] #=> 0.1
ҙ ʮΧϦʔԽʯͱʮ෦ద༻ʯΛؒҧ͑ͳ͍Α͏ʹ ! ΧϦʔԽɿ->(x,y){x/y} Λ ->(x){->(y){x/y}} ʹม͢Δ͜ͱ ෦ద༻ɿҰ෦ͷҾʹΛద༻ͯ͠ɺผͷؔΛͭ͘Δ ͜ͱ
ଞݴޠͰͷ Curry • ୈҰڃؔΛѻ͑ΔݴޠͰ͋ΕɺΧϦʔԽΛ࣮ࢪ͢Δ ؔΛ࣮Մೳɻ • ྫɿLISP, Scheme, F#, Scala,
Erlang, Eiffel, Perl, Python, Rݴޠ, Sݴޠ, JavaScript • ϥΠϒϥϦͰɺΧϦʔԽؔΛ͑Δݴޠ͋Δ • Groovy ͷ curry ෦ద༻ͳͷͰҙ ग़యɿʮΧϦʔԽ - Wikipediaʯ http://ja.wikipedia.org/wiki/%E3%82%AB%E3%83%AA%E3%83%BC%E5%8C%96
Curry ΛͬͯΈΔ
FizzBuzzͯ͠ΈΔ
·ͱΊ
͓͍͍͠CurryΛ࡞ͬͯ ͓͍͍͖ͨͩ͘͠·͠ΐ͏
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠