Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: Ternary vs. Sort vs. Max

by sundialsvc4 (Abbot)
on Aug 11, 2015 at 03:35 UTC ( #1138103=note: print w/replies, xml ) Need Help??

in reply to Re^2: Ternary vs. Sort vs. Max
in thread Ternary vs. Sort vs. Max

Are you really serious, “Mom?”

Pardon me, ladies and gentlemen, while I “ROTFMAO™” ... and conclude, most graciously, that seriousness in this matter simply cannot be possible.

O-p-e-r-a-t-o-r-:   a unary or binary element within an arithmetic expression, viz:

445 IF (A MAX B) > 5 THEN 550

It very elegantly captures the most-common use case for a ternary operator, without requiring a function-call having two or more arguments (which that language did not support).

Replies are listed 'Best First'.
Re^4: Ternary vs. Sort vs. Max
by Laurent_R (Canon) on Aug 12, 2015 at 21:31 UTC
    You should really take a look at Perl 6: it enables you to build your own infix max operator in just a couple of code lines (see for example Moritz's tutorial on the subject: So that you could have something like:
    if ($c max $d > 5) { # ... }
    Oh, but I forgot, you absolutely (and unreasonably IMHO) hate Perl 6, too bad for you, or maybe you should reconsider your opinion on the subject.

    And, BTW, NO, I did not downvote your post. If anyone did, it's not me.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-01-23 02:31 GMT
Find Nodes?
    Voting Booth?