<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 09/28/2015 12:54 PM, Sergej Jurečko
wrote:<br>
</div>
<blockquote
cite="mid:37615BC3-A1BE-4FE3-BCBF-B3837157A4F0@gmail.com"
type="cite">
<div>Are maps ever going to get an iterator? <br>
</div>
</blockquote>
You could use something like this:<br>
<br>
maps_itera(F, A, Map)<br>
when is_function(F, 4) -><br>
Fold = fun(K, V, {Afold, Itr}) -><br>
ItrA = fun(Anew) -> {Anew, Itr} end,<br>
case Itr(K, V, Afold, ItrA) of<br>
{_, Itr} = Iteration -><br>
Iteration;<br>
_ = Last -><br>
exit({maps_itera_last, Last})<br>
end<br>
end,<br>
try maps:fold(Fold, {A, F}, Map) of<br>
{Last, F} -><br>
Last<br>
catch<br>
exit:{maps_itera_last, Last} -><br>
Last<br>
end.<br>
<br>
Then you define a function:<br>
F = fun(K, V, A, Itr) -><br>
% if you want to iterate, call Itr(Anew)<br>
% if you want to stop, just have the last evaluation be Anew<br>
end<br>
<br>
<blockquote
cite="mid:37615BC3-A1BE-4FE3-BCBF-B3837157A4F0@gmail.com"
type="cite">
<div><br>
</div>
<div>Sergej </div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
</body>
</html>