[m-dev.] Adding Loops to Mercury

Ben Schmidt schmidtb at student.unimelb.edu.au
Thu Jan 2 18:00:40 AEDT 2014


On 2/01/14 1:41 PM, John Adams wrote:
> Is there or plan (maybe already done) to add loops to Mercury Language?
>
> Visual Prolog has loops of the form:
>
> foreach I=std::fromTo(1,1000) do
>     %...whatever
> end foreach.

Maybe I'm just dumb but this seems very out of character and I do not
understand how such a construct would work. Consequently I have a number
of questions.

- What are the semantics of this structure? Could you provide a more
   full/working example, or a link to Visual Prolog documentation? E.g.
   What goes in the place of "%...whatever"? A goal? How are unbound
   variables in "whatever" interpreted?
- What is the purpose of the structure? Could you provide an example of
   how this construct is useful?

Ben.






More information about the developers mailing list