Kevin Ryde on Sun, 22 Nov 2015 07:08:32 +0100


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

Re: Vector of args


Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> writes:
>
> On Wed, Nov 11, 2015 at 09:18:22AM +0100, Loïc Grenié wrote:
>> f)? In that case
>>   call(g,concat([a,b],c)) would also work with the version we propose.
>> Inside the
>>   variadic you know it is variadic, outside you may or may not know.
>
> That would be both awkward and inefficient, since GP will need to undo the
> concat operation.

A printf is unlikely to be many args of course.  If that case is
important I still like a vstrprintf for efficiency or clarity (cut out
the middle man, and some use from C).  Or a yet further way would be a
flag in call to select vector ending with a vector variant, so args can
be presented unambiguously but whichever fashion the caller likes best.

In any case I notice a small seg fault presently (with a little irony
that it's by a form I would like to make a call ... :-)

    call(Strprintf, ["%d", 10])
    =>
    ***   at top-level: call(Strprintf,["%d"
    ***                 ^--------------------
    ***   in function call: Strprintf
    ***                     ^---------
    *** Strprintf: bug in PARI/GP (Segmentation Fault), please report.