[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a functional language be sequential?




On Sunday, June 1, 2003, at 12:40 PM, Michael St . Hippolyte wrote:

>
> The constructions in such sequences obey the constraints of a
> function in functional programming as I understand them (i.e.,
> no mutable variables and no side effects), and I don't see how
> putting functions in an ordered list would change this.  But
> the functional languages I've seen all seem to avoid any hint
> of sequential programming.  Is this simply a point of style,
> or does allowing sequences of functions disqualify a language
> from being called functional?

If your functions have no side effects or mutable variables, then the 
order that independant functions execute is irrelevant. A function's 
output depends only on its inputs, not what other functions have run 
(unless one of those functions is an input). So the question is why do 
you order your functions if it doesn't matter? A functional language's 
interpreter is free to reorder the evaluations. The number of possible 
evaluation orders is the number of permutations of the topological sort 
of the graph. The result should be the same in all cases.

-- 
--- james mccartney   james@audiosynth.com   <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language for 
MacOS X.