MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: [wish list]: perl stuff
> Somewhat Perly. The ability to reference '[a..b]' as if it were an
> inclusive list of all integers 'a' through 'b'. Like...
>
> if (foo in [5..8])
>
> Rather than...
>
> if ((foo > 4) && (foo < 9))
Better yet, how about builtin support for arbitrary obj/string/int/float
ranges? Something like range(start_value, end_value [, step size])
step_size should be optional and default to one; raise E_TYPE if
start_value and end_value don't have the same value or are of some
type unsupported by range. [Incidentally, someone else has already
requested support for letter ranges such as
for letter in ["a".."z"]
] Then have the statement [start..end] be synonymous with range(start,
end) so that all of the following could work identically:
for letter in ["a".."e"]
for letter in {"a", "b", "c", "d", "e"}
for letter in range("a", "e")
michael
References:
Home |
Subject Index |
Thread Index