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
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
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
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
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
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 :
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
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
==
---
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?
--
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 (**)
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
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
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
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
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
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]
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
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
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
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
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
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
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
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
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
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
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
==
---
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
==
---
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
29 matches
Mail list logo