Move length to multipurpose functions

This commit is contained in:
madmaurice 2021-04-03 18:47:23 +02:00
parent c575115f92
commit b0d9bf447e

View file

@ -227,20 +227,6 @@ my %stdctx = (
'string-not-greaterp' => sub { my ($a, $b) = @_; return !(lc($a) gt lc($b)); }, 'string-not-greaterp' => sub { my ($a, $b) = @_; return !(lc($a) gt lc($b)); },
'string-not-lessp' => sub { my ($a, $b) = @_; return !(lc($a) lt lc($b)); }, 'string-not-lessp' => sub { my ($a, $b) = @_; return !(lc($a) lt lc($b)); },
# string length
'length' => sub {
my ($a) = @_;
if (ref($a) eq "ARRAY")
{
return scalar(@$a);
}
else
{
return length($a);
}
},
# Bitwise operations # Bitwise operations
'logand' => sub { 'logand' => sub {
my $v = -1; my $v = -1;
@ -312,6 +298,18 @@ my %stdctx = (
# Multi-purpose # Multi-purpose
'equal' => \&lisp_equal, 'equal' => \&lisp_equal,
'length' => sub {
my ($a) = @_;
if (ref($a) eq "ARRAY")
{
return scalar(@$a);
}
else
{
return length($a);
}
},
); );
sub parser { sub parser {