Yes,<br><br>robert<br><br><div><span class="gmail_quote">On 11/01/2008, <b class="gmail_sendername">Dominic Williams</b> <<a href="mailto:erlang@dominicwilliams.net">erlang@dominicwilliams.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Doug,<br><br>> Does lists:filter(Pred, List1) -> List2<br>><br>> guarantee to return the filtered items in List2<br>> in the same relative order as unfiltered List1?<br><br>If you check the code of lists.erl
, you'll find filter/2 is<br>implemented using a list comprehension:<br><br>filter(Pred, List) when is_function(Pred, 1) -><br> [ E || E <- List, Pred(E) ].<br><br>List comprehensions definitely preserve order.
<br><br>Regards,<br><br>Dominic Williams<br><a href="http://dominicwilliams.net">http://dominicwilliams.net</a><br><br>----<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">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>