in reply to Re: Code mistake in Camel book?
in thread Code mistake in Camel book?

Ah, ok. I see now. The book reads: "Here's how you might write a function that does a kind of set intersection by returning a list of keys occurring in all the hashes passed to it..."

The part that says "by returning a list of keys occurring in all the hashes passed to it..." led me to think "intersection" meant "union". It's been a while since I've had set theory. Still, "returning a list of keys common to each of the hashes passed to it" would be a lot less ambiguous.

Thanks!

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot";
$nysus = $PM . $MCF;

Replies are listed 'Best First'.
Re (tilly) 3: Code mistake in Camel book?
by tilly (Archbishop) on Jun 26, 2001 at 15:39 UTC
    But it is still worth sending this in as a suggestion. Often the hardest part of writing material which is meant to be read by people of different backgrounds is figuring out when language will be potentially unclear to your target audience. While anyone with a math background would pick up what "all" was supposed to mean from the word "intersection", the description of intersection itself is ambiguous and shouldn't be.

    However the usual way of talking in math would suggest one of the following two:

    • by returning a list of keys that occur in every hash passed to it.
    • by returning a list of keys that occur in all hashes passed to it.
    I believe that these should be clear to people without familiarity with the math, and also be clearer to people for whom English is a second language.

      For me, the key word that is missing is "each". Each of the keys returned is present in all of the hashes.

              - tye (but my friends call me "Tye")