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
Ruby Quiz
Search
pocke
October 08, 2017
Programming
650
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby Quiz
at 学生エンジニア限定LT大会
pocke
October 08, 2017
More Decks by pocke
See All by pocke
New "Type" system on PicoRuby
pocke
1
1.2k
プログラミングで遊ぶ
pocke
0
140
Witchcraft for Memory
pocke
1
6.5k
The path to memory reduction in RBS
pocke
0
90
RBSのメモリ使用量改善への道
pocke
1
83
Community-driven RBS repository
pocke
2
1.7k
Active Record Query Quiz
pocke
1
1.7k
Let's write RBS!
pocke
1
5.4k
RBS and Rails, Present and Future
pocke
1
1.4k
Other Decks in Programming
See All in Programming
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.3k
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
800
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
3.9k
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
110
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
370
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
310
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
610
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
260
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
140
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
190
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
200
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
600
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
970
Paper Plane
katiecoart
PRO
2
52k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
My Coaching Mixtape
mlcsv
0
170
Code Reviewing Like a Champion
maltzj
528
40k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
330
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
650
How STYLIGHT went responsive
nonsquared
100
6.2k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
Transcript
Ruby Quiz Oct. 8, 2017 第4回 学生エンジニア限定LT大会
I have only 5 minutes, so I'll speak very fast.
Self introduction • Pocke • Actcat, Inc. / SideCI •
RuboCop' s core developer • Student at The Open University of Japan
SideCI
Automated Code Review as a Service
Please access here! https://sideci.com
Ruby Quiz
Question
Do you write Ruby?
Ruby Quiz • You are a Ruby interpreter. ◦ You
are a parse.y. ◦ You are a YARV. • You execute ruby code, and you output result.
Quiz 1
Q. What does the code output? p(??) p(%_?_)
Answer p(??) # => "?" p(%_?_) # => "?"
Why?
A. Why does it output "?"? p(??) p(%_?_) %<any character>…<any
character> is a string literal. e.g.) %_?_ == "?" , %!???! == "???" ?_ is a character literal. e.g.) ?_ == "_" , ?? == "?"
Quiz 2
Q. What does the code output? p(????::?:) p(% %s% %%%%)
Answer p(????::?:) # => ":" p(% %s% %%%%) # =>
"%"
Why????
Answer p(????::?:) p(% %s% %%%%) 1. ?? is "?" 2.
? is a part of conditional op 3. ?: is ":" 4. : is a part of conditional op 5. ?: is ":" "?" ? ":" : ":" 1. % %s% is "%s%" 2. % is a format op(Like sprintf) 3. %%% is "" sprintf("%s%", "")
Quiz 3
Q. What does the code output? a = ["1","2","3"] a&.map(&:to_i)&.&([1])
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1]
Why?????
Answer a = ["1","2","3"] a&.map(&:to_i)&.&([1]) # => [1] &. is
a safe navigation op(nil guard). &:to_i is an implicit to_proc op. A safe navigation op & is an intersection op call (like [1,2,3] & [1])
Conclusion
• We can write tricky code in Ruby. ◦ Very
fun!!! Thank you for listening! Conclusion