Question: Conflict of prodedure input types due to'='

I have a example overloaded procdeure below. Due to '=' the optional input in the 2nd proc gets trapped in the 1st proc. I have tried various ways to get around this. Obviously I could make the  optional input in the 2nd proc non-optional if all else fails. Is there a way around this?
 

restart

Test:=overload([
proc(l1::{`+`,`*`,`=`, `symbol`,procedure,not(list)},
l2::{`+`,`*`,`=`, `symbol`,procedure,not(list)} ) #need to detect if 'point' is present

option overload;
if not(has([_params[2]],point)) then #if true need to go the next proc

print("1st proc ",l1," ",l2);
return
end if;
end proc,

proc(l1::{`+`,`*`,`=`, `symbol`,procedure,not(list)},
{point::list:=NULL}) #oprional input

print("2nd proc",l1,"point",point);

end proc
]):

 

l:=3*x+4*y-5;
h:=4*x-8*y = 5;
P:=[3,5]

3*x+4*y-5

 

4*x-8*y = 5

 

[3, 5]

(1)

Test(l,h)

 

"1st proc ", 3*x+4*y-5, " ", 4*x-8*y = 5

(2)

Test(l,point=P)

 

Test(h,point=[2,7])

 

 

 


 

Download 2026-02-28_Q_Test_proc_Line_point_inputs.mw

Please Wait...