| Bill Allombert on Wed, 04 Mar 2020 23:29:34 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Not a function in function call |
On Wed, Mar 04, 2020 at 02:29:31PM -0600, Hans L wrote:
> Not sure if this is any relation, but I'm seeing the same error on a
> much simpler test case:
>
> ? ?Str
> Str({x}*): concatenates its (string) argument into a single string.
>
> ? Str(1,2,3,4)
> %1 = "1234"
>
> ? ?call
> call(f, A): A being a vector, evaluates f(A[1],...,A[#A]).
>
> ? call(Str, [1,2,3,4])
> *** at top-level: call(Str,[1,2,3,4])
> *** ^-------------------
> *** call: not a function in function call
> *** Break loop: type 'break' to go back to GP prompt
>
> I would expect this to return the same as Str(1,2,3,4)
> Is this a bug or is there some nuance to using "call" that I'm not
> understanding?
The problem is that for historical reasons, functions without mandatory
arguments can be called without trailing ().
This is needed for I and Pi to work as expected.
Unfortunately, this also works with Str.
Secondly, Str is a variadic function, so you need to pass all parameters
as one. You can do
? call("Str",[[1,2,3,4]])
%59 = "1234"
Cheers,
Bill.