8 Jul
2005
8 Jul
'05
2:16 p.m.
Christian Maeder wrote:
Colin Runciman wrote:
buffer xs = foldl const xs xs
I don't find it this easy nor a good programming practise.
My interaction depends on the (subtle order of) evaluation of a pure and total function?
I would not think so much about the operational evaluation order, but about the denotational value of functions. In a non-strict language functions always also accept partially defined arguments (including bottom _|_). What a function returns for partially defined arguments tells you how it can be used in an interactive program. So: buffer _|_ = _|_ buffer (a1:_|_) = _|_ buffer (a1:a2:_|_) = _|_ ... buffer (a1:a2:...:an:[]) = a1:a2:...:an:[] Ciao, Olaf