Bill Allombert on Thu, 14 Nov 2013 22:14:43 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Slicing lists?

On Wed, Nov 13, 2013 at 02:19:39PM -0500, Charles Greathouse wrote:
> The vector slicing notation introduced in 2.6.0 is very convenient. Could
> this be extended to lists?

So you want a slice of a t_LIST to be a t_VEC ?

> I haven't tested it but I think this would amount to adding
>         case t_LIST:
>             A = list_data(A);
>             GEN B = cgetg(lB, t_VEC);
>             for (i=1; i<lB; i++) gel(B,1+i) = gcopy(gel(A,i+y1));
>             return B;
> to vecslice0.

Your patch does not work: the wrong length is sent to vecslice_parse_arg.