09-09-2017, 01:56 AM
09-09-2017, 02:52 AM
It is not possible, it is very related to define polymorphic functions and that is not possible in HP PPL, the alternatives can be to create 2 independent functions, or send a parameter that determines the different type of action you want to have on the data sent.
09-09-2017, 04:09 AM
Another option, although awkward, is possible: Make the input a string, and then parse the string yourself in your program.
09-09-2017, 05:13 AM
Thank you
09-09-2017, 03:34 PM
Bonjour
J'ai déja fait ce genre de choses en utilisant une liste pour
transmettre/recevoir les paramètres.
Hello
I've already done this sort of thing using a list for
transmit / receive parameters.
J'ai déja fait ce genre de choses en utilisant une liste pour
transmettre/recevoir les paramètres.
Hello
I've already done this sort of thing using a list for
transmit / receive parameters.
09-09-2017, 10:07 PM
I'm thinking like a function that has:
func(a,b,[c]), like some of the library functions....
You can create 2 functions but you can't do it like this:
EXPORT func(a,b,c=0)
...
I don't see how a list lets you do this...?
Thx
-D
func(a,b,[c]), like some of the library functions....
You can create 2 functions but you can't do it like this:
EXPORT func(a,b,c=0)
...
I don't see how a list lets you do this...?
Thx
-D
09-10-2017, 05:35 AM
Bonjour, Hello
Par exemple :
For exemple :
Func({10,15,2}) -> c=2
Func({10,15}) -> c=0
C'est un peu artisanal mais cela fonctionne.
It's a little crafty but it works.
Si il y a plusieurs arguments optionnels et d'autres obligatoires vous pouvez mixer.
If there are several optional arguments and mandatory others you can mix.
Espérant vous avoir aidé.
Hoping you helped.
Par exemple :
For exemple :
Code:
Export Func(p)
BEGIN
Local a,b,c
a:=p(1);b:=p(2);
IFERR c:=p(3) THEN c:=0; END;
....
....
END;
Func({10,15,2}) -> c=2
Func({10,15}) -> c=0
C'est un peu artisanal mais cela fonctionne.
It's a little crafty but it works.
Si il y a plusieurs arguments optionnels et d'autres obligatoires vous pouvez mixer.
If there are several optional arguments and mandatory others you can mix.
Code:
EXPORT Func(a,b,p)
BEGIN
LOCAL c,d,e
IF TYPE(p)==6 THEN
c:=p(1);d:=p(2);e:=p(3)
ELSE
c:=p;d:='def value';e:='def value';
END;
...
...
END;
Espérant vous avoir aidé.
Hoping you helped.
09-11-2017, 05:13 AM
Hello,
PPL does not support this for user functions. sorry.
You can "emulate" it (as suggesteed before) either by creating 2 distinct functions (func2 and func3, for respectivly 2 and 3 args for example) and/or by the use of a list of input parameters.
Cyrille
PPL does not support this for user functions. sorry.
You can "emulate" it (as suggesteed before) either by creating 2 distinct functions (func2 and func3, for respectivly 2 and 3 args for example) and/or by the use of a list of input parameters.
Cyrille
09-11-2017, 04:52 PM
Giac has support for default parameters, for example
but it is probably too recent to be in the CAS of the current HP firmware.
Code:
f(x=3):=x*x; f(); f(5)
09-11-2017, 08:24 PM
Good!