Live data from Hacker News

Common combinators in JavaScript

gist.github.com

1–10 of 55 posts

Re: Common combinators in JavaScript

#3
This site embodies everything I dislike about functional programming: an attitude that shorter and less specific is better.

What use is a line like

    const S = f => g => x => f(x)(g(x));
for anyone except someone who already groks what the S combinator does and is for?

Why do these combinators have single-letter names anyway? Does that help anyone? Even Haskell, heaven on earth for single-letter guess-what-i-mean coders, has actual names for half of these - how is knowing that "flip" is also "the C combinator" helpful in any way?

Now, I'm not trying to diss this page in particular, and I very much am not trying to diss functional programming. I like functional programming. But I think that when hype shifted from OOP to FP, we threw half the baby out with the bathwater (ok, maybe a quarter baby). Naming is important and FP does not have any feature in particular that makes "I" a better name than "identity".

I think programming in general, and FP in particular, will become a better place if we all grow up a bit and stop pretending we're too smart to need good naming.

Re: Common combinators in JavaScript

#4
post #3

This site embodies everything I dislike about functional programming: an attitude that shorter and less specific is better. What use is a line like const S = f => g => x => f(x)(g(x)); for anyone except someone who already groks what the S combinator does and is for? Why do these combinators have single-letter names anyway? Does that help anyone? Even Haskell, heaven on earth for single-letter guess-what-i-mean coder…

This is an implementation of combinatory logic and nothing to do with functional programming.

https://en.wikipedia.org/wiki/Combinatory_logic

Re: Common combinators in JavaScript

#7
post #3

This site embodies everything I dislike about functional programming: an attitude that shorter and less specific is better. What use is a line like const S = f => g => x => f(x)(g(x)); for anyone except someone who already groks what the S combinator does and is for? Why do these combinators have single-letter names anyway? Does that help anyone? Even Haskell, heaven on earth for single-letter guess-what-i-mean coder…

For perspective: this is maths, not programming. You learn about these combinators in your typical lambda calculus course at uni.

It's a fun POC to actually represent it in code, not a serious proposal for production grade software.

Re: Common combinators in JavaScript

#8
post #2

Is there a reason why functional programming algebra insists on using one letter identifiers?

Mathematicians insist on one-grapheme identifiers, partly due to tradition and aesthetics, and partly because at some point juxtaposition came to represent multiplication, so what xy means would be ambiguous.

Re: Common combinators in JavaScript

#9
This is so beautiful it's hard to look at. God. I just want to lock myself in a room for a month and let my mind fully absorb the gooey rainbow colored goodness that gushes out of it and covers everything in delicious tasting goo.

Re: Common combinators in JavaScript

#10
post #3

This site embodies everything I dislike about functional programming: an attitude that shorter and less specific is better. What use is a line like const S = f => g => x => f(x)(g(x)); for anyone except someone who already groks what the S combinator does and is for? Why do these combinators have single-letter names anyway? Does that help anyone? Even Haskell, heaven on earth for single-letter guess-what-i-mean coder…

[deleted]
Post reply on HN