Re: intermixed types and resulting types

2021-08-30 Thread Brad Gilbert
The multi infix:<+>( \a, \b ) candidate is the one that accepts non Numeric values. What it does is try to convert the two values into Numeric ones, and then redispatch using those values. If either one produces an error instead of a Numeric, that error is passed along. On Mon, Aug 30, 2021 at 9

Re: intermixed types and resulting types

2021-08-30 Thread Ralph Mellor
On Sun, Aug 22, 2021 at 4:59 PM yary wrote: > > "How would you know what types are compatible for a particular operation?" > > inspecting a routine's arguments. Bingo. > The first couple candidates raise questions for me > > multi($x = 0) - how is there a single-arg candidate for an infix operat

Re: intermixed types and resulting types

2021-08-22 Thread yary
"How would you know what types are compatible for a particular operation?" Operations are functions so the question is the same as "How would you know what types are compatible for a particular function" which gets to inspecting a routine's arguments. This SO page helped me figure that out https:

Re: intermixed types and resulting types

2021-08-21 Thread Patrick R. Michaud
On Sat, Aug 21, 2021 at 12:50:21PM -0700, Joseph Brenner wrote: > But then, in a case like this one, how would you know in advance > that it would work, without Just Trying It: > > my @monsters = < godzilla grendel wormface blob >; > my $cool_monsters = < godzilla ghidra mothera >.Set; >

Re: intermixed types and resulting types

2021-08-21 Thread Joseph Brenner
References: In-Reply-To: toddandma...@zoho.com wrote: > If you go to https://docs.raku.org/ and look up your variable, > scroll down and look for "type graph", it will tell you what > your variable is a member of. Yes, that's right. For any particular case, you could check the type graphs and

Re: intermixed types and resulting types

2021-08-20 Thread ToddAndMargo via perl6-users
On 8/20/21 6:14 PM, Joseph Brenner wrote: There are some object types that are "compatible" in certain ways, for example: o You can do arithmetic operations on any Numeric types, a Rat minus and Int just works (and gives you a Rat). o You can do set operations on any of the Quant

intermixed types and resulting types

2021-08-20 Thread Joseph Brenner
There are some object types that are "compatible" in certain ways, for example: o You can do arithmetic operations on any Numeric types, a Rat minus and Int just works (and gives you a Rat). o You can do set operations on any of the QuantHash types (and some other things, like A