Re:Show HN: A JavaScript function that looks and behaves lik...
by ranting-moth on Wednesday September 27, 2023 @09:55AM
(#37674690)
>The following example code is a bit hard to read:
No it's not hard to read.
This cursed abomination is a joke isn't it?
[ Parent
| on HN ]
Re:Show HN: A JavaScript function that looks and behaves lik...
by erez on Wednesday September 27, 2023 @10:29AM
(#37675177)
Someone decided to create a solution and then started looking for problems that will fit it. Finding none, they invented one.
Re:Show HN: A JavaScript function that looks and behaves lik...
by pphysch on Wednesday September 27, 2023 @12:29PM
(#37677153)
For some reason I was compelled to click on your profile and noted that this your first comment after 7 years of inactivity. Welcome back
Re:Show HN: A JavaScript function that looks and behaves lik...
by FroLeMageBlanc on Wednesday September 27, 2023 @10:18AM
(#37675035)
Is functional programming a joke? YMMV...
Re:Show HN: A JavaScript function that looks and behaves lik...
by guntherhermann on Wednesday September 27, 2023 @10:21AM
(#37675074)
I don't think the first example is less pure than the second, what makes you think it is?
Re:Show HN: A JavaScript function that looks and behaves lik...
by FroLeMageBlanc on Wednesday September 27, 2023 @10:44AM
(#37675381)
Purely functional programming is a subset of functional programming (see F# for instance). I was referring to the pipe operator syntax common to many functional programming languages like Haskell, F#, OCaml, Elixir, Elm and so on...
Re:Show HN: A JavaScript function that looks and behaves lik...
by guntherhermann on Wednesday September 27, 2023 @10:47AM
(#37675435)
Ok, you aren't arguing for 'pure' functional programming, but I think you have sidestepped my question, then:
The pipe operator is just one part of functional programming, composing and applying functions
`f(g(x))` is still functional, and I would argue it exactly what is happening in the first example.
Re:Show HN: A JavaScript function that looks and behaves lik...
by nlarew on Wednesday September 27, 2023 @11:54AM
(#37676559)
Nobody said the first example _isn't_ functional. The point is that function composition f(g(x)) is very common in a functional paradigm and many functional languages have added a Pipeline operator as syntactic sugar for this use case.
Re:Show HN: A JavaScript function that looks and behaves lik...
by guntherhermann on Thursday September 28, 2023 @09:12AM
(#37689152)
Nobody explicitly said it wasn't functional, but the original question was "why would you do b (the 'V' shit), instead of a?" ('is this a joke?'), and the response was "well if you care about functional programming you would!" ('is functional programming a joke?'), which is heavily implying that the first example is not functional! (or 'less' functional)
That you don't recognise that is strange to me, and if after my explanation you can't understand that, I don't know what to tell you.
Re:Show HN: A JavaScript function that looks and behaves lik...
by FroLeMageBlanc on Thursday September 28, 2023 @09:32AM
(#37689361)
If you can’t understand the difference between pure (no side effects) and functional (applying and composing functions), I don’t know what to tell you.
Re:Show HN: A JavaScript function that looks and behaves lik...
by guntherhermann on Thursday September 28, 2023 @09:46AM
(#37689542)
English isn't your first language, so I understand your confusion throughout this thread.
It's not a problem, don't worry about it you will get there. Enjoy your day!