Skip to content

Commit

Permalink
update immutable list docs & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Apr 19, 2020
1 parent c167f3d commit d06c5b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -30,6 +30,8 @@ A semigroup generalizes a monoid in that there might not exist an identity eleme
It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, this the name semigroup.
### [Lazy](#lazy-1)
Lazy are data-types that store functions. Stored function will not be called until call of bind method
### [ImmutableList](#immutable-list-1)
Implementation of list data structures with immutable methods
### [Task](#task-1)
Task are data-type for handle execution of functions (in lazy way) transform results of this function and handle errors.
### [Try](#try-1)
Expand Down Expand Up @@ -222,6 +224,18 @@ print(value1, value2)
# 42, 42
```

## ImmutableList
Implementation of list data structures with immutable methods
```python
lst = ImmutableList.of(1, 2, 3)

lst.map(increase) # ImmutableList.of(2, 3, 4)
lst.filter(lambda item: item % 2 == 0) # ImmutableList.of(2)
lst.find(lambda item: item % 2 == 0) # 2
lst.map(increase) # ImmutableList.of(2, 3, 4)
lst.reduce(lambda acc, curr: acc + curr, 0) # 6
```


## Task
Task are data-type for handle execution of functions (in lazy way) transform results of this function and handle errors.
Expand Down
4 changes: 2 additions & 2 deletions docs/immutable_list.rst
Expand Up @@ -7,7 +7,7 @@ ImmutableList
from pymonet.immutable_list import ImmutableList
from pymonet.utils import increase
=
lst = ImmutableList.of(1, 2, 3)
lst.map(increase) # ImmutableList.of(2, 3, 4)
Expand All @@ -17,4 +17,4 @@ ImmutableList
.. autoclass:: pymonet.immutable_list.ImmutableList
:members: __add__, of, empty, to_list, length, append, map, filter, unshift, find
:members: __add__, of, empty, to_list, length, append, map, filter, unshift, find, reduce

0 comments on commit d06c5b2

Please sign in to comment.