Semigroups¶
from pymonet.semigroups import All, First, Map, Sum
All(True).concat(All(False)) # All<False>
All(True).concat(All(True)) # All<True>
All(True) == All(True) # True
All(True) == All(False) # False
ingredient1 = Map({'score': Sum(1), 'won': All(True), 'captain': First('captain america')})
ingredient2 = Map({'score': Sum(2), 'won': All(True), 'captain': First('iron man')})
ingredient1.concat(ingredient2) # Map<{'score': Sum(3), 'won': All(True), 'captain': First('captain america')}>
-
class
pymonet.semigroups.
All
(value)¶ All is a Monoid that will combine 2 values of any type using logical conjunction on their coerced Boolean values.
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-
concat
(semigroup: pymonet.semigroups.All) → pymonet.semigroups.All¶
-
-
class
pymonet.semigroups.
One
(value)¶ One is a Monoid that will combine 2 values of any type using logical disjunction OR on their coerced Boolean values.
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pymonet.semigroups.
First
(value)¶ First is a Monoid that will always return the first, value when 2 First instances are combined.
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pymonet.semigroups.
Last
(value)¶ Last is a Monoid that will always return the lastest, value when 2 Last instances are combined.
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pymonet.semigroups.
Map
(value)¶ Map is a Semigroup that will always return contated all values inside Map value
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pymonet.semigroups.
Max
(value)¶ Max is a Monoid that will combines 2 numbers, resulting in the largest of the two.
-
__init__
(value)¶ Initialize self. See help(type(self)) for accurate signature.
-