3 ms·
> It's very common to see/use F(F(F...))) paradigms in lambda calculus homework exercises and its more modern/useful derivatives (yes, like Scala) where the rea
by AdieuToLogic 3y ago
> It's very common to see/use F(F(F...))) paradigms in lambda calculus homework exercises and its more modern/useful derivatives (yes, like Scala) where the real "meat" of the logic is the center of this Tootsie Pop.
Agreed. That would be compose in Scala[0]. Or F |> F |> F if using the thrush combinator[1].
> Often times, the function expects a functional type, but we just have an object. Better Factory it up!
Why?
> So at some point down that rabbit hole, you're like "fine, what about a FactoryFactory?"
This is where you jumped the shark. Doing composition by encoding it as a one-off unique type ("<prefix>FactoryFactory") appears to be a "poor man's monad transformer."
Unless, of course, the intent is to just get the change req "down the road."
0 - https://www.scala-lang.org/api/2.13.11/scala/Function1.html#compose[A](g:A=%3ET1):A=%3ER https://www.scala-lang.org/api/2.13.11/scala/Function1.html#...
1 - https://cinish.medium.com/scala-thrush-combinator-77c8c9d9fc67 https://cinish.medium.com/scala-thrush-combinator-77c8c9d9fc...