com.jnape.palatable.lambda.functions.builtin.fn2

## Class Unfoldr<A,B>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn2.Unfoldr<A,B>

- Type Parameters:
    `A` - The output Iterable element type
    `B` - The unfolding function input type
  All Implemented Interfaces:
    Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>>, Fn2<Fn1<? super B,Maybe<Tuple2<A,B>>>,B,Iterable<A>>, Applicative<Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>, Cartesian<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>,Fn1<?,?>>, Cocartesian<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>,Fn1<?,?>>, Contravariant<Fn1<? super B,Maybe<Tuple2<A,B>>>,Profunctor<?,Fn1<B,Iterable<A>>,Fn1<?,?>>>, Functor<Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>, Profunctor<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>,Fn1<?,?>>, Monad<Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>, MonadReader<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>, MonadRec<Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>, MonadWriter<Fn1<? super B,Maybe<Tuple2<A,B>>>,Fn1<B,Iterable<A>>,Fn1<Fn1<? super B,Maybe<Tuple2<A,B>>>,?>>

      public final class Unfoldr<A,B>
      extends Object
      implements Fn2<Fn1<? super B,Maybe<Tuple2<A,B>>>,B,Iterable<A>>

  Given an initial seed value and a function that takes the seed type and produces an ``Maybe`<`Tuple2`<X, Seed>>`, where the tuple's first slot represents the next `Iterable` element, and the second slot represents the next input to the unfolding function, unfold an `Iterable` of `X`s. Returning `Maybe.nothing()` from the unfolding function is a signal that the `Iterable` is fully unfolded.

  For more information, read about Anamorphisms.

  Example:

       Iterable<Integer> zeroThroughTenInclusive = unfoldr(x -> x <= 10
               ? Maybe.just(tuple(x, x + 1))
               : Maybe.nothing(), 0);

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterable<A>` | `checkedApply(Fn1<? super B,Maybe<Tuple2<A,B>>> fn, B b)`
    `static <A,B> Unfoldr<A,B>` | `unfoldr()`
    `static <A,B> Fn1<B,Iterable<A>>` | `unfoldr(Fn1<? super B,Maybe<Tuple2<A,B>>> fn)`
    `static <A,B> Iterable<A>` | `unfoldr(Fn1<? super B,Maybe<Tuple2<A,B>>> fn, B b)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn2

      `apply, apply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, flip, fn2, fromBiFunction, toBiFunction, uncurry, widen`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1

      `andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, zip, zip`

    - ### Methods inherited from interface com.jnape.palatable.lambda.monad.Monad

      `join`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

      `coerce`

- - ### Method Detail

    - #### checkedApply

          public Iterable<A> checkedApply(Fn1<? super B,Maybe<Tuple2<A,B>>> fn,
                                          B b)

      Specified by:
        `checkedApply` in interface `Fn2<Fn1<? super B,Maybe<Tuple2<A,B>>>,B,Iterable<A>>`

    - #### unfoldr

          public static <A,B> Unfoldr<A,B> unfoldr()

    - #### unfoldr

          public static <A,B> Fn1<B,Iterable<A>> unfoldr(Fn1<? super B,Maybe<Tuple2<A,B>>> fn)

    - #### unfoldr

          public static <A,B> Iterable<A> unfoldr(Fn1<? super B,Maybe<Tuple2<A,B>>> fn,
                                                  B b)