pymonad.list
index
/usr/home/jason/Files/projects/pymonad/pymonad/list.py

Implements the List monad.
 
The List monad is frequently used to represent calculations with
non-deterministic results, that is: functions which return more than
one (possible) result. For example, calculating how chess pieces might
move.
 
  Example:
    def knight_move(position):
        # calculates a list of every possible square a knight could move
        # to from it's current position
        return ListMonad(position_1, position_2, ..., position_N)
 
    # A list containing every square a knight could reach after 3 moves.
    three_moves = (List
                   .insert(initial_position) # However positions are defined.
                   .then(knight_move)
                   .then(knight_move)
                   .then(knight_move))

 
Modules
       
pymonad

 
Functions
       
ListMonad(*elements: List[~T]) -> pymonad.list._List[~T]
Creates an instance of the List monad.
 
Args:
  *elements: any number of elements to be inserted into the list
 
Returns:
  An instance of the List monad.

 
Data
        Any = typing.Any
Callable = typing.Callable
List = typing.List
S = ~S
T = ~T
Union = typing.Union