[m-dev.] Adding Loops to Mercury
Julien Fischer
jfischer at opturion.com
Thu Jan 2 18:20:27 AEDT 2014
On Thu, Jan 2, 2014 at 5:50 PM, Michael Day <mikeday at yeslogic.com> wrote:
> Hi Paul,
>
>
> foreach I=std::fromTo(1,1000) do
>>> %...whatever
>>> end foreach.
>>>
>>
>> I think that such a feature would be considered "not in the spirit of
>> Mercury" by most developers.
>>
>
> Light syntax and efficient compilation for lambdas is enough:
>
> foreach(1 `..` 100, func(X) = blah)
Which is pretty much already supported, e.g.
map(func(X) = X * 2, 1 `..` 100)
(Use a quantifier like foreach seems like the wrong name to use
for some that is transform the list of integers using a function.)
Cheers,
Julien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/developers/attachments/20140102/5cff13a0/attachment.html>
More information about the developers
mailing list