It also comes to my mind that you can use something similar to regular expressions and parsing, seeing your list as a word made of Int elements. I think you can achieve it using Parsec or attoparsec.<div>One you define your basic combinators for &#39;odd&#39;, you can see your sublist as the minimal part of the list matching</div>

<div>(even* odd)(even* odd)(even* odd)(even* odd)</div><div><br><div class="gmail_quote">2012/9/25 Ivan Lazar Miljenovic <span dir="ltr">&lt;<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 25 September 2012 16:51, Magicloud Magiclouds<br>
<div class="im">&lt;<a href="mailto:magicloud.magiclouds@gmail.com">magicloud.magiclouds@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt; &nbsp; For example, I have an array [0..]. Now I want to take a sub list<br>
&gt; that starts from index 0, and only contain 4 odds, and is minimum<br>
&gt; result. The answer should be [0, 1, 2, 3, 4, 5, 6, 7].<br>
<br>
</div>If you have listTest :: [a] -&gt; Bool, then head . dropWhile (not .<br>
listTest) . inits ?<br>
<div class="im HOEnZb"><br>
&gt; &nbsp; How to do that? Combining lazy computing, I cannot figure out an<br>
&gt; efficient algorithm.<br>
&gt; --<br>
&gt; 竹密岂妨流水过<br>
&gt; 山高哪阻野云飞<br>
&gt;<br>
&gt; And for G+, please use magiclouds#<a href="http://gmail.com" target="_blank">gmail.com</a>.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br>
<br>
<br>
</div><span class="HOEnZb"><font color="#888888">--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>