HN user

wfdctrl

38 karma
Posts0
Comments13
View on HN
No posts found.

You can get the same effect if you model the expression as a free algebra (ADT). You can then simplify the terms in the same way. The paper: "The design of a pretty printing library", by Hughes, explains this nicely.

The main difference is that algebras are more natural in FP and coalgebras in OOP, but they can mostly do the same things, just a bit differently. Actually you can also do algebras in OOP as well (visitor pattern) and coalgebras is FP.

Basically my point was that you should use the simplest abstraction that gets the job done. Even if you implemented max and pow as objects, for your specific use case, you would probably just call the pure functions inside.

Thank you for the book recommendation.

Why not make max or pow an object then? If you can model something as a pure function, then it should be a function. You can always add memorization later, if needed. OOP is fundamentally different from FP, objects are not just higher order functions, they are also coalgebras. There is no need to force every peg into a coalgebra hole.

A Sad Day for Rust 7 years ago

If you don't understand how opensource works don't use it. If you paid nothing you are not a client and nobody owes you anything...

What about a completely pointless "support the project" license? So you basically chip in for the maintenance, but don't get any additional rights?