Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
Observer effect (physics) https://en.wikipedia.org/wiki/Observer_effect_(physics) In physics, the observer effect is the theory that the mere observation of a phenomenon inevitably changes that phenomenon ... An especially unusual version of the observer effect occurs in quantum

Re: range doc page

2020-01-28 Thread William Michels via perl6-users
Todd, are you looking for a range smartmatch, or possibly the ".in-range" method (Rakudo-only, below)? > my $u = 248 248 > say (-128..127).in-range($u); Value out of range. Is: 248, should be in -128..127 in block at line 1 > my int8 $v = 0xF8; -8 > say (-128..127).in-range($v); True > "In

Re: range doc page

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 13:36, William Michels via perl6-users wrote: Todd, are you looking for a range smartmatch, or possibly the ".in-range" method (Rakudo-only, below)? my $u = 248 248 say (-128..127).in-range($u); Value out of range. Is: 248, should be in -128..127 in block at line 1 my

Re: range problems

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 08:27 Trey Harris wrote: > On Mon, Jan 27, 2020 at 23:57 ToddAndMargo via perl6-users < > perl6-users@perl.org> wrote: > >> Hi Al, >> >> Now what am I doing wrong? >> >> > my Int $u = 0xF8; say $u.Range; >> >> Invocant of method 'Range' must be a type object of >> type

Range on Subsets

2020-01-28 Thread Simon Proctor
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

Re: Range on Subsets

