Question: when to use 'specfunc(anything,y)' vs. specfunc(anything,y) ?

Help page for structured types shows examples where they add delayed quotes around things. For example

So I started writing  'specfunc(anything,y)' instead of just  specfunc(anything,y). Only to find this breaks things when used inside a proc.

Here is an example.

restart;

#here it worksheetdir
IC:=y(x)=0;
indets(IC,'specfunc(anything,y)');      

y(x) = 0

{y(x)}

#inside proc, same code fail
foo:=proc(func::function(name),IC::`=`)
    local y::symbol:=op(0,func);
    indets(IC,'specfunc(anything,y)');
end proc:
 

foo(y(x),y(x)=0)

{}

 


Removing the quotes, it now works

 

restart;

#here it worksheetdir
IC:=y(x)=0;
indets(IC,'specfunc(anything,y)');      

y(x) = 0

{y(x)}

#inside proc, same code fail
foo:=proc(func::function(name),IC::`=`)
    local y::symbol:=op(0,func);
    indets(IC,specfunc(anything,y));
end proc:
 

foo(y(x),y(x)=0)

{y(x)}

 


 

Download delayed_vs_not_v2.mw

Download delayed_vs_not.mw

 

It took me 2 hrs debugging to find this, as when I copied code which was working in my worksheet to my function, it stopped working and did not know why.

So for now, I will not use quotes around specfunc or any others like the help page shows in its examples.

Is there a rule of thumb to follow here? The help page is very inconsistent. It shows some examples with quotes around and some without. Makes it hard to know why and when to add the delayed quotes. It seems arbitrary.

 

 

Please Wait...