> > > > > - generic programming> > > > Rather than repeat the same comment, I'll ask what> > > makes> > > > you think that FP does not support generic> > programming?> > > > > > It does through dynamic typing (probably depends on> the> > > language)> > > > Probably depends what you mean by generic programming.> > > > I was thinking in more specific terms, for example, the> following C++ function is generic:> > template<class T> bool equals(T x, T y) { return x == y;> }> Generic programming is very common in functional languageslike Haskell or ML. In fact generic programming has its roots in FP: Its foundations are System F (Girard/Reynolds 72-74) and the Hindley/Milner system (75), the first well-known language to have adopted it is ML (also around 75). Only 10 years later was generic programming transplanted to imperative languages. One of the first to do so was Eiffel.

> Generic programming is very common in functional> languages> like Haskell or ML. In fact generic programming has its> roots in FP: Its foundations are System F (Girard/Reynolds> 72-74) and the Hindley/Milner system (75), the first> well-known language to have adopted it is ML (also around> 75). Only 10 years later was generic programming> transplanted to imperative languages. One of the first to> do so was Eiffel.

Thanks for the info! I assume from these examples that generic programming requires compile-time checks, so the Scheme version probably would not qualify as generic.

> - all OOP related techniques and principlesDepends on the functional language.

in Common List, CLOS is the defacto OOP library which is a very powerful library.

In Scheme, a common joke is that Scheme programmers know quite a bit about OOP... they have generally implemented it from scratch at least twice and use the version tailored for the problem at hand. Good multi-inheritance OOP models can be implemented in a few lines of code. Most of the time you don't need OOP as closures are more flexible.

OCaml is so OOP it has Object as the first word in it's name.

Haskell is above OOP... type classes are FAR more flexible that asking a Haskell programmer to use traditional OOP is like asking a C++ programmer to stop using inheritance.

> - generic programming

Lots of Generic programming in functional langs. The Lisps typically don't use them because they have dynamic typing, but I know Haskell has a large generic library.

Garbage collection handles alot of this. Most functional languages also have an anagolous mechanism

> - using exemplars or prototype objects to serve as basis> for new objects

Closures. They do all this and more.

> - using function objects

Function objects are a hack to make imperative languages do functional programming things. Having first class objects make "function objects" just silly.

> - defining copy-constructors

These are only needed in imperative languages. The hybrids, like Lisp have similar things. The pure functionals do not need them. Think about it.... if by definition NOTHING is ever mutable, why would you ever need to copy anything. Simply take as many references to the object as you like as you are guaranteed that the object will never change.

So, to answer your question rather than each of your examples, the hybrids (Lisp, Scheme, OCaml, etc..) tend to use techniques from both worlds. The pure languages either don't need the technique that the imperative world uses because the problem the imperative technique is trying to solve is a trivial one, or they use an equivelent technique, or in some cases, the technique that the imperative language uses is impractical in functional paradigms and so they use a completely different and novel technique. Also, just like there are some problems in imperative programming that are so absolutely trivial from a functional perspective (non-synchronized parallel threading for instance) that they aren't even problems, the converse is also true. For instance, in a purely functional language, everything can be done out of order and no side effects are allowed. Writing to a port is a side effect. now imagine this code snippit in a functional language:

print("hello world");print("hello again");

Not only can you not print, but even if you could, you can't print IN THE RIGHT ORDER. This is a (nominally) hard problem in functional programming (solved by monads BTW).