FList
- class fpylib.functors.flist.FList(value: Optional[fpylib.types._T] = None)[source]
- apply(lfunc: fpylib.functors.flist.FList[Callable[[fpylib.types._T], fpylib.types._S]]) fpylib.functors.flist.FList[fpylib.types._S][source]
Apply a wrapped function to a wrapped value of the functor.
- Parameters
func – A wrapped function.
- Returns
A wrapped value of the functor.
- bind(func: Callable[[fpylib.types._T], fpylib.types._S]) fpylib.functors.flist.FList[fpylib.types._S][source]
Return a Monad with the result of the given function evaluated with the value of the Monad.
- Parameters
func – The function to evaluate with the value of the Monad.
- Returns
A Monad with the result of the given function evaluated with the value of the Monad.
- fmap(func: Callable[[fpylib.types._T], fpylib.types._S]) fpylib.functors.flist.FList[fpylib.types._S][source]
Apply a function to the value of the functor.
- Parameters
func (Callable[["Functor[T]"], "Functor[S]"]) – The function to apply.
- Returns
A functor with the value of the functor after applying the function.
- unit(value: Optional[Iterable[fpylib.types._T]] = None) fpylib.functors.flist.FList[fpylib.types._T][source]
Return a Monad with the given value.
- Parameters
value – The value to return.
- Returns
A Monad with the given value.
- fpylib.functors.flist.concat(*ls: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.functors.flist.FList[fpylib.types._T][source]
Concatenate two or more FList.
- Parameters
ls – FList to concatenate
- Returns
FList
- fpylib.functors.flist.head(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.types._T[source]
Get the first element of a FList.
- Parameters
l – FList
- Returns
First element of FList
- fpylib.functors.flist.last(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.types._T[source]
Get the last element of a FList.
- Parameters
l – FList
- Returns
Last element of FList
- fpylib.functors.flist.tail(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.functors.flist.FList[fpylib.types._T][source]
Get the all elements of a FList except the first one.
- Parameters
l – FList
- Returns
Tail of FList
- fpylib.functors.flist.init(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.functors.flist.FList[fpylib.types._T][source]
Get all elements of a FList except the last one.
- Parameters
l – FList
- Returns
Tail of FList
- fpylib.functors.flist.uncons(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.functors.maybe.Maybe[Tuple[fpylib.types._T, FList[_T]]][source]
Get the first element of a FList and the rest of the FList.
- Parameters
l – FList
- Returns
First element of FList and the rest of the FList
- fpylib.functors.flist.singleton(x: fpylib.types._T) fpylib.functors.flist.FList[fpylib.types._T][source]
Create a FList with a single element.
- Parameters
x – Element
- Returns
FList
- fpylib.functors.flist.null(l: fpylib.functors.flist.FList[fpylib.types._T]) bool[source]
Verify if a FList is empty.
- Parameters
l – FList
- Returns
True if FList is empty, False otherwise
- fpylib.functors.flist.length(l: fpylib.functors.flist.FList[fpylib.types._T]) int[source]
Get the length of a FList.
- Parameters
l – FList
- Returns
Length of FList
- fpylib.functors.flist.reverse(l: fpylib.functors.flist.FList[fpylib.types._T]) fpylib.functors.flist.FList[fpylib.types._T][source]
Reverse a FList.
- Parameters
l – FList
- Returns
Reversed FList