ContextMenu[CurrentContext][Queries]
Get
get procedure associated with query
Calling Sequence
Parameters
Description
Examples of Queries[Get]
Queries[Get](nm)
nm
-
string; name of query in context menu module
The Queries[Get] command returns the procedure associated with the query named nm in the context menu module. This command may be used to examine the procedure associated with nm, or to apply this procedure directly to some object, for example, to map over a list.
with(ContextMenu[CurrentContext]):
Get the procedure associated with the query named "Variables".
q := Queries[Get]("Variables");
q:=proclocal_x,t,i,j,rgs,inds,mask,T;globalCM_GenVars;descriptionreturn variables present in the expression;ifnargs=1andtype⁡args[1],'rtable'and`type/rtable/AcceleratedTable`[args[1],has_name]=falsethenreturnelifnargs=1andtype⁡args[1],'function'andStandardContext:-Queries:-Run⁡MapleNonMathFunction,argsthenreturnend if;mask:=1;mask:='mask';t:='Not'⁡'name','specindex'⁡'anything',mask,'specindex'⁡'anything',`?`,_rtable;rgs:=args;inds:=indets⁡args,specfunc⁡identical⁡'`%id`'='integer','Array','Matrix','Vector','VectorCalculus:-Vector','Student:-VectorCalculus:-Vector','Vector[column]','Vector[row]','VectorCalculus:-Vector[column]','VectorCalculus:-Vector[row]','Student:-VectorCalculus:-Vector[column]','Student:-VectorCalculus:-Vector[row]';ifinds<>theninds:=seq⁡i=Matrix⁡'`%id`'=op⁡1,2,i,i=inds;ifhas⁡inds,'_rtable'thenerrorinvalid rtable referenceend if;rgs:=subs⁡inds,rgsend if;foritonops⁡rgsdoiftype⁡rgs[i],'rtable'andStandardContext:-Queries:-Run⁡ConstantRTable,rgs[i]thenrgs:=subsop⁡i=mask[0],rgsend ifend do;inds:=indets⁡rgs,'rtable';inds:=select⁡a→StandardContext:-Queries:-Run⁡ConstantRTable,a,inds;ifinds<>thenrgs:=subs⁡seq⁡inds[i]=mask[−i],i=1..nops⁡inds,rgsend if;inds:=indets⁡rgs,'specfunc'⁡'GRAPHLN';ifinds<>thenrgs:=subs⁡seq⁡inds[i]=mask[i],i=1..nops⁡inds,rgsend if;t:=tunion'And'⁡'symbol','suffixed'⁡'`Graph `';inds:=indets⁡rgs,'specfunc'⁡'RootOf';foritonops⁡indsdoj:=indets⁡op⁡i,1,inds,'name';if1<nops⁡op⁡i,indsandtype⁡op⁡i,2,inds,`=`andtype⁡op⁡i,2,1,inds,'name'thenj:=jminusop⁡i,2,1,inds;rgs:=subs⁡inds[i]=mask[i,j],rgselifnops⁡j=1thenrgs:=subs⁡inds[i]=mask[i,],rgsend ifend do;inds:=indets⁡rgs,'table';foritonops⁡indsdorgs:=subs⁡inds[i]=T⁡seq⁡j=inds[i][op⁡j],j=indices⁡inds[i],rgsend do;try_x:=remove⁡'type',indets⁡rgsminus'`...`','otherwise'unionif⁡type⁡CM_GenVars,'set',CM_GenVars,,t;_x:=sort⁡convert⁡_x,'list';_x:=select⁡var,expr→depends⁡expr,varandtype⁡var,'last_name_eval'ornotassigned⁡var,_x,rgs;inds:=select⁡type,_x,'specfunc'⁡'piecewise';ifinds<>thent:=indets⁡seq⁡seq⁡op⁡2*j − 1,i,j=1..iquo⁡nops⁡i,2,iininds;_x:=remove⁡member,_x,tend if;t:=indets⁡args,'specfunc'⁡:-Units:-Unit,:-Unit;t:=indets⁡map⁡op,t;_x:=remove⁡member,_x,t;_x:=remove⁡type,_x,'RandomVariable';_x:=seq⁡i,sprintf⁡%a,i,i=_x;_x:=sort⁡_x,proca,blocalta;ta:=type⁡a[1],'indexed';ifta=type⁡b[1],'indexed'thenlexorder⁡a[2],b[2]elsenottaend ifend proc;_x:=map2⁡op,1,_x;_xcatch:end tryend proc
Map this procedure over a list.
map(q, [1, x, x*y*z^2]);
,x,x,y,z
See Also
ContextMenu
Queries/Add
Queries/List
Queries/Run
Download Help Document