[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
In-place update
> > > Doesn't haskell 98 allow in place updating e.g; for records?
> >
> > [see next message]
> >
> I have read this message and now I have the following question:
> Does this mean that a compiled program written in a strict functional
> language will be faster than the "same" program compiled with thelazy
> functional language Haskell 98
No, a strict language has exactly the same problem. It's generally a "problem" for all (pure) functional languages... just like in mathematics. It makes no sense in mathematics to write "x=x+1"; you always write something like "x(2)=x(1)+1". It's the same in a pure functional language.
It does however mean that programs written in this style in a functional language will perform slower than programs written in a similar style in an imperative language. This doesn't necessarily mean there isn't a better way to write it in the functional language, just that the algorithm in your favourite algorithms book is tuned for C rather than Haskell.
HTH.
--KW 8-)
--
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
: (and recently of the University of Glasgow, Scotland. [><] ) :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S. :
: http://www.cl.cam.ac.uk/users/kw217/ mailto:kw217@cl.cam.ac.uk :
:---------------------------------------------------------------------: