Package cs2030s.fp

Class Memo<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Actually<T> value  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Memo​(Constant<? extends T> c)  
      protected Memo​(T v)  
    • Constructor Detail

      • Memo

        protected Memo​(Constant<? extends T> c)
      • Memo

        protected Memo​(T v)
    • Method Detail

      • from

        public static <T> Memo<T> from​(T v)
      • from

        public static <T> Memo<T> from​(Constant<? extends T> v)
      • get

        public T get()
        Overrides:
        get in class Lazy<T>
      • combine

        public <R,​S> Memo<R> combine​(Memo<? extends S> other,
                                           Combiner<? extends R,​? super T,​? super S> combiner)
      • transform

        public <R> Memo<R> transform​(Immutator<? extends R,​? super T> f)
        Description copied from interface: Immutatorable
        The method to produce another container with immutated element.
        Specified by:
        transform in interface Immutatorable<T>
        Overrides:
        transform in class Lazy<T>
        Type Parameters:
        R - the return type
        Parameters:
        f - The immutator.
        Returns:
        A new container containing the immutated element.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Lazy<T>