lists:dropwhile do drop while fun is true so fun K is false for first member than nothing is dropped out.<br><br>1> K= fun(X) -> X<4 end.<br>#Fun<erl_eval.6.49591080><br>2> lists:dropwhile(K,[1,2,3,4,5,6,7,8]).<br>
[4,5,6,7,8]<br><br><div class="gmail_quote">On Thu, May 1, 2008 at 12:42 PM, catsunny <<a href="mailto:catsunny@gmail.com">catsunny@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
Hope I am not ask silly questions. I am new to erlang. So it's probably my<br>
mistake.<br>
The following is what I did:<br>
<br>
13> K=fun<br>
13> (X) when X>4 -><br>
13> true;<br>
13> (X) when X==4 -><br>
13> true;<br>
13> (X) when X<4 -><br>
13> false<br>
13> end<br>
13> .<br>
#Fun<erl_eval.6.13229925><br>
14> lists:dropwhile(K,[1,2,3,4,5,6,7,8]).<br>
[1,2,3,4,5,6,7,8]<br>
15> K(1).<br>
false<br>
16> K(55).<br>
true<br>
<br>
At prompt line 14, I hope the return value to be [1,2,3], but it's<br>
[1,2,3,4,5,6,7,8]. Why?<br>
<br>
Thanks.<br>
<font color="#888888">Catsunny<br>
2008-05-01<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil