David Green wrote:
my $foo is limited(100..200);
$foo = 5; # really does $foo = 100
Where does that MySQ smell come from?
Why not undef (or NaN)?
--
Ruud
On Tue, Feb 24, 2009 at 11:16 AM, Ruud H.G. van Tol rv...@isolution.nl wrote:
David Green wrote:
my $foo is limited(100..200);
$foo = 5; # really does $foo = 100
Where does that MySQ smell come from?
Why not undef (or NaN)?
How about Failing instead of any of
Alternately, if you want a purer FP solution:
sub infix:clamp is looser(infix:..) (Num $x, Range $r) {
given $x {
when $x $r.min { $r.min }
when $x $r.max { $r.max }
default { $x }
}
}
...
take $foo clamp 100..200;
On 2009-Feb-23, at 11:30 pm, Carl Mäsak wrote:
For what it's worth, I write a lot of Perl 6, and I'm already used
to it.
OK. Of course, you might be smarter than the average coder, but I
agree it's not a huge deal.
On 2009-Feb-24, at 9:29 am, Mark J. Reed wrote:
On Tue, Feb 24, 2009 at
On Tuesday, 24. February 2009 07:30:05 Carl Mäsak wrote:
my $foo is limited(100..200);
$foo = 5; # really does $foo = 100
Sounds like a good idea for a CPAN module. You can already do
something similar with the subset keyword, though:
subset Percentage of Int
On 2009-Feb-23, Jonathan Worthington posted to Rakudo.org:
Applied a patch from bacek++ to get min= and max= working ($foo
min= 100 will assign 100 to $foo if it's smaller than what is in
$foo).
Nice -- except I first read that backwards, i.e. even though it
follows straight from the
David (), Jonathan on Rakudo.org ():
Applied a patch from bacek++ to get min= and max= working ($foo min=
100 will assign 100 to $foo if it's smaller than what is in $foo).
Nice -- except I first read that backwards, i.e. even though it follows
straight from the definition of [op]=, it made