Post Reply 
newRPL - build 1255 released! [updated to 1299]
04-19-2019, 01:11 PM
Post: #401
RE: newRPL - build 1089 released! [update:build 1158]
Hello
I do not know if the following was already discussed: Optional Arguments

The RPN commands of the hp48 / 50 interpret a number of fixed arguments, while in the functional standard notation some languages the number of call arguments can be variable

if a function is defined as f1 (arg1, [arg2], [arg3], ...)

The following three calling options can be made.
f1(arg1) [enter]
f1(arg1, arg2) [enter]
f1(arg1, arg2, arg3) [enter]

for example Xcas syntax python
PHP Code:
#cas
def legendre_nevalX="" ):
    
local pxxtype2argpurge(x)
    
px := 1/(2^n*n!)*diff((x^2-1)^n,x,n)
    
type2arg := getType(evalX)   
    if 
type2arg=="NUM" or type2arg=="EXPR" or type2arg=="VAR":
        
px:=subst(px,x=evalX)
    
elif type2arg=="STR" and evalX=="list":
        
px:=e2r(px)   
    return 
px;
#end 

legendre_(2), legendre_(2,y), legendre_(2,"list"), legendre_(2,10), legendre_(2,cos(t)) [enter]

1/8*(12*x^2-4), 1/8*(12*y^2-4), poly1[3/2,0,-1/2],2 99/2, 1/8*(12*cos(t)^2-4)

I think the only way in RPN is to specify the number of arguments, it can be with the symbols <-

arg1 f1 [enter]
arg1, arg2 f1←2 [enter]
arg1, arg2, arg3 f1←3 [enter]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
RE: newRPL - build 1089 released! [update:build 1158] - compsystems - 04-19-2019 01:11 PM
How to participate? - erazor - 12-13-2019, 07:12 AM



User(s) browsing this thread: 6 Guest(s)