perl6-language
[Top] [All Lists]

Re: Differential Subscripts

To: perl6-language@perl.org
Subject: Re: Differential Subscripts
From: "TSa (Thomas Sandlaß)" <thomas@sandlass.de>
Date: Sun, 10 Aug 2008 20:48:31 +0200
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-language@perl.org
Delivered-to: perl6-language@perl.org
In-reply-to: <22366-04544@sneakemail.com>
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-language.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
Organization: Thomas Sandlaß
References: <22366-04544@sneakemail.com>
User-agent: KMail/1.9.9
On Saturday, 9. August 2008 04:41:46 John M. Dlugosz wrote:
> Is this magic known to the parser at a low level, or is it possible to
> define your own postcircumfix operators that interact with the
> interpretation of the argument?

My interpretation is that there is a Whatever type that
most of the time behaves like Int. So to handle it, you
define postcircumfix:<[ ]>:(Whatever $slice) or so. The
interesting question is what plain * returns because that
is destined to mean the full slice. IMHO, this should be
written ^*, which if the array becomes known becomes
^@array.elems.


> Is it possible to write:
>       @i = (1, 3, *-1);
>       say @data[$i];
> and get the same meaning as
>       say @data[1, 3, *-1]?

I hope so. The type of the slice is Seq[Int,Int,Whatever].


Regards, TSa.
-- 
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan


<Prev in Thread] Current Thread [Next in Thread>