Comment

Comment by loup-vaillant

Verb vs nouns. Well, what are objects in OO? They're things that do this, and change that… This is a lot about what objects do, and what we do to them. On the other hand, in FP, one "does" only one thing: create new values. There is a lot of verbs in FP, but they don't do anything… Anyway, I guess I'll need to review that.

Instruction sequence vs Expression tree It's jot just Lisp. Ocaml and Haskell apply as well. We don't manipulate the syntax tree, but it doesn't mean it isn't there. For instance, the following is a valid Ocaml or Haskell expression:

  if condition
  then foo
  else bar (if condition2
            then baz
            else wiz)
This is not unusual code. Here is the C equivalent:

  condition
  ? foo
  : bar(condition2 ? baz : wiz)
This is a tree of nested expressions.

Functions as ordinary mathematical objects. I'm just saying that functions belong to the bucket of mathematical objects. As are integers. And sets. And lists… "First class" just mean we treat them as such. From https://en.wikipedia.org/wiki/First-class_function

> In languages with first-class functions, the names of functions do not have any special status; they are treated like ordinary variables with a function type.

parent loup-vaillant 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton