What does FP do well? (was How to get functional software engineering experience?)

Bjorn Lisper lisper@it.kth.se
Thu, 16 May 2002 16:23:31 +0200 (MET DST)


Karl-Filip:
>But what I really meant is, if I may rephrase it, that imperative 
>programs might often be both faster and harder to write because they
>embed more information about the abblication domain. That is, if you 
>code in C and want an array, you must specify its size, so you have to 
>think about your program and figure out that you only need 'x' items
>here, wheras in Haskell you'd use a list and never have to think about 
>what the upper bound on the length of the list is.

Yes indeed. But sometimes the length of a list being returned from a
function can be a simple function of the function arguments (or the sizes of
the arguments), think of map for instance. In such cases, a static program
analysis can sometimes find the length function. If we know thee functions
for all list-producing functions in a closed program, then the lists could
be represented by arrays rather than linked structures.

I know Christoph Herrmann worked on such a program analysis some years
ago. Also, I think Manuel Hermenegildo has done this for some logic
language.

Could sized types be used for this purpose? (I must find myself some time to
read Lars Pareto's PhD thesis...)

Björn Lisper