Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re (tilly) 2 (expectations): Apparent Inconsistencies in Perl Function Naming

by tilly (Archbishop)
on Nov 25, 2000 at 21:32 UTC ( [id://43321]=note: print w/replies, xml ) Need Help??


in reply to Re: Apparent Inconsistencies in Perl Function Naming
in thread Apparent Inconsistencies in Perl Function Naming

Nat's suggestion fails to meet my expectations. Mine would be that length should work something like this:
sub length { if (1 == @_) { return CORE::length(shift); } else { return map {CORE::length($_)} @_; } }
IOW return a list of lengths instead of the number of things in the array. (Which I can easily get anyways.)

Perl can't match both my expectations and princepawn's...

  • Comment on Re (tilly) 2 (expectations): Apparent Inconsistencies in Perl Function Naming
  • Download Code

Replies are listed 'Best First'.
Re: Re (tilly) 2 (expectations): Apparent Inconsistencies in Perl Function Naming
by swiftone (Curate) on Nov 28, 2000 at 02:31 UTC
    IOW return a list of lengths instead of the number of things in the array. (Which I can easily get anyways.)

    Really then, shouldn't length return a list or a scalar depending on the context in which it was called? :)

    Note to all: If you don't see the humor in this, reread the thread

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://43321]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found