Originally posted by jemfinch:
In my opinion, the ML languages (and Haskell) are far more focused on functional programming than the Lisp languages (Scheme, Common Lisp, etc.) The ML languages (and Haskell; especially Haskell, even

) are _far_ more focused on immutable data structures, one of the very important building blocks of functional programming.
You see, the basis of functional programming is functions, and proper functions don't have side effects -- that's why immutable data structures are so important. Unfortunately, _all_ data structures and variables in Lisp/Scheme are mutable. In ML/Haskell, however, variables can't be rebound, and only references are mutable (O'Caml allows mutable values in records too, but only if they're declared mutable.) Because of this fundamental difference, I think ML/Haskell teach functional programming much better than Lisp/Scheme.
I know you qualified it with "my opinion", but you're wrong
In ML,
no variable or data structure is mutable unless declared so by the programmer or inferred so by the typechecker. In Scheme,
no variable or data structure is mutable unless explicitly mutated by the programmer.
Both languages have impure features, and Scheme is by no means "more impure" than ML. The mechanism for indicating mutation is different: in statically typed ML, the mutable variables and data structures are
exactly those declared so by the programmer or inferred so by the typechecker. In dynamically typed Scheme, the mutable variables and data structures are
exactly those that get mutated during their lifetime.
The distinction is actually present in most sophisticated Scheme compilers. If a variable is not mutated in its scope, then it is immutable, and unboxed and copy propagated.
I think your intuition is something like this: "the set of mutated variables in a Scheme program is possibly the same as the set of all variables". That's true, it is possible, but not necessary. And the exact same thing is true for ML.
And, since the ML typechecker can infer reference types, even the annotations are often missing. What is the set of mutable variables in this function:
Or this one:
code:<HR>
Code:
(lambda (x y) (set! x 5) y)
In Scheme, nobody ever forces a programmer to ever use the impure features (mutation and call/cc). My experience with a whole lot of ML and Scheme code is that programmers in Scheme do not use mutation more (or less) than in ML. And, you can often see code like this (courtesy of another thread here) from newbies in ML:
code:<HR>
Code:
fun foo (ll : int list ref) =
let
val i = ref 0
in
while !i < 5 do (
ll := !i :: !ll;
i := !i + 1
);
()
end
So, Scheme is no less suitable for learning or practicing purely functional programming, provided you have the discipline to avoid the impure features. Exactly the same with ML.
What
is the best language for learning functional programming? Here's my opinion

: the lambda-calculus. Since Scheme without mutation (or call/cc) is a call-by-value lambda calculus, I prefer it over ML without mutation, which is a Damas-Milner (polymorphically typed, but without polymorphic recursion)
typed lambda-calculus.
I've studied and taught functional programming at a university often considered one of the spiritual homes of functional programming, and I prefer to start with the lambda-calculus and later explore the restriction of type systems. Mind you, I usually don't complain about type systems in general, they are excellent engineering tools. But when the stated goal is "to learn functional programming", the restrictions of the type system can sometimes be unacceptable.
(kg*m*m)/(s*s)