Група, до якої ви додаєте допис, - група Usenet. Відтак, будь-хто в Інтернеті бачитиме вашу електронну адресу.
Вашу відповідь не було надіслано.
Ваш допис було надіслано
Групи новин: comp.lang.haskell
Від: Ertugrul Söylemez <e...@ertes.de>
Дата: Sun, 28 Sep 2008 23:14:46 +0200
Локально: Пн 29 Вер 2008 00:14
Тема: Re: Why my list function eats memory?
Paul Graphov <grap...@gmail.com> wrote: The 'iterate' function never stops iterating. Its result is, by > Wow, I's much prettier code than my... > But I don't understand it a bit... > "iterate (drop d)" produces a list of infinite tails. > "map (take n)" takes their prefixes. > But what "takeWhile(not . null)" does in case of infinite input list? definition, an infinite list. This is problematic here, because without the 'takeWhile', 'drop' will happily produce the empty list out of the empty list infinitely, so you will get an infinite result list all the time, even if the argument is a finite list. > If I try to remove "takeWhile(not . null)" the function works the same Honestly I have no idea. This may be a compiler or interpreter issue. > way if i need only a few windows but if i try to get millionth one it > causes stack overflow again. The original version works fine. > How that takeWhile helps? It works without problems for me (GHC 6.8.3), even in interpreter mode. Greets, -- Ви мусите увійти перед публікацією повідомлень.
Аби надіслати допис, будь ласка, спочатку приєднайтеся до цієї групи.
Будь ласка, поновіть своє прізвисько на сторінці налаштування передплати перед тим, як надіслати свій допис.
У вас немає права надсилання дописів до цієї групи.
| ||||||||||||||