Lvalue(3pm)

πŸ“¦
version 2.085 Β· 4 versions
, in ubuntu noble

πŸ’– Lvalue(3pm) β€” PDL::Lvalue πŸ’–

okay bestie, welcome to the Lvalue page from the User Contributed Perl Documentation collection, aka one of the lil' pages that ships with PDL 🫢


✨ NAME ✨

PDL::Lvalue β€” declare PDL lvalue subs πŸ’…


🌸 DESCRIPTION 🌸

So basically? This declares a subset of PDL functions so you can use them as lvalue subs. and the way that this slays is it lets you write way simpler stuff like this:

$x->slice(',(0)') .= 1;

instead of the clumsy, lowkey tragic version:

(my $tmp = $x->slice(',(0)')) .= 1;
🚨 okay important vibe check: this will only work if your perl supports lvalue subroutines (so versions >= v5.6.0). Also ngl, lvalue subroutines are currently regarded as experimental. so like. iconic but experimental. you've been warned bestie πŸ’€

πŸŽ€ SYNOPSIS πŸŽ€

use PDL::Lvalue; # automatically done with all PDL loaders

(yes it just happens for you, no extra effort, we love a self-loading king πŸ‘‘)


πŸ¦‹ FUNCTIONS πŸ¦‹

⭐ subs

test if a routine is a known PDL lvalue sub πŸ”

print "slice is an lvalue sub" if PDL::Lvalue->subs('slice');

and if you don't pass a routine name, it returns the whole list of PDL lvalue subs, like:

@lvfuncs = PDL::Lvalue->subs;

You can also use it in scalar context to find out if your PDL even has lvalue subs:

print 'has lvalue subs' if PDL::Lvalue->subs;

literally a little detective. obsessed πŸ•΅οΈβ™€οΈβœ¨


πŸ’œ AUTHOR πŸ’œ

Copyright (C) 2001 Christian Soeller (c.soeller@auckland.ac.nz). All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.


perl v5.38.2 Β· 2024-04-10 β€” that's the tea, that's the version, that's the date, mwah πŸ’‹ bye bestie, go lvalue responsibly πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from