top | item 41160593

(no title)

timruffles | 1 year ago

> nowadays every 16-year-old web-dev reaches for Array.map(x => <div>{x}</div>) when they write their pages in the most popular framework. These higher-order functions have now become part of the “hello world”

It's just wrong to ascribe the popularisation of HOFs like `map` to Haskell. `map` was there in good old (practical) Lisp 1.5 back in the 1960s. Why ascribe this to Haskell (released 1990) rather than Lisp? Guido said Python v1 (1994) got HOFs "courtesy of (I believe) a Lisp hacker who missed them"[1], Ruby had blocks in V1 (1995). Haskell's research direction was not about very, very old news like HOFs, it was about non-strict evaluation, and cool type system stuff.

[1] https://www.artima.com/weblogs/viewpost.jsp?thread=98196

discuss

order

roenxi|1 year ago

I would assume that most of the popular high-order functions came from the lisp world; 16 year web devs are using Javascript which took more than a bit of inspiration from the lisps.

That said, to really squeeze the most out of HOFs the language probably needs a well developed type system. I've noticed with untyped code that at some point HOFs start becoming hard to write because the layers of abstraction get confusing in a way that static analysis would be helpful with. Although my lesson there is to not go overboard with HOFs - if I need static analysis to write working code it is probably too clever to understand by reading it! The Haskell community might succeed in proving that view wrong, but until then...

techhazard|1 year ago

> I've noticed with untyped code that at some point HOFs start becoming hard to write because the layers of abstraction get confusing […]

I have the same with Nix (from NixOS).

It’s a really nice idea to have a functional language that compiles to a working linux installation, but those abstract functions can get really complicated, especially when I return to something I wrote six months ago.

It makes me really miss Rust’s type system…

bazoom42|1 year ago

JavaScript almost certainly got map, filter, reduce, some, every, etc from Lisp.

Scheme is specifically mentioned as an inspiration in the spec.