Re: Numeric Semantics

2007-01-30 Thread TSa
HaloO, Luke Palmer wrote: When do we do integer/rational math and when do we do floating point math? Since we have now flooring semantics on modulus and division I wonder how the coercion of nums to ints takes place. Does it also use floor? E.g. is @array[-0.3] accessing the last element or

Re: Numeric Semantics

2007-01-30 Thread Larry Wall
Note: it would be good to break multiple questions into separate threads with different subjects for those of us who use threaded mail readers, so I will answer each of these with a different subject. Larry

Negative fraction subscripts

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 06:02:59PM +0100, TSa wrote: : HaloO, : : Luke Palmer wrote: : When do we do integer/rational math and when do we do floating point math? : : Since we have now flooring semantics on modulus and division I wonder : how the coercion of nums to ints takes place. Does it also

Typology of auto*crement

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 06:02:59PM +0100, TSa wrote: : Another integer issue is how the ++ and -- operators behave. Do they : coerce to int before the operation or do they keep nums as nums? : E.g. : : my $x = 3.25; : $x++; # 4.25 or 4? : $x = -2.25; : $x--; # -3.25 or -4 or -3? Since

Numeric (non)typology of string positions

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 06:02:59PM +0100, TSa wrote: : BTW, are character positions integers or can we have fractional : characters on a higher unicode level that is a sequence of lower : level chars? Unfortunately this is a units problem where the units are not of fixed length. StrPos is

Int-to-Num autocoercion

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 06:02:59PM +0100, TSa wrote: : How are coercions handled when calling functions? : : sub identity ( Int $i ) { return $i } : : my Num $x = 3.25; : : say indentity($x); # prints 3 or type error? Or even 3.25? : : I'm opting for type error on the footing that Int :

[svn:perl6-synopsis] r13549 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 12:11:00 2007 New Revision: 13549 Modified: doc/trunk/design/syn/S09.pod Log: Disabled negative subscript dwimmery for all shaped arrays. * can now take + and - operators. Modified: doc/trunk/design/syn/S09.pod

[svn:perl6-synopsis] r13550 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 12:20:47 2007 New Revision: 13550 Modified: doc/trunk/design/syn/S09.pod Log: Another idea for *+ vs *- in subscripts Modified: doc/trunk/design/syn/S09.pod == ---

Re: [svn:perl6-synopsis] r13549 - doc/trunk/design/syn

2007-01-30 Thread TSa
HaloO, [EMAIL PROTECTED] wrote: + The lower +right corner of a two dimesional array is C@array[*-1, *-1]. That should read @array[*-1; *-1], or not? --

Re: [svn:perl6-synopsis] r13549 - doc/trunk/design/syn

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 08:25:37PM +0100, TSa wrote: : HaloO, : : [EMAIL PROTECTED] wrote: : + The lower : +right corner of a two dimesional array is C@array[*-1, *-1]. : : That should read @array[*-1; *-1], or not? Right you are. Though that makes me wonder if a multidimensional Whatever (**)

[svn:perl6-synopsis] r13551 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 12:31:16 2007 New Revision: 13551 Modified: doc/trunk/design/syn/S09.pod Log: Braino spotted by TSa++ Modified: doc/trunk/design/syn/S09.pod == --- doc/trunk/design/syn/S09.pod

Re: Int-to-Num autocoercion

2007-01-30 Thread TSa
HaloO Larry, you wrote: Num-to-Int autocoercion is an explicit exception built into the language. Perl 5 programmars would lynch us if we broke it. But yes, it's basically cheating. In your array subscript reply you conceded that flooring is better behaved than truncation. Which would mean

[svn:perl6-synopsis] r13552 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 13:11:37 2007 New Revision: 13552 Modified: doc/trunk/design/syn/S09.pod Log: typo from [particle]++ Modified: doc/trunk/design/syn/S09.pod == --- doc/trunk/design/syn/S09.pod

Re: [svn:perl6-synopsis] r13550 - doc/trunk/design/syn

2007-01-30 Thread TSa
HaloO, [EMAIL PROTECTED] wrote: +Alternately, C*+0 is the first element, and the subscript dwims +from the front or back depending on the sign. That would be more +symmetrical, but makes the idea of C* in a subscript a little more +distant from the notion of all the keys, which would be a

Re: [svn:perl6-synopsis] r13550 - doc/trunk/design/syn

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 09:29:03PM +0100, TSa wrote: : HaloO, : : [EMAIL PROTECTED] wrote: : +Alternately, C*+0 is the first element, and the subscript dwims : +from the front or back depending on the sign. That would be more : +symmetrical, but makes the idea of C* in a subscript a little more

