> < ^ Date: Thu, 03 Feb 2000 13:22:12 +1000 (EST)
> < ^ From: Greg Gamble <greg.gamble@math.rwth-aachen.de >
< ^ Subject: Re: for Anweisung

On Wed, 2 Feb 2000, Kurt Ewald wrote:
> Dear GAP
> for i in [1..n] is possible, but is there a way to use
> for i in [n..1], what is in other languages down to
> Merci
> K.Ewald

Dear Kurt,

This is really a RTFM ... there are two ways:

for i in [n, n-1 .. 1] do

or

for i in Reversed([1..n]) do

[n..1] evaluates to the empty list if n > 1 ... which as
evidenced by the function you asked to be debugged, is precisely
what you want, (most of the time) ... it allows for somewhat naive
programming. In my experience, it is the usual convention of algebraic
languages.

  Regards,
  Greg Gamble
___________________________________________________________________
Greg Gamble   __________________        mailto:gregg@csee.uq.edu.au
Centre for Discrete Mathematics & Computing    Tel: +61-7 336 52425
Department of Computer Science                 Fax: +61-7 336 54999
      & Electrical Engineering     http://www.csee.uq.edu.au/~gregg
The University of Queensland, Queensland 4072 AUSTRALIA
___________________________________________________________________

> < [top]