notjack
2021-10-5 07:22:51

I would say that the core ideas of functional programming are higher order functions and first class functions


jcoo092
2021-10-5 07:34:48

I have never come up with a better summary. In fact, generally whatever I come up with can be proven incorrect via counterexample. As in, I might say “X is true for all functional programming.” And then later realise that X is not true with Y, yet Y is FP.


kellysmith12.21
2021-10-5 07:45:37

As an addendum to @notjack’s answer, even ideas from Object-Oriented programming (including objects!) can be seen in functional programming. Note that most Lisps have an object system, OCAML has an object system, and Haskell’s lazy evaluation allows for making immutable objects.


markus.pfeiffer
2021-10-5 08:45:37

Maybe one needs to roll out Familiy Resemblance (as attributed to Wittgenstein).

(and yes I hate myself for brigning that up)


markus.pfeiffer
2021-10-5 08:46:14

"[It] argues that things which could be thought to be connected by one essential common feature may in fact be connected by a series of overlapping https://en.wikipedia.org/wiki/Similarity_(philosophy)\|similarities, where no one feature is common to all of the things."


spdegabrielle
2021-10-5 10:12:08

Not a decription, but this book takes a functional programming approach, only addressing state in the second section on python https://dcic-world.org/2021-08-21/index.html


seanbunderwood
2021-10-5 11:36:06

I enjoyed the book Grokking Simplicity. It’s very basic, but I think Normand’s way of framing it might be just the thing for helping someone who’s new to FP to understand what it has to offer.


seanbunderwood
2021-10-5 11:42:26

The tricky thing is, that’s also like half of Smalltalk, which got here first.

I tend to like the core idea in John Backus’s paper where he originally introduced the idea. For him, I think that FP was much more about what you don’t do. For example, he explicitly said Lisp was not FP, and I think that might be fair. Depending on how you define it, of course, you could argue that FP didn’t come to the Lisp family until Scheme brought it home for dinner.


ben.knoble
2021-10-5 11:51:40

What a syllabus… made me want to teach in a group like that


seanbunderwood
2021-10-5 11:56:13

It’s been a while since I read the paper, but, as I recall, he was 100% about referential transparency. Higher-order programming was just a useful implication of that goal.


ben.knoble
2021-10-5 11:59:44

I dont tend to say “a language is fp”. I might say a lang is functional, supports fp, or has functional concepts. Fp for me is about how you structure programs. And yes, immutability (or an illusion of it), first-class and higher-order functions, and a separation of data (“state”) and manipulation of that data are core elements to me. A program (or subsection thereof) is a functional one. Im not sure how helpful it is to say a lang is fp without really meaning it supports fp, in which case we can talk about degrees of support, but almost any general purpose lang can have elements of this to a degree. Even object-based languages without hof can have hop, if you take an object and call a method on it as a function parameter and return an object with a method as a functional return. /pedantic?


seanbunderwood
2021-10-5 12:16:55

I think it depends on how far you want to go. There’s a spectrum of ways of thinking about it that corresponds to a spectrum of goals you might be trying to achieve.

If I can flog Backus a bit more, one of the ideas he was pushing toward was that there’s a certain level of fluently reasoning about and manipulating the code that gets a lot easier for both the programmer and the compiler if you can ban some features from the language entirely. If you’re trying to get all the way out to that extreme, I think even Haskell might be an iffy applicant. It still permits a pretty imperative style if programming if you really want to. Take a look at the Haskell source code for Make a Lisp, for example.


laurent.orseau
2021-10-5 12:22:07

Next topic to be discussed: What characterizes a dynamic typing programming language? :stuck_out_tongue:


seanbunderwood
2021-10-5 12:26:23

Getting yelled at on Hacker News.


anything
2021-10-5 13:58:09

Thank you. For the record, the paper seems to be “Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs”, 1978.


markus.pfeiffer
2021-10-5 14:20:26

and why is Haskell superior.


massung
2021-10-5 14:26:19

> and why is Haskell superior https://imgflip.com/i/5pc8no


jcoo092
2021-10-6 03:12:58

I remember seeing a talk by Bob Martin (the ‘Uncle Bob’ guy) where he mentioned Structure &Interpretation of Computer Programs, and stated that they don’t use mutation in the book until something like 200 pages in. Then, at that point, apparently they spend half a page talking about what a terrible sin they are about to commit.

(I’m still yet to read through SICP, so I don’t know how true that is)