Functionally and parenthetically curious

As geeks are want to do I oft end up in the pub talking programming, philosophy, etc. In the course of these conversations things are said which people disagree with, that’s just to be expected.

I have a habit of going home following such a discussion and researching the answers to any questions which are still bothering me and then emailing the conversations parties.

This morning it occurred that this information might be remotely interesting to my reader (my future self) so I thought I’d post them here and send the parties a link. Here goes:

While talking Scheme, ML, etc. Neil asked “What is the definition of Functional Programming?”. So I reach for my (largely unread) Hutton book:

“What is functional programming? Opinions differ, and it is difficult to give a precise definition. Generally speaking, however, functional programming can be viewed as a style of programming in which the basic method of computation is the application of functions to arguments. In turn, a functional programming language is one that supports and encourages the functional style.”

A question which was first triggered by my statement “Scheme is a functional programming language”. For which I quote the Scheme language definition (R6RS):

“Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including functional, imperative, and message passing styles, find convenient expression in Scheme.”

That settles that, then.

2 comments

  1. Ok, thanks, that makes sense. So Scheme is more designed for functional programming than C, same as C++ is more object-oriented than C, but that doesn’t mean you can’t do either style of programming in any of the languages. I was thinking a functional language needs to be like Haskell where (if I understand correctly) it is impossible to write a function that has side effects.

    1. I believe what you’re thinking is correct so long as you change the impossible in “is impossible to write a function that has side effects” to more difficult.
      My understanding is that you can write code however you want in most languages, including Haskell, but that they encourage a particular style.

Comments are closed.