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. def andThen[A](g: (R) => A): (T) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  2. def apply(x: T): R
    Definition Classes
    MemoizeLast → Function1
  3. def compose[A](g: (A) => T): (A) => R
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  4. val eq: (T, T) => Boolean
  5. val f: (T) => R
  6. def hits: Long
  7. def productElementNames: Iterator[String]
    Definition Classes
    Product
  8. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any