determining if a int is a power
Wolfgang Jeltsch
wolfgang at jeltsch.net
Sat Nov 8 15:17:59 EST 2003
Am Samstag, 8. November 2003, 13:13 schrieb Paul Hudak:
> But note that x `seq` x is equivalent to x, even operationally. To see why
> denotationally, note that if x evaluates to _|_, so does x `seq` x. And if
> x evaluates to a value v, so does x `seq` x. To see why operationally,
> consider the two lists:
>
> let x = 1+1 in [x `seq` x]
> let x = 1+1 in [x]
>
> Using conventional lazy evaluation in both cases, the term "1+1" is not
> evaluated until the head of the list is taken. In other words, x `seq` x in
> no way hurries the evaluation of x.
Yes, you are right.
> -Paul
Wolfgang
More information about the Haskell-Cafe
mailing list