NiceSlice(3pm)

πŸ’– NiceSlice(3pm) πŸ’–

okay bestie, so this is a Perl manual page β€” NiceSlice(3pm) β€” and no, it's not about your skincare routine, it's about making PDL array slicing not look like a crime scene. let's get into it 🫢


✨ NAME ✨

PDL::Perldl2::Plugin::NiceSlice β€” literally just here to turn on the PDL NiceSlice syntax. that's the whole job. slay.


🌸 DESCRIPTION 🌸

so the way that this works is: this plugin lets you use the PDL::NiceSlice syntax inside an instance of Devel::REPL β€” you know, like the new Perldl2 shell, pdl2. πŸ’…

and listen, without the plugin? array slicing looks like this tragedy:

pdl> use PDL;

pdl> $x = sequence(10);
$PDL1 = [0 1 2 3 4 5 6 7 8 9];

pdl> $x->slice("2:9:2");
$PDL1 = [2 4 6 8];

so many arrows. so many quotes. it's giving ✨effort✨ 😭

but AFTER the NiceSlice plugin has been loaded?? you get to write this instead:

pdl> $x(2:9:2)
$PDL1 = [2 4 6 8];

same result. zero vibes ruined. main character energy fr fr πŸ‘‘


⚠️ CAVEATS ⚠️

okay so important one, bestie β€” don't skip this part 🚨

PDL::NiceSlice uses Perl source preprocessing. so if you need 100% pure Perl compatibility, use the slice method instead. no cap. that's the deal.


πŸ‘€ SEE ALSO πŸ‘€

  • PDL::NiceSlice
  • Devel::REPL
  • PDL::Perldl

go read those too, iykyk πŸ“šβœ¨


πŸ’œ AUTHOR πŸ’œ

Chris Marshall, <chm at cpan dot org> β€” iconic behavior, we stan πŸŽ€


Copyright (C) 2010 by Christopher Marshall

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page!! 🌈 this was rendered with perl v5.38.2, dated 2024-04-10, and it's the NiceSlice(3pm) page β€” mwah, go slice some arrays, bestie πŸ’–πŸ«ΆπŸŒΈ

πŸ“¦ where this page comes from