[Haskell-cafe] Re: Processing of large files
Tomasz Zielonka
t.zielonka at students.mimuw.edu.pl
Thu Nov 4 03:54:34 EST 2004
On Thu, Nov 04, 2004 at 11:44:32AM +0300, Alexander Kogan wrote:
> Ok.
> I have 2 questions about this:
> 1. This means seq function evaluates only 'top' of argument, so when I pass,
> for example, list as argument, it will be evaluated only to [unevaluated,
> unevaluated, ...]? Am I right?
Almost. [...] is a syntactic sugar. List is defined by an algebraic data
type:
data [a] = (:) a [a] | []
seq'ing a list will only force the topmost constructor, ie:
unevaluated : unevaluated
or
[]
or
_|_
Note that the things marked 'unevaluated' above, could be already
evaluated by some other computation.
> 2. If so, is there method to _completely_ evaluate expression?
Most of the time you don't need it. But if you think you do, search
for DeepSeq. I think that Data.Generics could be also used for that.
Best regards,
Tom
--
.signature: Too many levels of symbolic links
More information about the Haskell-Cafe
mailing list