ZipList
funstruct.applicative.ziplist
ZipList — a list with element-wise applicative semantics.
Examples:
>>> from funstruct.applicative.ziplist import ZipList
>>> ZipList([1, 2, 3]).map(lambda x: x * 10)
ZipList([10, 20, 30])
>>> ZipList([lambda x: x + 1]).ap(ZipList([9]))
ZipList([10])
>>> ZipList([lambda x: x + 1, lambda x: x * 2]).ap(ZipList([10, 20]))
ZipList([11, 40])
>>> ZipList([1, 2]) * ZipList([3, 4])
ZipList([(1, 3), (2, 4)])
ZipList
Bases: DataType, Generic[_A]
List with element-wise applicative.
Source code in funstruct/applicative/ziplist/__init__.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |