You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, given a "join" function that is commutative and associative, we can optimize computation by re-ordering the application of that function over a sequence of elements.
here's an example to clarify what I mean:
deffoo[A](as: Seq[A])(f: (A,A) =>A):A
This can obviously be implemented as a.reduce(f), but it means the order of computation cannot be changed. Think about the matrix chain multiplication problem for instance.
(actually, matrix multiplication is associative, but not commutative, so not a 1:1 example, but you get the idea, and maybe there is a way to define an abstraction for that as well)
disclaimer: I'm not very familiar with scalaz. this issue was suggested to me by @jdegoes, and I will be happy to provide any further details or a more detailed example.
The text was updated successfully, but these errors were encountered:
I describe an aspect of the problem in a blog post:
https://blog.hochgi.com/2019/01/fp-ish-patterns.html?view=classic
In general, given a "join" function that is commutative and associative, we can optimize computation by re-ordering the application of that function over a sequence of elements.
here's an example to clarify what I mean:
This can obviously be implemented as
a.reduce(f)
, but it means the order of computation cannot be changed. Think about the matrix chain multiplication problem for instance.(actually, matrix multiplication is associative, but not commutative, so not a 1:1 example, but you get the idea, and maybe there is a way to define an abstraction for that as well)
disclaimer: I'm not very familiar with scalaz. this issue was suggested to me by @jdegoes, and I will be happy to provide any further details or a more detailed example.
The text was updated successfully, but these errors were encountered: