in reply to Re^2: Is this the most elegant way to code directory lookup?
in thread Is this the most elegant way to code directory lookup?

There. So much clearer now...not.

Your ability to make something less clear doesn't negate everyone else's ability to make something more clear.

if( ! -d && $_ ne "." && $_ ne ".." ) {

Yes, that prevents a noticeable mental pause that the "unless" version induced. [ Even better, it avoids the mental tension between how "unless" is usually used in English vs. how it is used in Perl and the fact that the unexplicit "not" implied by "unless" is too easy to mentally drop. ]

- tye        

  • Comment on Re^3: Is this the most elegant way to code directory lookup? (!unless)
  • Download Code

Replies are listed 'Best First'.
Re^4: Is this the most elegant way to code directory lookup? (!unless)
by ikegami (Patriarch) on Sep 29, 2006 at 16:17 UTC
Re^4: Is this the most elegant way to code directory lookup? (!unless)
by BrowserUk (Patriarch) on Sep 29, 2006 at 16:55 UTC

    So the condition to which I was referring:

    if( not ($bar =~ /bar/ or $baz !~ /qux/ and defined $undef) )

    can be tranformed into

    if( ! -d && $_ ne "." && $_ ne ".." ) {

    I guess I'll have to review DeMorgan's law (Tye's version) plus some of this.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      No, of course not. I was going back to the original code (obviously). I'm sure you know how to transform the made-up code in a similar manner (especially since you used the term for it) even though you didn't do it originally. But I didn't find that made-up code much good in illustrating whether something is easy to understand (since the code has no real point so how can I say I've understood it).

      This is why I usually respond to you anonymously, because you seem to have a very hard time examining what I say instead of the fact that I am the one who said it. It certainly seems to work out better that way, in my experience, and is my best guess at explaining why you felt that "appeal to ridicule" was appropriate. I certainly had no intent to ridicule. But I'll not spend more time trying to convince you of this as previous such attempts have resulted in you feeling more ridiculed. I'll just continue to mostly avoid attaching my name to replies to you in order to avoid this particular problem. Cheers.

      - tye