Statis...losure(3pm)
β¨ Statistics::R::REXP::Closure β an R closure β¨
okay bestie, welcome to the Perl docs for Statistics::R::REXP::Closure (that's the module name, we're doing this π
). This is the Statistics::R::REXP::Closure page from the User Contributed Perl Documentation, and we're about to make closures make sense. no cap.
π VERSION π
version 1.0002 β yes, that's the one, periodt.
πΈ SYNOPSIS πΈ
use Statistics::R::REXP::Closure
my $clos = Statistics::R::REXP::Closure->new(body => {
Statistics::R::REXP::Language->new([
Statistics::R::REXP::Symbol->new('mean'),
Statistics::R::REXP::Double->new([1, 2, 3])
])
});
print $env->elements;
like, look at her go π«Ά
π¦ DESCRIPTION π¦
An object of this class is the whole vibe of an R closure (ENVSXP). Closures in R get built with function, and they're made of three things: the arguments (args) β which can optionally have default values (defaults); a body; and an environment, which is basically a pointer to an enclosing evaluation frame for when the closure actually gets used.
These objects represent calls (such as model formulae), with the first element being a reference to the function being called, and the rest being the actual arguments of the call. If the arguments have names, those get recorded in the 'names' attribute (and that attribute is itself a Statistics::R::REXP::Character vector), with unnamed arguments getting the name ''. And if no arguments were named, the environment objects will not have a defined 'names' attribute. iykyk.
bestie, real talk: you should not be creating instances of this class. it exists mainly to handle deserialization ofENVSXPs by theIOclasses. it's giving behind-the-scenes queen π
π METHODS π
Statistics::R::REXP:Environment inherits from Statistics::R::REXP, but with an extra restriction: its first element has to be a Statistics::R::REXP::Symbol or another Environment instance. So if you try to create a Closure instance that doesn't follow that rule? it will raise an exception. literally, don't test her π
π ACCESSORS π
argsβ a reference to the array of argument names.defaultsβ returns an array reference to the default values of the corresponding arguments, orundefs if the argument doesn't have a default. (And if none of the arguments have defaults, this can be an empty array.)bodyβ returns theStatistics::R::REXPrepresenting the body of the function.environmentβ returns a reference to the enclosing evaluation frame, aka the environment the function is defined within and where it looks up any free variables. This attribute is optional, because some serialization mechanisms (notably Rserve's QAP) just don't save the closure's environment. rude of them honestly πsexptypeβ the SEXPTYPE of closures isCLOSSXP.to_plβ Closures do not have a native Perl representation, and trying to call this accessor will raise an exception. so don't π
π BUGS AND LIMITATIONS π
Classes in the REXP hierarchy are intended to be immutable. Please do not try to change their value or attributes. she is who she is, okay?
There are no known bugs in this module. For bug reporting, please see Statistics::R::IO.
π SUPPORT π
See Statistics::R::IO for support and contact information. they got you π«Ά
π AUTHOR π
Davor Cubranic <cubranic@stat.ubc.ca>
β COPYRIGHT AND LICENSE β
This software is Copyright (c) 2017 by University of British Columbia.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
and that's the whole page, bestie! πΈπ this was perl v5.34.0, dated 2022-02-10, straight from the User Contributed Perl Documentation β go forth and deserialize responsibly, mwah π
β¨
π¦ where this page comes from
- debian bookworm: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- debian trixie: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu jammy: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu noble: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu resolute: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu stonking: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms