Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re3: Anyone use "xor" in conditionals?

by dragonchild (Archbishop)
on Jul 15, 2003 at 02:17 UTC ( [id://274257]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Anyone use "xor" in conditionals?
in thread Anyone use "xor" in conditionals?

And why haven't you offered this as a patch to Date::Leapyear or any of the other Date:: modules? Hmmm?!? Or, even better, offer both the pureperl and XS versions ...

In other words, it's through these incremental improvements that modules are made as strong as they can be. That kind of code is exactly the code that belongs in modules. They're supposed to fast, commented, and full of black magic. That's why modules exist!

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re3: Anyone use "xor" in conditionals?
by BrowserUk (Patriarch) on Jul 15, 2003 at 02:30 UTC

    Mostly cos I'd never even considered looking at, never mind using a module to determine whether a year was a leapyear or not.

    I only looked up Date::Leapyear in order to find a representative example of "the conventional way". I was only responding to the question about xor, and never gave a thought to the performance until Abigail-II (rightly) posted the benchmark.

    From there, I couldn't not rise to the challenge could I :).


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


      ++ BrowserUK for thinking like i do. :) how about this little gem from Net::Netmask...

             sort_by_ip_address       This function is included in "Net::Netmask"
                                      simply because there doesn't seem to be a bet-
                                      ter place to put it on CPAN.  It turns out
                                      that there is one method for sorting dotted-
                                      quads ("a.b.c.d") that is faster than all the
                                      rest.  This is that way.  Use it as
                                      "sort_by_ip_address(@list_of_ips)".
      
      sub sort_by_ip_address { return sort { pack("C4",split(/\./,$a)) cmp pack("C4",split(/\./,$ +b)) } @_ }

      which has to be about the worst possible.

        which has to be about the worst possible.

        Prove it.

        ------
        We are the carpenters and bricklayers of the Information Age.

        Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

        Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-19 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found