Packages

case class MemoizeLast[-T, +R](f: (T) => R, eq: (T, T) => Boolean = (a: T, b: T) => a == b) extends (T) => R with Product with Serializable

Memoize the last value only. Since its only 1 arg, use yourfunc _ tupled to tuple the arguments. Uses scala == for the test. js semantics for equality are very different. scala provids semantic equality unlike js. An optional eq can be used. In general, you will probably memoize js functions using the react hooks so may not need this memoization utility much.

See also

https://medium.com/musings-on-functional-programming/scala-optimizing-expensive-functions-with-memoization-c05b781ae826

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MemoizeLast
  2. Serializable
  3. Product
  4. Equals
  5. Function1
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new MemoizeLast(f: (T) => R, eq: (T, T) => Boolean = (a: T, b: T) => a == b)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (R) => A): (T) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. def apply(x: T): R
    Definition Classes
    MemoizeLast → Function1
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def compose[A](g: (A) => T): (A) => R
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. val eq: (T, T) => Boolean
  11. val f: (T) => R
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def hits: Long
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def productElementNames: Iterator[String]
    Definition Classes
    Product
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from (T) => R

Inherited from AnyRef

Inherited from Any

Ungrouped