16

Functional programming is folding my brain.

Comments
  • 5
    I prescribe Brainfuck to unfold it.
  • 5
    Looks like your code isn't pure then...
  • 5
    Is it a left fold or a right fold?
  • 1
  • 1
    Something's not right. It's supposed to fold itself to the cause, not your brain!
  • 4
    It gets way easier!

    As a suggestion, take your time to learn it and if you need it, try to just apply it’s core rules to a regular language (purity of functions especially), without going for a perfect implementation but rather seeing how it can be helpful in its rules!
  • 3
    I feel that, i read about Arrow(s) as opposed to Monad(s)... reread it a few times, still didnt quite "get it". I mean the basics of FP are simple but some of the FP abstractions get super academic and reasearchy. All haskell, math, and in an academic paper

    And then you have OOP where, its problems aside, explanations of the design patterns are readily available and easy to understand.
  • 2
    @brittle you don't have to go that route. Look at Scheme/Racket, Standard ML, OCaml, F#, Erlang etc. for FP that isn't super academic (or pure for that matter, but ehh). And with enough experience, you'll start inventing patterns yourself without naming them or knowing that they're "standard", and *then* when you read about Arrow or Functor or Applicative or Monad or whatever it'll just click.

    Practically from a programing viewpoint Monad is a design pattern just like the OOP ones, but on steroids because of how incredibly abstract they are compared to ye olde OOP pattern. Don't try to grok them without putting in the work of gaining experience programming the functional way, it'll just feel pointless. Imagine trying to teach Observer or Command or Visitor to someone who just learnt what a method is.
  • 0
    @RememberMe Im familiar with Monad but was trying to understand Arrow and how i might go about implementing something like that in typescript for like... learning purposes. Came across the academic paper that introduced the abstraction and well.....

    I think it was this one
    https://doi.org/10.1016%2FS0167-642...
  • 1
    Smooth brains are bad
Add Comment