On 15 May 2005 02:50:38 -0700, Xah Lee <[EMAIL PROTECTED]> wrote:
> Here's the Perl code.
Where did you learn to program? Its highly unlikely that a Perl
programer would ever write a range function as there is a built in
Perl function that does the same thing. If your intent is purely
accedemic
Xah Lee wrote:
> the previous posted solutions are badly botched.
> def Range(iMin, iMax=None, iStep=None):
[snip hideous code]
> # Thanks to Peter Hansen for a correction.
Ohmigod, he's only made it worse and he's blaming me for it. Shows what
I get for replying to a cross-posted troll messag
the previous posted solutions are badly botched.
Here's a better solution. Any further correction will appear on the
website instead. (http://xahlee.org/tree/tree.html)
Similar change needs to be made for the Perl code... Java code will
come tomorror.
By the way, the code from me are not expecte
Xah Lee wrote:
> Here's the Python solution.
> # implementation note: When iStep is a decimal, rounding error
> # accumulates. For example, the last item returned from
> # Range(0,18,0.3) is 17.7 not 18. A remedy is to turn iStep into a
> # fraction and do exact arithmetics, and possibly convert th
Here's the Python solution.
--
# -*- coding: utf-8 -*-
# Python
# http://xahlee.org/tree/tree.html
# Xah Lee, 2005-05
# implementation note: When iStep is a decimal, rounding error
# accumulates. For example, the last item returned from
# Range(0,18,0.3) is 17.7 not 18. A remedy is to tu
Here's the Perl code.
--
#! perl
# http://xahlee.org/tree/tree.html
# Xah Lee, 2005-05
#_ Range _ _ _ _
=pod
B
Range($iMax) generates the list [1, 2, ... , $iMax].
Range($iMin, $iMax) generates the list [$iMin, ... , $iMax].
Range($iMin, $iMax, $iStep) uses incr