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
分解に救われる
Search
valerauko
May 24, 2018
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
分解に救われる
地球はプラに、開発者の脳は複雑な引数指定に襲われてる。両方とも分解で解決できる。
Clojureの引数分解 (parameter destructuring) の軽いご紹介。
valerauko
May 24, 2018
More Decks by valerauko
See All by valerauko
CIにどこまで任せるのか?
valerauko
0
250
Reitit使ってみた
valerauko
0
410
Other Decks in Programming
See All in Programming
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
430
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
The Rails Doctrine Decade
koic
2
590
ActionController meets Protocol Buffers
sorah
0
530
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
The Cost Of JavaScript in 2023
addyosmani
55
10k
Statistics for Hackers
jakevdp
799
230k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Claude Code のすすめ
schroneko
67
230k
Navigating Team Friction
lara
192
16k
Building AI with AI
inesmontani
PRO
1
1.3k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
Transcript
引数で地球を救う 引数分解に惚れてしまった話
Erdos Balint • 株式会社スタディストでTeachme Biz開発 • ビール、⾳楽とプログラミング⼤好き • ⾃然を守ることを意識 @valerauko
⼤⾃然を守るのは⼈類の責任 プラスチック のゴミをなん とかしないと いけない
プラ汚染をなんとかするために u使う量を減らす u捨てる時に分ける uゴミを無害化する
プラ汚染をなんとかするために u使う量を減らす u捨てる時に分ける uゴミを無害化する
プラ汚染をなんとかするために u使う量を減らす u捨てる時に分ける uゴミを無害化する
プラ汚染をなんとかするために u使う量を減らす u捨てる時に分ける uゴミを無害化する 京⼯⼤・慶應の研究者が PETを分解する微⽣物を発⾒
引数が多いとわかりにくい 引数の意味がわからない 引数の必要性もわからない 問題
ハッシュマップを渡してみる 「すべて」は取れないネストされた ハッシュは分解できない 問題
分解に救われる 地球も正気も
羅列を分解 user=> (defn hoge #_=> "&でその他が取れる" #_=> [param1 & others]
#_=> (list param1 others)) #'user/hoge user=> (hoge "fuga" 3.14 42) ("fuga" (3.14 42))
羅列を分解 user=> (defn hoge #_=> "いらない要素は無視できる" #_=> [_ param1 param2]
#_=> (list param1 param2)) #'user/hoge user=> (hoge "fuga" 42 :konkon) (42 :konkon)
羅列を分解 user=> (defn hoge #_=> "ネストされた羅列も分解できる" #_=> [p1 [_ v1]
p2] #_=> (list p1 v1 p2)) #'user/hoge user=> (hoge "fuga" [3.14 42] :konkon) ("fuga" 42 :konkon) user=> (hoge 3.14 "abc" :konkon)
羅列を分解 user=> (defn hoge #_=> ":asで全ても取れる" #_=> [p1 [_ p3
:as meaning] p4] #_=> (list p1 p3 p4 meaning)) #'user/hoge user=> (hoge "fuga" [3.14 42] :konkon) ("fuga" 42 :konkon [3.14 42])
連装連想分解 user=> (def person #_=> {:name "Balint" #_=> :city "Tokyo"
#_=> :like ["Clojure" "beer" #_=> "music" "mobage"]}) #'user/person
連装連想分解 user=> (defn say-hello #_=> "マップから欲しいキーだけ取れる" #_=> [{name :name city
:city}] #_=> (str "Hello " name #_=> ", how is " city "?")) #'user/say-hello user=> (say-hello person) "Hello Balint, how is Tokyo?"
連装連想分解 user=> (defn say-hello #_=> ":orでデフォルト値⼊れられる" #_=> [{name :name :or
{name "Foo"}] #_=> (str "Hello, " name "!")) #'user/say-hello user=> (say-hello {}) "Hello, Foo!"
連装連想分解 user=> (defn say-hello #_=> ":keys :strs :symsで短略に書ける" #_=> [{:keys
[name city]}] #_=> (str "Hello " name #_=> ", how is " city "?")) #'user/say-hello user=> (say-hello person) "Hello Balint, how is Tokyo?"
連装連想分解 user=> (defn say-hello #_=> "好きに組み合わせもできる" #_=> [{:keys [name city]
:or {name "Guest"} #_=> [like :as likes] :like}] #_=> (println (str "Hello, " name "! " #_=> "How is " like " in " city "?")) #_=> likes) #'user/say-hello user=> (say-hello person) Hello, Balint! How is Clojure in Tokyo? ["Clojure" "beer" "music" "mobage"]
必要か? 複雑なデータ構造をその ままで渡して、それぞれ の関数で必要なものだけ 抜けられるので⾮常に便 利。 (def person {"@context" "https://example.com/#ns"
:name ["Erdos" "Balint"] :location {:country "Japan" :city "Tokyo"} :likes ["Clojure" "beer" "music" "mobage"] :work {:company "Studist" :position "Developer"} :skills {:language ["Hungarian" "English" "Japanese"] :code ["Ruby" "Python" "Clojure" "JavaScript" "SQL"]} :refs [{:url "https://balint.erdos.tech" :rel "Website"} {:url "https://github.com/valerauko" :rel "GitHub"} {:url "https://pawoo.net/@valerauko" :rel "Mastodon"}]})
We’re hiring! Ruby on Rails, Vue.js, AWS