Sets: Difference between revisions

From NARS2000
Jump to navigationJump to search
(Created page with "<table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> <td val...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<table id="symmetric_difference" border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
   <td>
   <td>
Line 27: Line 27:
<br />
<br />


<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<table id="subset" border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
   <td>
   <td>
Line 55: Line 55:
<br />
<br />


<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<table id="superset" border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
   <td>
   <td>
Line 87: Line 87:
<p>For example,</p>
<p>For example,</p>


<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'miasma'§'sis'<br />
<apll><pre>
mama<br />
      'miasma'§'sis'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'miasma'§⍦'sis' ⍝ Using the Multiset form<br />
mama
mamas<br />
      'miasma'§⍦'sis' ⍝ Using the Multiset form
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'immiss'⊆'mississippi'<br />
mamas
1<br />
      'immiss'⊆'mississippi'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'immiss'⊆⍦'mississippi' ⍝ Using the Multiset form<br />
1
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ⍝ because the # m's doesn't match<br />
      'immiss'⊆⍦'mississippi' ⍝ Using the Multiset form
</apll>
0                             ⍝ because the # m's doesn't match
</pre></apll>

Latest revision as of 14:31, 9 September 2022

Z←L§R returns a vector consisting of the elements of L that are not in R.
L is a scalar or one-element vector.
R is a scalar or one-element vector.
Z is the vector result equivalent to (L~R),R~L.


Z←L⊆R returns a Boolean scalar indicating whether or not L is a subset of R.
L is a scalar or one-element vector.
R is a scalar or one-element vector.
Z is the Boolean scalar result equivalent to ∧/L∊R as well as R⊇L.


Z←L⊇R returns a Boolean scalar indicating whether or not L is a superset of R.
L is a scalar or one-element vector.
R is a scalar or one-element vector.
Z is the Boolean scalar result equivalent to ∧/R∊L as well as R⊆L.


These functions behave differently when invoked via the Multiset Operator which takes into account multiplicities.

For example,

      'miasma'§'sis'
mama
      'miasma'§⍦'sis' ⍝ Using the Multiset form
mamas
      'immiss'⊆'mississippi'
1
      'immiss'⊆⍦'mississippi' ⍝ Using the Multiset form
0                             ⍝ because the # m's doesn't match