2020-01-28 Thread Vadim Belman
UInt is just being handled individually by the core. You can override method Range by either mixin a role into your subset base type: constant MyInt = Int but role { method Range { 1...10 } }; subset OneToTen of MyInt where ...; Or by subclassing Int: class MyInt is Int { method Range { ... }

Re: range doc page

2020-01-28 Thread Curt Tilmes
I blame the English language for some of this. The docs and error messages are actually quite precise and correct as far as they go. The problem comes in my head, when I see the words "Blah type object", I think "an object of type Blah", which I think is a reasonable decoding given the way

Re: Range on Subsets

2020-01-28 Thread Tobias Boege
On Tue, 28 Jan 2020, Simon Proctor wrote: > 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.

Re: range problems

2020-01-28 Thread Trey Harris
On Mon, Jan 27, 2020 at 23:57 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi Al, > > Now what am I doing wrong? > > > my Int $u = 0xF8; say $u.Range; > > Invocant of method 'Range' must be a type object of > type 'Int', not an object instance of type 'Int'. > Did you forget a

Re: range doc page

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 01:07 Kevin Pye wrote: > There's no need to ask essentially the same question three times. > And I answered before noticing there was more activity in another thread. > https://docs.raku.org/routine/range > is quite clearly the

Re: range doc page

2020-01-28 Thread Trey Ethan Harris
Oops, rereading what I sent I see I missed looping back to one detail: On Tue, Jan 28, 2020 at 08:54 Trey Harris wrote: > In Perl5, undefinedness meant something that it still _can_ mean, and in > the course of ordinary “business logic” programming perhaps still most > often means: a

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 18:09 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Observer effect (physics) > https://en.wikipedia.org/wiki/Observer_effect_(physics) > > In physics, the observer effect is the theory that > the mere observation of a phenomenon inevitably >

Re: "Three-valued" logic (was Re: range doc page)

2020-01-28 Thread Trey Ethan Harris
On Tue, Jan 28, 2020 at 19:11 William Michels wrote: > Agreed. Thank you Trey! > > Trey (or anyone else in the know), when Perl6 was developed, was there > any consideration given to implementing pure "three-valued" (Kleene or > Priest) logical operators, similar to SQL and/or R ? Just curious.

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 16:30, Trey Harris wrote: On Tue, Jan 28, 2020 at 19:06 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-01-28 15:37, Trey Harris wrote: > > > On Tue, Jan 28, 2020 at 18:09 ToddAndMargo via perl6-users >

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 19:58 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 16:56, Trey Harris wrote: > > In other words—yes, you want Raku to attempt to provoke a segmentation > > fault, then recover and tell you whether it faulted or not. > > Huh? I just want to

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 20:32 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 17:17, Trey Harris wrote: > > On Tue, Jan 28, 2020 at 20:04 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-01-28 17:00, Trey Harris wrote: > >

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 18:34, Trey Harris wrote: And that’s another thing: you’ll notice if you define a `my uint8 $x;` it will be set to 0. No undefined, no Nil. That doesn’t happen with non-native numeric values. Huh. I thought is as nil. > my uint $x; say $x.base(2) 0

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 21:18 Trey Harris wrote: > Nope. If I give you: > > 0x41 > > and tell you that’s a single octet, and that’s all you have, and I and ask > you whether that’s an “A” or a decimal 97 or something else described by > 0101, how do you answer? You can’t. > Sorry, editing

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
Question: in those instance where I ONLY want to play with 8,16, or 32 BITS and have Raku leave whatever pattern I put in them along, what is the best thing to declare them as?

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 18:41, Trey Harris wrote: On Tue, Jan 28, 2020 at 21:18 Trey Harris > wrote: Nope. If I give you: 0x41 and tell you that’s a single octet, and that’s all you have, and I and ask you whether that’s an “A” or a decimal 97 or something else

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 22:03 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > Hi Trey, > > Any chance of you sneaking in on the doc pages > for ^name and range to explain the things you > explained to me? For `.^name`—I suppose, though I’m not sure what would be appropriate

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 15:37, Trey Harris wrote: On Tue, Jan 28, 2020 at 18:09 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: Observer effect (physics) https://en.wikipedia.org/wiki/Observer_effect_(physics)      In physics, the observer effect is the theory that

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 19:06 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 15:37, Trey Harris wrote: > > > > > > On Tue, Jan 28, 2020 at 18:09 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > Observer effect (physics) > >

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 16:56, Trey Harris wrote: In other words—yes, you want Raku to attempt to provoke a segmentation fault, then recover and tell you whether it faulted or not. Huh? I just want to know what the variable actually is. I do not wnat to crash anything.

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 19:55 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 16:52, Trey Harris wrote: > > On Tue, Jan 28, 2020 at 19:46 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > > my uint $u= 0xFF44; say $u.^name > > Int >

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 17:00, Trey Harris wrote: On Tue, Jan 28, 2020 at 19:58 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-01-28 16:56, Trey Harris wrote: > In other words—yes, you want Raku to attempt to provoke a segmentation > fault, then recover and

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
Ah You got ‘int’—lowercase ‘int’, not uppercase ‘Int’?? I didn’t see that example and I can’t find it scrolling back. Would you repost it, please? That would change things (and possibly indicate a bug). > my uint $u= 0xFF44; say $u.^name Int It was upper case Int. Again, wrong answer.

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 20:59 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > > > Ah You got ‘int’—lowercase ‘int’, not uppercase ‘Int’?? I didn’t see > > that example and I can’t find it scrolling back. Would you repost it, > > please? That would change things (and possibly

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 21:18 Trey Harris wrote: > values, such as 'undefined' and 'Nil' as well as its type. > > And that’s another thing: you’ll notice if you define a `my uint8 $x;` it will be set to 0. No undefined, no Nil. That doesn’t happen with non-native numeric values. > Nope. If I

Re: stolen uint's

2020-01-28 Thread Trey Harris
For doing that sort of thing, learning a little glue C would probably be very useful (IMO, every systems-oriented programmer is helped immensely by knowing enough C to be able to munge low-level data structures). This is a lovely little example of a numeric library using native arithmetic where

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 16:52, Trey Harris wrote: On Tue, Jan 28, 2020 at 19:46 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: > my uint $u= 0xFF44; say $u.^name Int Wrong answer It’s absolutely the right answer. You autoboxed it by running a method—`.^name`—on it. A

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 20:04 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 17:00, Trey Harris wrote: > > On Tue, Jan 28, 2020 at 19:58 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > On 2020-01-28 16:56, Trey Harris wrote: > >

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 17:17, Trey Harris wrote: On Tue, Jan 28, 2020 at 20:04 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 2020-01-28 17:00, Trey Harris wrote: > On Tue, Jan 28, 2020 at 19:58 ToddAndMargo via perl6-users > mailto:perl6-users@perl.org>

"Three-valued" logic (was Re: range doc page)

2020-01-28 Thread William Michels via perl6-users
Agreed. Thank you Trey! Trey (or anyone else in the know), when Perl6 was developed, was there any consideration given to implementing pure "three-valued" (Kleene or Priest) logical operators, similar to SQL and/or R ? Just curious. https://en.wikipedia.org/wiki/Three-valued_logic

Re: stolen uint's

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 19:46 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > > my uint $u= 0xFF44; say $u.^name > Int > > Wrong answer > It’s absolutely the right answer. You autoboxed it by running a method—`.^name`—on it. A uint can’t respond to `.^name`, so you can never get

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 18:18, Trey Harris wrote: my uint $z = -32; 224 Another misunderstanding on my part. I thought it would barf. All I really need to know is what is expected. To me I am getting wrong answers back, but as long as they are consistent answers I can deal with it: if

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
Hi Trey, Any chance of you sneaking in on the doc pages for ^name and range to explain the things you explained to me? I am a little odd in that I actually try to use the manual pages. But there may be other out there too. (Because I do not like the way the manual pages are written, does not

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 18:57, Trey Harris wrote: For doing that sort of thing, learning a little glue C would probably be very useful (IMO, every systems-oriented programmer is helped immensely by knowing enough C to be able to munge low-level data structures). This is a lovely little example of a

Re: stolen uint's

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 18:57, Trey Harris wrote: For doing that sort of thing, learning a little glue C would probably be very useful (IMO, every systems-oriented programmer is helped immensely by knowing enough C to be able to munge low-level data structures). This is a lovely little example of a

Re: range doc page

2020-01-28 Thread Veesh Goldman
That was one of the most illuminating things I have ever read. Thank you for taking the time to write that. On Tue, Jan 28, 2020, 16:12 Trey Ethan Harris wrote: > Oops, rereading what I sent I see I missed looping back to one detail: > > On Tue, Jan 28, 2020 at 08:54 Trey Harris wrote: > >> In

Re: range doc page

2020-01-28 Thread ToddAndMargo via perl6-users
No I am really confused: What part of my int8 $u = 0xF8; $u.range is not following method range(--> Range:D) ?

Re: range doc page

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 15:06 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 2020-01-28 11:59, Trey Harris wrote: > > > > > > On Tue, Jan 28, 2020 at 14:55 ToddAndMargo via perl6-users > > mailto:perl6-users@perl.org>> wrote: > > > > No I am really confused: > > > > What

Re: range doc page

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 15:13 Trey Harris wrote: > (And, in case you were unaware, _every_ page in the /routine/... doc tree > is autogenerated from content elsewhere; those headers and links are added > to get you back to the context where the content canonically appears.) > And I just

Re: range doc page

2020-01-28 Thread Trey Harris
Sorry to keep replying to myself... On Tue, Jan 28, 2020 at 15:13 Trey Harris wrote: > All core class Exception objects, as a matter of convention, start with > `X::`. > ...to which a natural question arises: what about non-core Exception objects? Raku lets you call Exceptions whatever you

Re: range doc page

2020-01-28 Thread ToddAndMargo via perl6-users
On 2020-01-28 11:59, Trey Harris wrote: On Tue, Jan 28, 2020 at 14:55 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: No I am really confused: What part of      my int8 $u = 0xF8; $u.range is not following      method range(--> Range:D) ?

Re: range doc page

2020-01-28 Thread Trey Harris
On Tue, Jan 28, 2020 at 14:55 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > No I am really confused: > > What part of > > my int8 $u = 0xF8; $u.range > > is not following > > method range(--> Range:D) > > ? > Unless you’re getting the line `method range(--> Range:D)`

Re: stolen uint's

2020-01-28 Thread Veesh Goldman
Hi Todd, I'd just like to point out one thing. Your confusion here (and in a few related posts) is that you aren't grokking the difference between uint and UInt. Please correct me if I'm wrong. But if there needs to be an update to docs, it probably should be to a document that clarifies the