Move length to multipurpose functions
This commit is contained in:
parent
c575115f92
commit
b0d9bf447e
1 changed files with 12 additions and 14 deletions
|
@ -227,20 +227,6 @@ my %stdctx = (
|
|||
'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 length
|
||||
'length' => sub {
|
||||
my ($a) = @_;
|
||||
|
||||
if (ref($a) eq "ARRAY")
|
||||
{
|
||||
return scalar(@$a);
|
||||
}
|
||||
else
|
||||
{
|
||||
return length($a);
|
||||
}
|
||||
},
|
||||
|
||||
# Bitwise operations
|
||||
'logand' => sub {
|
||||
my $v = -1;
|
||||
|
@ -312,6 +298,18 @@ my %stdctx = (
|
|||
|
||||
# Multi-purpose
|
||||
'equal' => \&lisp_equal,
|
||||
'length' => sub {
|
||||
my ($a) = @_;
|
||||
|
||||
if (ref($a) eq "ARRAY")
|
||||
{
|
||||
return scalar(@$a);
|
||||
}
|
||||
else
|
||||
{
|
||||
return length($a);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
sub parser {
|
||||
|
|
Loading…
Reference in a new issue