Charles Greathouse on Mon, 16 May 2011 19:32:48 +0200


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

Re: Bug in apply?


Ah, it makes sense now.

Is there another way to force evaluation in a closure context, or should I just write n->Str(n)?

Charles Greathouse
Analyst/Programmer
Case Western Reserve University

On Mon, May 16, 2011 at 12:48 PM, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote:
On Mon, May 16, 2011 at 12:26:06PM -0400, Charles Greathouse wrote:
> apply(Str, [1])
> fails in PARI 2.4.4 in both Linux and Windows (using the latest SVN
> version).  apply(s->Str(s), [1]) works as expected.

This is actually a compromise for compatibility with GP 2.3.
Under both versions:
? Str
%1 = ""
so your statement is equivalent to
apply("", [1])
which is invalid.
The issue exist with any built-in GP function that has no mandatory argument and
at least one optional argument.
Other examples include Vec, random, etc.

Cheers,
Bill.