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
LT20260516.pdf
Search
denkyuu1
May 12, 2026
20
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LT20260516.pdf
denkyuu1
May 12, 2026
More Decks by denkyuu1
See All by denkyuu1
LT20261017
denkyuu1
0
16
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Ethics towards AI in product and experience design
skipperchong
2
430
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
820
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Transcript
2 つの言語で動くFizzBuzz 学部2 年 denkyuu1 1
自己紹介 コードゴルフにはまってます プログラムの文字数( バイト数) をできるだけ短くする遊び https://code.golf 主に Ruby Julia でコードゴルフをやってます
2
Julia とPython 両方で動くFizzBuzz 名称はpolyglot polyglot とは、複数のプログラミング言語として解釈可能なコンピュータープログラム またはスクリプトであり、コンパイルまたは解釈に使用されるプログラミング言語と は関係なく、同じ操作または出力をするもののことである。 https://ja.wikipedia.org/wiki/Polyglot_( プログラミング)
3
FizzBuzz とは 1~100 までの数に対して 3 の倍数なら Fizz 5 の倍数なら Buzz
15 の倍数なら FizzBuzz を出力する 余りを調べて条件分岐 4
きっかけ Sei2423 Python でもJavascript でも動く???不思議なコード https://qiita.com/Sei2423/items/b68e83d12e0bd10e4b1c Python とJavascript 両方で動くFizzBuzz 言語仕様の違いで遊ぶ
5
Polyglot すぎゃーんメモ polyglot 基礎の基礎 https://memo.sugyan.com/entry/20110306/1299418878 Okiraku Programming 12 言語polyglot で足し算
https://neocat.hatenablog.com/entry/20140421/1398095941 6
Julia とPython の共通点・相違点 Julia Python 配列の添え字 1 から 0 から
内包表記 [... for i in ...] あり あり range(1, 10) 1, 2, ... ,10 1, 2, ... ,9 print() 改行無し デフォルトで改行あり ^ 累乗 xor 文字列連結 * + 文字列繰り返し ^ * これらを組み合わせてFizzBuzz を書きます 7
例 Julia Python [0, 1][1] 0 1 1 ^ 1
1¹ = 1 1 xor 1 = 0 "a" + "b" エラー "ab" "a" * "b" "ab" エラー "a" * 2 エラー "aa" "a" ^ 2 "aa" エラー 8
活用 別の処理をしたい Julia Python ["Julia", "Python"][1] "Julia" "Python" 同じ処理をしたい Julia
Python ["->", "select", "<-"][(1 ^ 1) + 1] "select" "select" 9
結果 [print([["$i", i][1], "Fizz", "Buzz", "FizzBuzz"][(1^1)+(i%3==0)+2*(i%5==0)]*["\n", 1][1]) for i in
range(1, 100^1)] 10
内包表記 [print("FizzBuzz出力") for i in range(1, 100^1)] どちらも1 から100 まで繰り返す
Julia range(1, 100^1) = range(1, 100) Python range(1, 100^1) = range(1, 101) 100 xor 1 = 0b1100100 xor 0b0000001 = 0b1100101 = 101 11
print print([["$i", i][1], "Fizz", "Buzz", "FizzBuzz"][(1^1)+(i%3==0)+2*(i%5==0)]*["\n", 1][1]) ↓↓↓ print( [出力するものリスト][3,
5で割り切れるか判定] * 文字列を1回繰り返す/末尾の改行 ) 12
print([["$i", i][1], "Fizz", "Buzz", "FizzBuzz"][(1^1)+(i%3==0)+2*(i%5==0)]*["\n", 1][1]) 比較 Julia "$i" は変数展開
数字 * 文字列 はエラー print( ["$i", "Fizz", "Buzz", "FizzBuzz"][(1)+(i%3==0)+2*(i%5==0)] * "\n" ) Python 数字 * 1 は数字出力に影響なし print( [i, "Fizz", "Buzz", "FizzBuzz"][(0)+(i%3==0)+2*(i%5==0)] * 1 ) 13
ご清聴ありがとうございました 14