[Haskell-beginners] Doubts about functional programming paradigm
Dan Stromberg
strombrg at gmail.com
Mon Dec 14 02:28:07 UTC 2015
On Sun, Dec 13, 2015 at 4:02 PM, Imants Cekusins <imantc at gmail.com> wrote:
> > The foldl builds up a very long expression and evaluates it after the
> last element of the list is reached (the evaluation is non-strict, or
> lazy). If you use foldl' (from Data.List) instead, the calculation is done
> per element (the evaluation is strict).
>
> Is it possible to write a wrapping function (if it does not already exist)
> which would analyze inputs and apply appropriate fold (foldl, foldl',
> foldr, foldr') or safeguard (return Left warning) against following the
> 10Gb ram route - if this can be avoided?
>
I know next to nothing about Haskell, but I suspect this would require
knowing whether a list is finite or infinite, which may be equivalent to
"the halting problem" - IOW, not possible in general in a finite amount of
time.
--
Dan Stromberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151213/688b6519/attachment.html>
More information about the Beginners
mailing list