Re: Negative fraction subscripts

2007-01-30 Thread Jonathan Lang
Larry Wall wrote: TSa wrote: : Luke Palmer wrote: : When do we do integer/rational math and when do we do floating point math? : : Since we have now flooring semantics on modulus and division I wonder : how the coercion of nums to ints takes place. Does it also use floor? : E.g. is @array[-0.3]

Enhancing array indices

2007-01-30 Thread Jonathan Lang
Could we get a single-character symbol that could be used in an array index to refer to its shape in a dwimmy way? Something like: @x[*.head] @x[*.tail] # equivalent to @x[*] @A[*.head+2, *.tail-1] (where head and tail are methods of the shape that return the current dimension's start and

Re: Negative fraction subscripts

2007-01-30 Thread Nicholas Clark
On Tue, Jan 30, 2007 at 09:23:33AM -0800, Larry Wall wrote: Since -0.0 is a possible Num representation, that last one probably works. But @array[-0] probably doesn't, since Int probably doesn't represent -0, Well, it might just be using 1's complement :-) Nicholas Clark

Re: Negative fraction subscripts

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 02:19:01PM -0800, Jonathan Lang wrote: : It's the sort of thing that I could see using a trait for: 'my @array : but oroborus' would invoke an implicit modulus on the index, while : standard arrays would not. Likewise, those who don't want the : backward-indexing semantics

Re: Negative fraction subscripts

2007-01-30 Thread Jonathan Lang
Larry Wall wrote: Um, negative indices on shaped arrays were outlawed several hours ago... Yeah; I hadn't gotten around to that when I posted this. Sorry about that. -- Jonathan Dataweaver Lang

Re: Enhancing array indices

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 02:54:26PM -0800, Jonathan Lang wrote: : Could we get a single-character symbol that could be used in an array : index to refer to its shape in a dwimmy way? Something like: : : @x[*.head] : @x[*.tail] # equivalent to @x[*] : @A[*.head+2, *.tail-1] : : (where head and

Re: Enhancing array indices

2007-01-30 Thread Larry Wall
On Tue, Jan 30, 2007 at 03:47:34PM -0800, Larry Wall wrote: : This mornings up date proposed Now the da rn spam fi1ters are chang.ng my spelling to look like sp*m. Yeah, that's the 4icket... :) Larry

Re: Int-to-Num autocoercion

2007-01-30 Thread Darren Duncan
At 9:07 PM +0100 1/30/07, TSa wrote: BTW, does floor return an Int or a Num? A floor() returns an Int of course, because by definition floor() returns an integer. See http://en.wikipedia.org/wiki/Floor_function for an explanation. Same with ceiling(), and some other operators. If

Re: Enhancing array indices

2007-01-30 Thread Darren Duncan
At 12:11 PM -0800 1/30/07, [EMAIL PROTECTED] wrote: Log: Disabled negative subscript dwimmery for all shaped arrays. * can now take + and - operators. At 2:54 PM -0800 1/30/07, Jonathan Lang wrote: Could we get a single-character symbol that could be used in an array index to refer to its

[svn:perl6-synopsis] r13553 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 18:40:29 2007 New Revision: 13553 Modified: doc/trunk/design/syn/S03.pod Log: Various suggestions by Nick++ Modified: doc/trunk/design/syn/S03.pod == --- doc/trunk/design/syn/S03.pod

Re: Enhancing array indices

2007-01-30 Thread Jonathan Lang
Larry Wall wrote: And @x[*] would be @x[*+0..^*-0] written out that way. Or possibly @x[-* ..^ +*] depending on how we define the unaries. Hmm... how about this: Normally, * in the context of an indexer acts as a Range object, covering the range of available indices (defined

[svn:perl6-synopsis] r13554 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 18:54:32 2007 New Revision: 13554 Modified: doc/trunk/design/syn/S03.pod Log: Deleted stylistic notes ill-suited for a spec. Modified: doc/trunk/design/syn/S03.pod == ---

[svn:perl6-synopsis] r13555 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 19:00:44 2007 New Revision: 13555 Modified: doc/trunk/design/syn/S01.pod Log: While the month of Nob is cute... Modified: doc/trunk/design/syn/S01.pod == ---

[svn:perl6-synopsis] r13556 - doc/trunk/design/syn

2007-01-30 Thread larry
Author: larry Date: Tue Jan 30 19:05:36 2007 New Revision: 13556 Modified: doc/trunk/design/syn/S01.pod Log: Forgot to change the date... :) Modified: doc/trunk/design/syn/S01.pod == --- doc/trunk/design/syn/S01.pod