Skip to content

Commit

Permalink
Or
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmatech committed Nov 6, 2014
1 parent d77a6bb commit 4e66424
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Symbolism/Symbolism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,29 @@ public MathObject Substitute(MathObject a, MathObject b)
}
}

public class Or : Function
{
MathObject OrProc(params MathObject[] ls)
{
if (ls.Any(elt => (elt is Bool) && (elt as Bool).val)) return new Bool(true);

if (ls.All(elt => (elt is Bool) && (elt as Bool).val == false)) return new Bool(false);

var obj = new Or();

obj.args = new List<MathObject>(ls);

return obj;
}

public Or(params MathObject[] ls)
{
name = "Or";
args = new List<MathObject>(ls);
proc = OrProc;
}
}

public class Sin : Function
{
MathObject SinProc(params MathObject[] ls)
Expand Down

0 comments on commit 4e66424

Please sign in to comment.