Front page | perl.perl6.users |
Postings from January 2020
Range on Subsets
Thread Next
From:
Simon Proctor
Date:
January 28, 2020 15:03
Subject:
Range on Subsets
Message ID:
CAGwa-ji5yZLSE1nf6zq69xZgf=z2-4srZkZhxHbDQvTBFRB2vQ@mail.gmail.com
So some recent conversations covered the Range method on numeric types like
Int
So Int.Range gives the range of valid values -Inf^..^Inf which is neat.
Then I thought I'd try UInt.Range and got 0..^Inf
Ah Ha! Thinks I. I have a plan. What if I try this?
my subset OneToTen of Int where { not .defined or 1 <= $_ <= 10 };
say OneToTen.Range;
And it gives ...
-Inf^..^Inf
And now I'm a bit confused. The Docs say the UInt is just a subset
https://docs.raku.org/type/UInt
So how does it have it's own Range?
--
Simon Proctor
Cognoscite aliquid novum cotidie
http://www.khanate.co.uk/
Thread Next
-
Range on Subsets
by Simon Proctor