Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
you say "but" is just like "and". How's that possible?

In fact, some languages have words that can be translated into English as either "but" or "and". For example, the Greek postpositive "de" (delta epsilon) is most frequently translated into English as "but", but it can also be translated into English as "and" (though for "and" the conjunction "kai" is much more common).</philolophile>

The meaning of "but" and "and" in English _is_ different, but the difference doesn't have very much to do with the meaning of "and" in Perl. The real difference is that "but" implies that the second item may be surprising given the first, while "and" has only the more basic meaning of conjunction. Still, in terms of their value as boolean operators, both would mean the same thing: the first argument is true; the second argument is also true. Boolean logic doesn't much care about surprise value. Think about the difference in meaning between "The ball is blue and it is also heavy" versus "The ball is blue but it is also heavy". In both cases we're dealing with a heavy blue ball, but in the latter case there is an implication (quite a surreal one, given the usual presumption that color and weight are pretty much orthogonal) that we might ordinarily expect a blue ball not to be heavy -- but this one is.

And, as pointed out, the word "but" is going to be used in Perl6 for something really cool that will be sure not to disappoint you, though not as a boolean operator:

my $x = ("The answer to the ultimate question of life, the universe +, and everything" but 42 but false but undef); print "Number: " . (0+$x) . "\n"; print "String: " . $x . "\n"; print "Boolean: false\n" unless $x; print "Undefined" if not defined $x;

(I might have some legacy Perl5 syntax in there by mistake. For some reason, though I want to learn and use Perl6, I keep finding myself being lured away by Perl5 and its persistent siren call of actually being ready for use now.)


"In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68

In reply to "but" versus "and" by jonadab
in thread A "but" operator. by muba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found