And

 

 

If argii are Boolean, then...

And[argii,..]

...returns True if all of the "argii,.." are True.

 

And[{a1, b1, .., i1}, {a2, b2, .., i2}, ..,{aj, bj, .., ij}] elicits the AndMatrix.

 

Cardinal[And][arg1, arg2,...] (a.k.a. CardinalAnd)

...returns the argument position where the first False is encountered.

 
If sets,.. are Sets, then the Logical Pattern Set matching the intersection of sets is given by:

And[sets,..]


"strm,.." is a sequence of StreamObjects that can be joined as one using,
And
[strm,..]
and thereby evaluated in parallel.

 

 

See English definition for "and".

 

(1)                    And[argii,..]

 

...returns True if all of the "argii,.." are True.

Otherwise, Not[True] is returned when the first Not[True]  is encountered in the "argii,..".


 

 

And Logic Matrixes

 

And interprets List arguments as "Logic Matrixes" as follows:

 

(2)                    And[{a1, b1, .., i1}, {a2, b2, .., i2}, ..,{aj, bj, .., ij}]

 

            returns

 

                        {And[a1,a2, .., aj], And[b1, b2, .., bj], .., And[i1, i2, .., ij]}

 

If the List arguments fed to And are not the same length, this AndMatrix will not be elicited.

 

 

CardinalAnd

 

(3)                    Cardinal[And][arg1, arg2,...]

 

...returns the argument position where the first False is encountered, and zero if there is no False element.  Cardinal[And][] returns Noop.



And[sets,..]


The intersection of the PatternSet(s), "...sets...", is created with the And elicitation,

 

(4)                    And[sets,..]

 

...which is a new PatternSet whose elements are in each of the "sets,..".

(4) is set intersection.

(4) is a Logical Pattern Set that presumes a test object (like any PatternSet).



While (4) defines a Logical Pattern Set, it  is not actually a Set.
To construct the actual Set containing all elements matching (4), see IntersectSet.



IntersectSet


And[sets__Set] matches elements in the intersection of sets.
This is distinct from actually generating the Set intersection.
This can be achieved elegantly with Not[Xor][...]  as follows:


SetIntersect[set_Set] = set


SetIntersect[___Set, Set[], ___Set] = Set[]

SetIntersect[set1_Set, set2_Set] = Not[Xor][set1, set2]


SetIntersect[set1_Set, set2_Set, sets__Set] = SetIntersect[SetIntersect[set1, set2], sets]


The code below for IntersectSet[set1, sets,..] constructs the Set intersection (the common subset of all sets) by sequentially testing each element for membership. This is a much less elegant then the functionally equivalent code given above.


intersect[set1, set2] = Cast[{insect=Sequence[]},
Sequence[
    Tally[Sequence[
        If[set1[Slot], Append[insect, Slot]], Noop],
        set2
    ],
    Set[inter]
]]
IntersectSet[set1_Set, sets__Set] = Cast[{inter=set1},
    Tally[
If[
Pattern[Set[]][inter =  intersect[inter, Slot]],

Noop[Tally], Noop],
        sets
    ];
    inter
]

If one of the "sets,.." has no elements in the intersectionIntersectSet[set1_Set, sets__Set] will usually terminate before each element is tested. The algorithm begins by assuming set1 is the intersection set, and then removing elements that prove not to be in the other "sets,..". If any of the "sets,.." share no elements with the others, Set[] (the empty set) is immediately returned.



AndStream

 

If "strm,.." is a Sequence of StreamObjects, then...

 

(5)                                And[strm,..]

 

...joins each StreamObject in ordinal sequence to create a new StreamObject.




English definition of "and"

 

and conj.

1. Expressing the general relation of connection or addition, esp. accompaniment, participation, combination, contiguity, continuance, simultaneity, sequence; thus: along or together with; added to or linked to; as well as; as without ceasing; as at the same time; then; in addition to being; not less truly; -- used to conjoin word with word, phrase with phrase, clasue with clause.  Also, having an implication of:

   a Repetition; as, they rode two and two; hundreds and hundreds.

   b Variation or difference; as, there are women and women, that is, women of different sorts.

   c Logical or semantic modification of one of the connected ideas by the other: (1) In figurative expression, joining elements, one of which logically qualifies the other as, your fair and outward character, that is, outwardly fair character; in poverty and distress, that is, in a distressful state of poverty.

(2) Now colloquially, after certain adjectives which when followed by another adjective become equivalent to adverbs; as, nice and warm, that is, agreeably warm; good and ready, that is, quite ready. 

(3) Now colloquially; between finite verbs the first of which is go, come, try, send, mind, learn, stay, stop, write, the second logically equivalent to an infinitive purpose.

            At least to try and teach the erring soul.       Milton

            [From Websters1949Unabridged.]

 

 


Grok32`

(c) 2004-2007 by
John Van Wie Bergamini

All rights reserved.

 

Related...

 

The newest version of Mathematica also has the following related functions:

{BitAnd, BitOr, BitAnd}.  These functions substitute the interpretation of True/False with 1/0.

 

See Mathematica�s And[...] function.

Hosted by www.Geocities.ws

1