Hans L on Wed, 04 Mar 2020 21:46:35 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Not a function in function call |
I thought maybe assigning a new name to Str function would help, but it seems Str is defined in some bizarre way where it can't be referenced without calling it? ? f=Str %1 = "" ? Str %2 = "" ? Str==Str() %3 = 1 As opposed to abs for example: ? f=abs %1 = abs ? abs %2 = abs ? f(-1) %3 = 1 ? abs==abs() *** too few arguments: abs==abs() *** ^- ? abs==abs(-1) %4 = 0 On Wed, Mar 4, 2020 at 2:29 PM Hans L <thehans@gmail.com> 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? > > I get this error in gp 2.9.4 from ubuntu repos, and also 2.12.0 > (alpha) , which built from source on Aug 17 2019. > > Thanks, > Hans > > > On Tue, Jan 28, 2020 at 7:57 AM Bill Allombert > <Bill.Allombert@math.u-bordeaux.fr> wrote: > > > > On Tue, Jan 28, 2020 at 11:31:52AM +0000, Predrag Terzic wrote: > > > But, this one doesn't : > > > > > > n=22; > > > prevprime(k)={p=1;while(p<k,r=p;p=nextprime(p+1));return(r);} > > > compositorial(n)={c=10;l=[];forcomposite(i=1,n,c=c*i;l=concat(l,[c-prevprime(c-1)]));return(l);} > > > > Why not use the GP function precprime instead of prevprime ? > > > > > How to fix this problem? > > > > I assume prevprime take too much time. > > > > Cheers, > > Bill > >