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
Gunosy.go #2 container
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Satoshi
September 25, 2014
Programming
81
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gunosy.go #2 container
go lang study
Satoshi
September 25, 2014
More Decks by Satoshi
See All by Satoshi
高速な広告配信サーバの作り方のコツ
satoshi03
3
550
スケールしない広告サーバの作り方
satoshi03
0
260
Gunosy AdServerのデータ周りの話
satoshi03
2
3.1k
フルスクラッチで書いたアドサーバの開発・運用史
satoshi03
2
4.5k
Gunosy Go Lang Study #6 net net/http net/url
satoshi03
0
150
Other Decks in Programming
See All in Programming
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
180
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
280
AI Augmentation Techniques with Liberty
ivargrimstad
1
370
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
120
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.5k
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
210
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
1
170
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
290
Groovy as a human and AI friendly programming language
paulk
0
180
小さなアプリを作って公開するまで
onozaty
0
120
Featured
See All Featured
BBQ
matthewcrist
90
10k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
920
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Evolving SEO for Evolving Search Engines
ryanjones
0
350
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
600
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
600
Statistics for Hackers
jakevdp
799
230k
It's Worth the Effort
3n
188
29k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Transcript
Gunosy.go #2 container Gunosy Inc.
自己紹介 • 印南 聡志 (いんなみ さとし) • 6月にGunosyに入社
• Java/Ruby … 最近 Python/Go 始めました
Container • h?p://golang.org/pkg/container/ • データのまとまりを扱うためのパッケージ – List : 双方向連結リスト
– Ring : 循環リスト – Heap : 二分木構造リスト(用Interface)
List • 双方向連結リスト – 各エレメントが前後のエレメントへのリンク (ポインタ)を所持 – インサートは高速だがインデックス参照は不可 – ジェネリクスの機能はなし
• 型アサーションを使う必要がある Element value Element value Element value root next *Element prev *Element next *Element prev *Element
List – type Element • type Element – 双方向リストの要素(エレメント)、格納するデータ、
前後のリストのリンクを持つ – Value interface{} – func (*Element) Next – func (*Element) Prev
List – type List • type List
func New() *List func (l *List) Back() *Element func (l *List) Front() *Element func (l *List) Init() *List func (l *List) InsertATer(v interface{}, mark *Element) *Element func (l *List) InsertBefore(v interface{}, mark *Element) *Element func (l *List) Len() int func (l *List) MoveATer(e, mark *Element) func (l *List) MoveBefore(e, mark *Element) func (l *List) MoveToBack(e *Element) func (l *List) MoveToFront(e *Element) func (l *List) PushBack(v interface{}) *Element func (l *List) PushBackList(other *List) func (l *List) PushFront(v interface{}) *Element func (l *List) PushFrontList(other *List) func (l *List) Remove(e *Element) interface{}
List h?p://play.golang.org/p/7GnwWoC-‐_s 出力: 1 2 3
4
Ring • 循環リスト • どのリング要素のポインタもリング全体への参照と して使用可能 • (Javaのような)ジェネリクスの機能はなし
• 型アサー(ry prev *Ring next *Ring prev *Ring prev *Ring next *Ring next *Ring
Ring – type Ring func New(n int) *Ring
func (r *Ring) Do(f func(interface{})) func (r *Ring) Len() int func (r *Ring) Link(s *Ring) *Ring func (r *Ring) Move(n int) *Ring func (r *Ring) Next() *Ring func (r *Ring) Prev() *Ring func (r *Ring) Unlink(n int) *Ring
Ring h?p://play.golang.org/p/2SqEm4PGHT 出力: 要素数: 10 0 1
2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Heap • 二分木構造 • 取り出される値が常に最小になる – Init, Fix, Pop,
Push, Remove実行時にmin-‐heapが 走る • List, Ringとは異なり自身で定義した配列型に heap.interfaceを実装
Heap • 実装する必要のある関数 – func(Interface) Pop() – func(Interface) Push()
– func (Interface) Len() – func (Interface) Less() – func (Interface) Swap() デモ:h?p://play.golang.org/p/QIxb4gHIkW
まとめ • Container – データのまとまりを便利に扱うためのパッケージ • List : 双方向連結リスト
• Ring : 循環リスト • Heap : 2分木構造 – インサートが高速 – インデックスでの要素指定ができない