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
【Go言語】値の比較
Search
Tomoki Ota
August 15, 2024
Programming
0
47
【Go言語】値の比較
値の比較について解説しています
Tomoki Ota
August 15, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
110
アーキテクチャとビジネスロジック
tomo1227
0
110
【Go言語】テスト
tomo1227
0
66
【Go言語】クロージャ
tomo1227
0
290
【Go言語】イテレータ
tomo1227
0
80
【Go言語】エラーハンドリング
tomo1227
0
68
AIに淘汰されないようにするには?
tomo1227
0
72
【Go言語】range
tomo1227
0
78
【Go言語】break
tomo1227
0
71
Other Decks in Programming
See All in Programming
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
120
Go コードベースの構成と AI コンテキスト定義
andpad
0
150
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
130
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
570
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
180
Vibe codingでおすすめの言語と開発手法
uyuki234
0
160
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
170
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
310
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
450
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
280
Python札幌 LT資料
t3tra
7
1.1k
PostgreSQLで手軽にDuckDBを使う!DuckDB&pg_duckdb入門/osc25hi-duckdb
takahashiikki
0
230
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
770
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
420
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
220
For a Future-Friendly Web
brad_frost
180
10k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
130
The Spectacular Lies of Maps
axbom
PRO
1
410
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
220
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
32
Transcript
Tomoki Ota ʲGoݴޠʳͷൺֱ
ͷൺֱৗʹ==Λͬͯ ൺֱͰ͖ΔΘ͚Ͱͳ͍
ൺֱͰ͖Δྫ ൺֱͰ͖ͳ͍ྫ ൺֱՄೳͳΦϖϥϯυ ൺֱෆՄೳͳܕͷൺֱ ΞδΣϯμ 3
ൺֱͰ͖Δྫ
ൺֱͰ͖Δྫ 5
ൺֱͰ͖ͳ͍ྫ
ൺֱͰ͖ͳ͍ྫ 7
ൺֱՄೳͳΦϖϥϯυ
ൺֱՄೳͳΦϖϥϯυ 9 == ͱ !=ɺΦϖϥϯυ͕ൺֱՄೳ(comparable)ͷͱ͖ʹ༻Ͱ͖Δ
ൺֱՄೳͳΦϖϥϯυ 10 boolean (ܕɺුಈখܕɺෳૉܕ) จࣈྻ νϟωϧ ΠϯλʔϑΣΠε ϙΠϯλ ߏମͱྻ
ൺֱՄೳͳΦϖϥϯυ 11
ൺֱՄೳͳΦϖϥϯυ 12 structಉ༷ɺanyܕҙʂ
ൺֱෆՄೳͳܕͷൺֱ
ൺֱෆՄೳͳܕͷൺֱ 14 ඪ४ϥΠϒϥϦͷre f lectΛ༻͢Δ
ൺֱෆՄೳͳܕͷൺֱ 15 re f lect.DeepEqualؔ2ͭͷΛ࠶ؼతʹḷͬͯɺ2ͭͷཁૉ͕͍͠ ͔൱͔Λஅ͢Δɻ ͜ΕجຊσʔλܕɺྻɺߏମɺεϥΠεɺϚοϓɺϙΠϯλɺΠϯλʔ ϑΣΠεɺؔʹ༻Ͱ͖Δɻ
re f lect.DeepEqualͷྫ 16
re f lect.DeepEqualͷҙ 17 nilίϨΫγϣϯͱۭίϨΫγϣϯΛ۠ผ͢Δ(ϢʔεέʔεʹΑͬͯͱͳΔɻ ྫ͑2ͭͷΞϯϚʔγϟϧૢ࡞ͷ݁ՌΛൺֱ͍ͨ࣌͠) ϦϑϨΫγϣϯΛ͍ͬͯΔͷͰɺੑೳ্ͷϖφϧςΟ͕͋Δ ϕϯνϚʔΫͰɺ==ͷ100ഒ͍ύϑΥʔϚϯεɻຊ൪Ͱͬͯμϝ
ಠࣗͷൺֱϝιουΛ࣮͢Δ 18 ಠࣗͷൺֱϝιουΛ༻͢Δͱɺ ύϑΥʔϚϯε͕վળ͢Δɻ ࠨͷίʔυre f lect.DeepEqualͷ96ഒߴ
ϢχοτςετͰͷൺֱ 19 ϢχοτςετͰɺgo-cmptestifyͱ͍ͬͨ֎෦ϥΠϒϥϦΛ༻Ͱ͖Δɻ ͔͠͠ɺ࣮ߦ࣌ͷੑೳ͕ॏཁͳ߹ɺಠࣗͷؔΛ࣮͢Δ͜ͱ͕ϕετϓϥΫςΟεɻ
ͦͷ΄͔ͷൺֱؔ 20 ඪ४ϥΠϒϥϦʹɺbytes.Compareͱ͍͏2ͭͷbyteεϥΠεΛ ൺֱͰ͖ΔϥΠϒϥϦ͕ଘࡏ͢Δɻ ಠࣗͷؔΛ࣮͢Δલʹɺंྠͷ࠶ൃ໌Λ͍ͯ͠ͳ͍͜ͱΛ֬ೝ͢Δʂ
ൺֱՄೳͳΒ==, !=Λ͏ ύϑΥʔϚϯεΛؾʹ͠ͳ͍ͳΒre f lectionΛ༻͢Δ ύϑΥʔϚϯεΛؾʹ͢ΔͳΒಠ࣮ࣗ ಠ࣮ࣗ͢ΔલʹطଘͷϥΠϒϥϦ͕ଘࡏ͢Δ͔ௐΔ ·ͱΊ 21