<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">You probably should be using lists:filter for K, or better yet a list comprehension. <div class="">lists:dropwhile will stop processing as soon as K returns false.</div><div class=""><br class=""></div><div class="">Sergej<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 21 Feb 2016, at 13:39, fxmy wang <<a href="mailto:fxmywc@gmail.com" class="">fxmywc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important" class=""><font size="4" class="">Hello guys,</font></p><p style="margin:0px 0px 1.2em!important" class=""><font size="4" class="">Just encountered this:<br class="">Erlang/OTP 18 [erts-7.0.3] [source-5991161] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]</font></p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;line-height:1.2em;margin:1.2em 0px" class=""><code class="language-erlang hljs" style="font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);color:rgb(204,204,204);padding:0.5em;display:block!important;background:rgb(45,45,45)"><font size="4" class=""><span class="hljs-variable" style="color:rgb(242,119,122)">Eshell</span> <span class="hljs-variable" style="color:rgb(242,119,122)">V7</span>.<span class="hljs-number" style="color:rgb(249,145,87)">0.3</span> (abort with ^<span class="hljs-variable" style="color:rgb(242,119,122)">G</span>)
<span class="hljs-number" style="color:rgb(249,145,87)">1</span>> <span class="hljs-variable" style="color:rgb(242,119,122)">F</span> = <span class="hljs-keyword" style="color:rgb(204,153,204)">fun</span>(<span class="hljs-variable" style="color:rgb(242,119,122)">_</span>) -> <span class="hljs-literal" style="color:rgb(249,145,87)">true</span> <span class="hljs-keyword" style="color:rgb(204,153,204)">end</span>.
<span class="hljs-record_name">#Fun</span><erl_eval.<span class="hljs-number" style="color:rgb(249,145,87)">6.54118792</span>>
<span class="hljs-number" style="color:rgb(249,145,87)">2</span>> <span class="hljs-variable" style="color:rgb(242,119,122)">K</span> = <span class="hljs-keyword" style="color:rgb(204,153,204)">fun</span>(<span class="hljs-variable" style="color:rgb(242,119,122)">Elem</span>) -> <span class="hljs-variable" style="color:rgb(242,119,122)">Elem</span> > <span class="hljs-number" style="color:rgb(249,145,87)">3</span> <span class="hljs-keyword" style="color:rgb(204,153,204)">end</span>.
<span class="hljs-record_name">#Fun</span><erl_eval.<span class="hljs-number" style="color:rgb(249,145,87)">6.54118792</span>>
<span class="hljs-number" style="color:rgb(249,145,87)">3</span>> lists:dropwhile(<span class="hljs-variable" style="color:rgb(242,119,122)">F</span>, [<span class="hljs-number" style="color:rgb(249,145,87)">1</span>,<span class="hljs-number" style="color:rgb(249,145,87)">2</span>,<span class="hljs-number" style="color:rgb(249,145,87)">3</span>,<span class="hljs-number" style="color:rgb(249,145,87)">4</span>,<span class="hljs-number" style="color:rgb(249,145,87)">5</span>]).
[]
<span class="hljs-number" style="color:rgb(249,145,87)">4</span>> lists:dropwhile(<span class="hljs-variable" style="color:rgb(242,119,122)">K</span>, [<span class="hljs-number" style="color:rgb(249,145,87)">1</span>,<span class="hljs-number" style="color:rgb(249,145,87)">2</span>,<span class="hljs-number" style="color:rgb(249,145,87)">3</span>,<span class="hljs-number" style="color:rgb(249,145,87)">4</span>,<span class="hljs-number" style="color:rgb(249,145,87)">5</span>]).
[<span class="hljs-number" style="color:rgb(249,145,87)">1</span>,<span class="hljs-number" style="color:rgb(249,145,87)">2</span>,<span class="hljs-number" style="color:rgb(249,145,87)">3</span>,<span class="hljs-number" style="color:rgb(249,145,87)">4</span>,<span class="hljs-number" style="color:rgb(249,145,87)">5</span>]
</font></code></pre><p style="margin:0px 0px 1.2em!important" class=""><font size="4" class="">Is this behavior expected?<br class="">Am I missing something?</font></p><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"><font size="4" class=""></font></div><div class=""><br class="webkit-block-placeholder"></div><p style="margin:0px 0px 1.2em!important" class=""><br class=""></p><div style="margin: 0px 0px 1.2em !important;" class=""><br class="webkit-block-placeholder"></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large;display:inline">Cheers,</div><div class=""><br class="webkit-block-placeholder"></div><div style="margin: 0px 0px 1.2em !important;" class=""><br class="webkit-block-placeholder"></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large;display:inline">Fxmy.</div><br class=""><div class=""><br class="webkit-block-placeholder"></div>
<div title="MDH:PGRpdiBjbGFzcz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFtaWx5OiBhcmlhbCwgaGVs
dmV0aWNhLCBzYW5zLXNlcmlmOyBmb250LXNpemU6IGxhcmdlOyI+SGVsbG8gZ3V5cyw8L2Rpdj48
ZGl2IGNsYXNzPSJnbWFpbF9kZWZhdWx0IiBzdHlsZT0iZm9udC1mYW1pbHk6IGFyaWFsLCBoZWx2
ZXRpY2EsIHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTogbGFyZ2U7Ij48YnI+PC9kaXY+PGRpdiBjbGFz
cz0iZ21haWxfZGVmYXVsdCIgc3R5bGU9ImZvbnQtZmFtaWx5OiBhcmlhbCwgaGVsdmV0aWNhLCBz
YW5zLXNlcmlmOyBmb250LXNpemU6IGxhcmdlOyI+SnVzdCBlbmNvdW50ZXJlZCB0aGlzOjwvZGl2
PjxkaXYgY2xhc3M9ImdtYWlsX2RlZmF1bHQiIHN0eWxlPSIiPjxkaXYgY2xhc3M9ImdtYWlsX2Rl
ZmF1bHQiIHN0eWxlPSIiPjxmb250IGZhY2U9ImFyaWFsLCBoZWx2ZXRpY2EsIHNhbnMtc2VyaWYi
IHNpemU9IjQiPkVybGFuZy9PVFAgMTggW2VydHMtNy4wLjNdIFtzb3VyY2UtNTk5MTE2MV0gWzY0
LWJpdF0gW3NtcDo4OjhdIFthc3luYy10aHJlYWRzOjEwXSBbaGlwZV0gW2tlcm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Zm9udCBmYWNl
PSJhcmlhbCwgaGVsdmV0aWNhLCBzYW5zLXNlcmlmIiBzaXplPSI0Ij48YnI+PC9mb250PjwvZGl2
PjxkaXYgY2xhc3M9ImdtYWlsX2RlZmF1bHQiIHN0eWxlPSIiPjxmb250IGZhY2U9ImFyaWFsLCBo
ZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIHNpemU9IjQiPklzIHRoaXMgYmVoYXZpb3IgZXhwZWN0ZWQ/
PGJyPkFtIEkgbWlzc2luZyBzb21ldGhpbmc/PC9mb250PjwvZGl2PjwvZGl2Pg==" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;padding:0px;margin:0px" class=""><font size="4" class=""></font></div></div></div>
_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></div></div></body></html>