Live data from Hacker News

Tacit programming

en.wikipedia.org

1–10 of 95 posts

Re: Tacit programming

#2
Love point-free. It's definitely a muscle you need to keep in shape, and although it's definitely not for everybody, if you design your API with this in mind it can be a lot of fun to program in this style. I think TidalCycles is a nice example of such an API (for the most part)

Re: Tacit programming

#4
Why not translate your code to pointfree style automatically? Using[0], you can go from

  quad a b c = let d = b * b - 4 * a * c in ((-b + sqrt d) / 2 * a, (-b - sqrt d) / 2 * a)
to

  ghci> import Control.Monad
  ghci> quad = ap (ap . ((.) .) . ap (ap . (liftM2 (,) .) . flip (flip . ((*) .) . flip flip 2 . ((/) .) . (. sqrt) . (+) . negate)) (flip (flip . ((*) .) . flip flip 2 . ((/) .) . (. sqrt) . (-) . negate))) (flip ((.) . (-) . join (*)) . (*) . (4 *))
  ghci> quad 1 3 (-4)
  (1.0,-4.0)
[0] https://pointfree.io/

Re: Tacit programming

#7
I love the concept of point-free programming - write your function by simply concatenating the transformations you want.

I just hate reading the resulting code written by others. What information is expected to come in, and exactly what data passes from one step to the next, and in what position? Data type signatures only go so far.

Point-free means you have all that wiring in your head, without assistance from the notation.

Re: Tacit programming

#8
I've never found this style readable unless with pipes (bash / elixir), where I love it. With any other syntax, I find it just adds mental overhead. Maybe because you have to read it backwards?

Re: Tacit programming

#9
Absolutely every single time when I use functional programming, I store my intermediary calls in a variable, specifically because naming that variable forces me to explain what that intermediary result should be.

If the intermediary result makes no sense, and only the function composition makes sense, I'll create a new well named function that does the chaining, even if it's single use.

This is literally the only way I've seen multi-year projects be maintainable, and anything else eventually breaks down into uninteligible code.

Writing code for other developers in the long-run is empathy for yourself, since you'll eventually forget all the context you once had.

Re: Tacit programming

#10

I've never found this style readable unless with pipes (bash / elixir), where I love it. With any other syntax, I find it just adds mental overhead. Maybe because you have to read it backwards?

Pipes in both of the languages you specified do function application, not composition, so they’re very much point-ful (you see the arguments you pass/get passed).
Post reply on HN