Yes, chop can be easily written in terms of unfoldr.  But the chop function fits better with other existing list functions, like I tried to illustrate with my examples.<div><br></div><div>  -- Lennart<br><br><div class="gmail_quote">
On Tue, Dec 14, 2010 at 10:40 AM, Stefan Holdermans <span dir="ltr">&lt;<a href="mailto:stefan@vectorfabrics.com">stefan@vectorfabrics.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Henning,<br>
<div class="im"><br>
&gt;&gt; I would like to propose the following function for inclusion in Data.List<br>
&gt;&gt; chop :: (a -&gt; (b, [a]) -&gt; [a] -&gt; [b]<br>
&gt;&gt; chop _ [] = []<br>
&gt;&gt; chop f as = b : chop f as&#39;<br>
&gt;&gt;   where (b, as&#39;) = f as<br>
<br>
<br>
</div><div class="im">&gt; Is the difference between &#39;unfoldr&#39; and &#39;chop&#39; just the Maybe result type of f?<br>
<br>
<br>
</div>Yes.<br>
<br>
  chop f = unfoldr g<br>
    where<br>
      g [] = Nothing<br>
      g as = Just (f as)<br>
<br>
Cheers,<br>
<font color="#888888"><br>
  Stefan</font></blockquote></div><br></div>