http://www.perlmonks.org?node_id=394312


in reply to Re^2: A "but" operator.
in thread A "but" operator.

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