Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add (performant) abstraction over semilattices #512

Closed
hochgi opened this issue Jan 16, 2019 · 1 comment
Closed

add (performant) abstraction over semilattices #512

hochgi opened this issue Jan 16, 2019 · 1 comment

Comments

@hochgi
Copy link

hochgi commented Jan 16, 2019

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:

def foo[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.

@iravid
Copy link
Member

iravid commented Nov 30, 2019

Closing as this is out-of-scope for ZIO

@iravid iravid closed this as completed Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants