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 1.24 のイテレータ from byte to bite
Search
Nozomu Ikuta
February 25, 2025
Technology
0
58
Go 1.24 のイテレータ from byte to bite
CA.go ~ Deep dive into Go1.24 ~ の登壇資料です
Nozomu Ikuta
February 25, 2025
Tweet
Share
More Decks by Nozomu Ikuta
See All by Nozomu Ikuta
Standard Schema: スキーマライブラリの統一企画とは何か
nozomuikuta
1
440
Demystifying Vite Internals
nozomuikuta
3
2.2k
Nuxt DevTools 101
nozomuikuta
3
1.9k
Deep Dive to UnJS and Nuxt 3
nozomuikuta
3
2.6k
OSS作者はじめの一歩
nozomuikuta
1
180
2022 年は Docus に注目しよう
nozomuikuta
1
95
Go初学者、最初の1週間の学び
nozomuikuta
1
83
Other Decks in Technology
See All in Technology
Cloud Run を解剖して コンテナ監視を考える / Breaking Down Cloud Run to Rethink Container Monitoring
aoto
PRO
0
110
開発も運用もビジネス部門も! クラウドで実現する「つらくない」統制とセキュリティ / Effortless Governance and Security Enabled by the Cloud
kanny
3
1.2k
OSMnx Galleryの紹介
mopinfish
0
120
変化に強いテーブル設計の勘所 / Table design that is resistant to changes
soudai
46
13k
Data Hubグループ 紹介資料
sansan33
PRO
0
1.7k
AIに実況させる / AI Streamer
motemen
1
1.1k
GitHub ActionsをTypeScriptで作ろう!
sansantech
PRO
2
370
グループ ポリシー再確認 ③
murachiakira
0
140
declaration mergingの威力:ライブラリアップデート時の書き換え作業を90%短縮するテクニック
yutake27
2
240
AIの電力問題を概観する
rmaruy
0
150
フロントエンドがTypeScriptなら、バックエンドはPHPでもいいじゃない/php-is-not-bad
hanhan1978
8
12k
AWS パートナー企業のテクニカルサポートが日々思っていること 〜そして、4/15 の現場から〜
kazzpapa3
2
380
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.5k
Docker and Python
trallard
44
3.4k
Balancing Empowerment & Direction
lara
0
70
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Embracing the Ebb and Flow
colly
85
4.7k
Documentation Writing (for coders)
carmenintech
71
4.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.2k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Navigating Team Friction
lara
185
15k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Transcript
Nozomu Ikuta 25th Feb. 2025 Go 1.24 ͷΠςϨʔλ from byte
to bite
@nozomuikuta X / GitHub • ιϑτΣΞΤϯδχΞ • Vue.js ຊϢʔβʔάϧʔϓίΞελοϑ •
UnJS ϝϯόʔ • Nuxt / Vite ίϯτϦϏϡʔλ
ϩΰืूத Shibuya.go
• ΠςϨʔλ͓͞Β͍ • bytes ύοέʔδͷΠςϨʔλ
ΠςϨʔλ͓͞Β͍
ΠςϨʔλ͓͞Β͍ • Go 1.23 ͰՃ͞Εͨ • yield ʹΑͬͯ࿈ଓͨ͠ΛίʔϧόοΫؔʹΘͨؔ͢ͷ͜ͱ • ͕ͳ͘ͳΔ͔
yield ͕ false Λฦ͢ͱΠςϨʔγϣϯ͕ऴྃ͢Δ
ΠςϨʔλ͓͞Β͍ • ͻͱͭͷΛΘͨ͢: Seq[V any] func(yield func(V) bool) • slices.All()
• slices.Values() • slices.Backward() • slices.Sorted() • etc.
ΠςϨʔλ͓͞Β͍ • ;ͨͭͷΛΘͨ͢: Seq2[K, V any] func(yield func(K, V) bool)
• maps.All() • maps.Insert() • etc.
bytes ύοέʔδͷΠςϨʔλ
• bytes.Lines() • bytes.FieldsSeq() • bytes.SplitSeq() • bytes.SplitAfterSeq() • bytes.FieldsFuncSeq()
bytes ύοέʔδͷΠςϨʔλ طఆͰׂ / ࣗ༝Ͱׂ
func Lines(s []byte) iter.Seq[[]byte] • newlineʢվߦʣͷޙͰ byte Λ۠ ͬͯฦͯ͘͠ΕΔ •
֤ඌʹվߦ͕͍ͭͯ͘Δ • byte ඌͷվߦͷ༗ແଚॏ͞Ε Δ bytes ύοέʔδͷΠςϨʔλ
func FieldsSeq(s []byte) iter.Seq[[]byte] • unicode.IsSpace()ʢۭനʣʹ߹க͢ Δ෦Ͱ byte Λ۠ͬͯฦͯ͘͠ ΕΔ
• ֤લޙʹۭനΛ;͘·ͳ͍ bytes ύοέʔδͷΠςϨʔλ
func SplitSeq(s, sep []byte) iter.Seq[[]byte] • ҙͷ byte slice Ͱ۠ͬͯฦͯ͠
͘ΕΔ • ֤ඌʹ۠Γ෦Λ;͘·ͳ͍ bytes ύοέʔδͷΠςϨʔλ
func SplitAfterSeq(s, sep []byte) iter.Seq[[]byte] • ҙͷ byte slice Ͱ۠ͬͯฦͯ͠
͘ΕΔ • ֤ඌʹ۠Γ෦Λ;͘Ή bytes ύοέʔδͷΠςϨʔλ
• ҙͷؔͰ byte Λ۠ͬͯฦ͠ ͯ͘ΕΔ • unicode.IsX() ϝιουͳͲͱΈ߹ Θͤͯ͏ •
֤લޙʹ۠Γ෦Λ;͘·ͳ ͍ bytes ύοέʔδͷΠςϨʔλ func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte]
·ͱΊ
• bytes ύοέʔδʹΠςϨʔλ͕ಋ ೖ͞Εͨ • ʮ۠ͬͯϧʔϓʯ͕ΑΓศརʹ
ࢀߟจݙ • https://go.dev/doc/go1.24 • https://pkg.go.dev/iter • https://pkg.go.dev/bytes
Thank you