The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by vipinh]

Hi Dave,
Regarding the final one-line Schwartzian Transform code on Page 45 of your
book , shouldn't this

my @CDs_sorted_by_year = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_, $_->{year}] } @CDs;

be
my @CDs_sorted_by_year = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_->{year},$_] } @CDs;
import-bot (20211) [Avatar] Offline
#2
Re: Errata in Schwartzian transform line:
[Originally posted by dave]

No, I think it's fine the way it is.

The first map (at the bottom) creates two item arrays. Element 0 is the
original data and element 1 is the year taken from the data record.

The sort then sorts on element 1 (the year) and the final map (at the top)
extracts the original data from element 0.

Does that help?

Dave...