# List operations: (reverse range) (SERVER mods)

David Whitten (whitten@netcom.com)
Wed, 16 Aug 1995 15:47:25 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    >
    > At 11:27 AM 8/16/95 PDT, anomaly@u.washington.edu wrote:
    > >While we're revising ranges for lists and strings, we might as well revise
    > >the ranges in for-loops as well, as suggested by someone (sorry, forgot who)
    > >in a previous post:
    >
    > [much snippage, before and after]
    >
    > And one more for loop wish..
    >
    > for i in [10..1]
    >
    > instead of
    >
    > for i in [1..10]
    >   tmp = 11 - i ;

    I personally don't like this.  If we have a 'implicit decrementing' loop,
    I'd like to see a different keyword, like

    for i from [10..1]

    so the MOOlang can recognize what we are saying..

    another interesting idea would be to borrow from poplog:

    for i on ({list}) (where list = {e1,e2,e3...en} )

    iteration  value of i

        1		{e1..en}
        2		{e2..en}
         ...
        n		{en}

    this is useful in some list processing code, but it probably can be simulated
    with standard moo operations.

    myself, I would like some easy way of knowing the 'iteration number'
    that I'm currently on. when I use code like:

    for i in ({list})

    I many times need to know what index i'm at. so I code:

    counter=0;
    for i in  ({list})
    counter=counter+1;

    I can't use (counter= i in {list})  since the same element may appear
    twice in the list.

    it would be nice to have :

    for i in ({list}) count i_counter

    or something like that...

    On another topic, with the discussion of FABLE, (which I haven't heard much
    about recently)  will the 'future enhancements' be done by Pavel or should
    we form a MOO_cabal to keep development going forth on MOOlang and
    MOOserver ?

    David (whitten@netcom.com) (rocky on Immaterial Park: sun1.gwent.ac.uk 8888)