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
postfix dereference 徹底攻略 / effective postfix de...
Search
mackee
March 30, 2018
Programming
410
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
postfix dereference 徹底攻略 / effective postfix dereference
Gotanda.pm #16
mackee
March 30, 2018
More Decks by mackee
See All by mackee
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
130
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
980
Agentに至る道 〜なぜLLMは自動でコードを書けるようになったのか〜
mackee
6
5.8k
今!ソフトウェアエンジニアがハードウェアに手を出すには
mackee
14
7.1k
ワンバイナリWebサービスのススメ
mackee
10
8.8k
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
670
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
1.2k
perl for shell, awk and sed programmers
mackee
3
2.8k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
1.1k
Other Decks in Programming
See All in Programming
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
Inside Stream API
skrb
1
730
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.1k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.7k
The NotImplementedError Problem in Ruby
koic
1
810
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
140
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
さぁV100、メモリをお食べ・・・
nilpe
0
140
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.2k
Featured
See All Featured
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
970
Statistics for Hackers
jakevdp
799
230k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
600
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Rails Girls Zürich Keynote
gr2m
96
14k
A better future with KSS
kneath
240
18k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
First, design no harm
axbom
PRO
2
1.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
240
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
Transcript
postfix dereference పఈ߈ུ @mackee_w a.k.a macopy Gotanda.pm #16
୭ˠ • twitter: @mackee_w • GitHub: mackee • kuiperbelt/kuiperbelt :
WebSocketศར܅ • ࠷ۙPerl Hackers Hubʹςετͱ͔ͷهࣄΛॻ ͍ͨ
postfix dereference ͬͯԿ
postfix dereference $hashref->%* $arrayref->@*
postfix dereference $hashref->%* $arrayref->@*
postfix dereference $hashref->%* $arrayref->@*
ղઆ
postfix dereference %{$hashref} || $hashref->%*
postfix dereference @{$arrayref} || $arrayref->@*
postfix ɹ= έπʹͭ͘ dereference ɹ= σϦϑΝϨϯε ུ: postderef
֗ͷ ಡΊͳ͍ ͜Εศརʂ
ϝϦο τ
ϝϦοτ • ߦͬͯʙฦͬͯͬͯͳΒͳ͍ %{$aaa->{bbb}} $aaa->{bbb}->%* 1 2 3 4 5
6 7 1 2 3 4 5 6
σϝϦοτ
……ͳΜͰ ه߸૿ͪ͠Όͬͨͷʁ
͓٬༷ɺ ه߸૿͓ͯ͠Γ·ͤΜɺ ه߸ͷΈ߹ΘͤΛ૿ͨ͠ ͚ͩͳͷͰ͢……
Έ߹Θͤ……
୭͕ * ͚ͩͩͱݴͬͨ
hash slicing my $hashref = { k1 => "v1", k2
=> "v2", k3 => "v3" }; # ී௨ͷσϦϑΝϨϯε͔ΒͷϋογϡεϥΠε my ($v1, $v3) = @{$hashref}{qw/k1 k3/}; # postderefͰϋογϡεϥΠε my ($v1, $v3) = $hashref->@{qw/k1 k3/};
࣮࣭JSͷobject destructuringͰʁʁʁ ※ӈลʹॻ͔ͳ͍ͱ͍͚ͳ͍ͷͰҧ͍·͢ https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
·ͱΊ • ʢͱख͕֮͑Εʣศར • *͚ͩͰͳ͍ɻΉ͠ΖͦΕҎ֎͕ศར • v5.24͔Βexperimental֎Εͨɻ͑· ͢ʂʂʂʂ • ࠓճͷίʔυશ෦use
v5.24.0;ͯ͠·͢
http://perldoc.jp/docs/perl/5.24.0/perl5240delta.pod
postderef_qqͬͯͳʹ
postderef_qq my $hashref = { k1 => “v1", k2 =>
"v2", k3 => "v3" }; print "[$hashref->@{qw/k1 k3/}]\n"; # => [v1 v3]
ͳΔ΄Ͳͳʁ
csvΈ͍ͨʹग़ͨ͠Γ my @columns = qw/c1 c2 c3/; my $data =
[ { c1 => "aa", c2 => "bb", c3 => "cc" }, { c1 => "dd", c2 => "ee", c3 => "ff" }, { c1 => "gg", c2 => "hh", c3 => "ii" }, ]; $" = ","; print "@columns\n"; print "$_->@{@columns}\n" for @$data;
csvΈ͍ͨʹग़ͨ͠Γ $ perl postderef.pl c1,c2,c3 aa,bb,cc dd,ee,ff gg,hh,ii
Ͳ͏Αʁʁʁʁ
ײ • ϫϯϥΠφʔͱ͔Ͱศརͦ͏ • jqͷΘΓʹ͏ͱ͔ • ͱ͍͑·ͣv5.24ʹ্͛Δͱ͜Ζ͔Β……