Get
 get procedure associated with query

 Calling Sequence Queries[Get](nm)

Parameters

 nm - string; name of query in context menu module

Description

 • 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.

Examples of Queries[Get]

 Get the procedure associated with the query named "Variables".
 > q := Queries[Get]("Variables");
 ${q}{:=}{\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{,}{t}{,}{i}{,}{j}{,}{\mathrm{rgs}}{,}{\mathrm{inds}}{,}{\mathrm{mask}}{,}{T}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{global}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{CM_GenVars}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{description}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"return variables present in the expression"}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nargs}}{=}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{args}}{[}{1}{]}{,}{'}{\mathrm{rtable}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type/rtable/AcceleratedTable}}{[}{\mathrm{args}}{[}{1}{]}{,}{"has_name"}{]}{=}{\mathrm{false}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{return}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left[{}\right]\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{elif}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nargs}}{=}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{args}}{[}{1}{]}{,}{'}{\mathrm{function}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{StandardContext}}{:-}{\mathrm{Queries}}{:-}{\mathrm{Run}}{}\left({"MapleNonMathFunction"}{,}\left[{\mathrm{args}}\right]\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{return}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left[{}\right]\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{mask}}{:=}{1}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{mask}}{:=}{'}{\mathrm{mask}}{'}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}\left\{{'}{\mathrm{Not}}{'}{}\left({'}{\mathrm{name}}{'}\right){,}{'}{\mathrm{specindex}}{'}{}\left({'}{\mathrm{anything}}{'}{,}{\mathrm{mask}}\right){,}{'}{\mathrm{specindex}}{'}{}\left({'}{\mathrm{anything}}{'}{,}\left\{{\mathrm{?}}{,}{\mathrm{_rtable}}\right\}\right)\right\}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}\left[{\mathrm{args}}\right]{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{indets}}{}\left(\left[{\mathrm{args}}\right]{,}{\mathrm{specfunc}}{}\left({\mathrm{identical}}{}\left({'}{\mathrm{%id}}{'}\right){=}{'}{\mathrm{integer}}{'}{,}\left\{{'}{\mathrm{Array}}{'}{,}{'}{\mathrm{Matrix}}{'}{,}{'}{\mathrm{Vector}}{'}{,}{'}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{'}{,}{'}{\mathrm{Student}}{:-}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{'}{,}{'}{\mathrm{Vector}}{[}{\mathrm{column}}{]}{'}{,}{'}{\mathrm{Vector}}{[}{\mathrm{row}}{]}{'}{,}{'}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{[}{\mathrm{column}}{]}{'}{,}{'}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{[}{\mathrm{row}}{]}{'}{,}{'}{\mathrm{Student}}{:-}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{[}{\mathrm{column}}{]}{'}{,}{'}{\mathrm{Student}}{:-}{\mathrm{VectorCalculus}}{:-}{\mathrm{Vector}}{[}{\mathrm{row}}{]}{'}\right\}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{<>}\left\{{}\right\}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{seq}}{}\left({i}{=}{\mathrm{Matrix}}{}\left({'}{\mathrm{%id}}{'}{=}{\mathrm{op}}{}\left(\left[{1}{,}{2}\right]{,}{i}\right)\right){,}{i}{=}{\mathrm{inds}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{has}}{}\left(\left[{\mathrm{inds}}\right]{,}{'}{\mathrm{_rtable}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{error}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"invalid rtable reference"}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{inds}}{,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{for}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{i}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{to}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nops}}{}\left({\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{do}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{rgs}}{[}{i}{]}{,}{'}{\mathrm{rtable}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{StandardContext}}{:-}{\mathrm{Queries}}{:-}{\mathrm{Run}}{}\left({"ConstantRTable"}{,}\left[{\mathrm{rgs}}{[}{i}{]}\right]\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subsop}}{}\left({i}{=}{\mathrm{mask}}{[}{0}{]}{,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end do}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{indets}}{}\left({\mathrm{rgs}}{,}{'}{\mathrm{rtable}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{select}}{}\left({a}{→}{\mathrm{StandardContext}}{:-}{\mathrm{Queries}}{:-}{\mathrm{Run}}{}\left({"ConstantRTable"}{,}\left[{a}\right]\right){,}{\mathrm{inds}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{<>}\left\{{}\right\}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{seq}}{}\left({\mathrm{inds}}{[}{i}{]}{=}{\mathrm{mask}}{[}{−}{i}{]}{,}{i}{=}{1}{..}{\mathrm{nops}}{}\left({\mathrm{inds}}\right)\right){,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{indets}}{}\left({\mathrm{rgs}}{,}{'}{\mathrm{specfunc}}{'}{}\left({'}{\mathrm{GRAPHLN}}{'}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{<>}\left\{{}\right\}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{seq}}{}\left({\mathrm{inds}}{[}{i}{]}{=}{\mathrm{mask}}{[}{i}{]}{,}{i}{=}{1}{..}{\mathrm{nops}}{}\left({\mathrm{inds}}\right)\right){,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{t}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{union}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left\{{'}{\mathrm{And}}{'}{}\left({'}{\mathrm{symbol}}{'}{,}{'}{\mathrm{suffixed}}{'}{}\left({'}{\mathrm{Graph }}{'}\right)\right)\right\}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{indets}}{}\left({\mathrm{rgs}}{,}{'}{\mathrm{specfunc}}{'}{}\left({'}{\mathrm{RootOf}}{'}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{for}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{i}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{to}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nops}}{}\left({\mathrm{inds}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{do}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{j}{:=}{\mathrm{indets}}{}\left({\mathrm{op}}{}\left(\left[{i}{,}{1}\right]{,}{\mathrm{inds}}\right){,}{'}{\mathrm{name}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{1}{<}{\mathrm{nops}}{}\left({\mathrm{op}}{}\left({i}{,}{\mathrm{inds}}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{op}}{}\left(\left[{i}{,}{2}\right]{,}{\mathrm{inds}}\right){,}{\mathrm{=}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{op}}{}\left(\left[{i}{,}{2}{,}{1}\right]{,}{\mathrm{inds}}\right){,}{'}{\mathrm{name}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{j}{:=}{j}{\mathbf{minus}}\left\{{\mathrm{op}}{}\left(\left[{i}{,}{2}{,}{1}\right]{,}{\mathrm{inds}}\right)\right\}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{inds}}{[}{i}{]}{=}{\mathrm{mask}}{[}{i}{,}{j}{]}{,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{elif}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nops}}{}\left({j}\right){=}{1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{inds}}{[}{i}{]}{=}{\mathrm{mask}}{[}{i}{,}\left\{{}\right\}{]}{,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end do}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{indets}}{}\left({\mathrm{rgs}}{,}{'}{\mathrm{table}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{for}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{i}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{to}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{nops}}{}\left({\mathrm{inds}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{do}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{rgs}}{:=}{\mathrm{subs}}{}\left({\mathrm{inds}}{[}{i}{]}{=}{T}{}\left({\mathrm{seq}}{}\left({j}{=}{\mathrm{inds}}{[}{i}{]}{[}{\mathrm{op}}{}\left({j}\right){]}{,}{j}{=}\left[{\mathrm{indices}}{}\left({\mathrm{inds}}{[}{i}{]}\right)\right]\right)\right){,}{\mathrm{rgs}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end do}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{try}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{remove}}{}\left({'}{\mathrm{type}}{'}{,}{\mathrm{indets}}{}\left({\mathrm{rgs}}\right){\mathbf{minus}}\left(\left\{{'}{\mathrm{...}}{'}{,}{'}{\mathrm{otherwise}}{'}\right\}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{union}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{if}}{}\left({\mathrm{type}}{}\left({\mathrm{CM_GenVars}}{,}{'}{\mathrm{set}}{'}\right){,}{\mathrm{CM_GenVars}}{,}\left\{{}\right\}\right)\right){,}{t}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{sort}}{}\left({\mathrm{convert}}{}\left({\mathrm{_x}}{,}{'}{\mathrm{list}}{'}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{select}}{}\left(\left({\mathrm{var}}{,}{\mathrm{expr}}\right){→}{\mathrm{depends}}{}\left({\mathrm{expr}}{,}{\mathrm{var}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left({\mathrm{type}}{}\left({\mathrm{var}}{,}{'}{\mathrm{last_name_eval}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{or}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{assigned}}{}\left({\mathrm{var}}\right)\right){,}{\mathrm{_x}}{,}{\mathrm{rgs}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{:=}{\mathrm{select}}{}\left({\mathrm{type}}{,}{\mathrm{_x}}{,}{'}{\mathrm{specfunc}}{'}{}\left({'}{\mathrm{piecewise}}{'}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}{<>}\left[{}\right]\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{\mathrm{NULL}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{for}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{i}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{in}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{inds}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{do}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{t}{,}{\mathrm{seq}}{}\left({\mathrm{op}}{}\left({2}{*}{j}{-}{1}{,}{i}\right){,}{j}{=}{1}{..}{\mathrm{iquo}}{}\left({\mathrm{nops}}{}\left({i}\right){,}{2}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end do}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{\mathrm{indets}}{}\left(\left\{{t}\right\}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{remove}}{}\left({a}{→}{\mathrm{member}}{}\left({a}{,}{t}\right){,}{\mathrm{_x}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{\mathrm{indets}}{}\left(\left[{\mathrm{args}}\right]{,}{'}{\mathrm{specfunc}}{'}{}\left(\left\{{}{:-}{\mathrm{Units}}{:-}{\mathrm{Unit}}{,}{}{:-}{\mathrm{Unit}}\right\}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{:=}{\mathrm{indets}}{}\left({\mathrm{map}}{}\left({\mathrm{op}}{,}{t}\right)\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{remove}}{}\left({\mathrm{member}}{,}{\mathrm{_x}}{,}{t}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{remove}}{}\left({\mathrm{type}}{,}{\mathrm{_x}}{,}{'}{\mathrm{RandomVariable}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}\left[{\mathrm{seq}}{}\left(\left[{i}{,}{\mathrm{sprintf}}{}\left({"%a"}{,}{i}\right)\right]{,}{i}{=}{\mathrm{_x}}\right)\right]{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{sort}}{}\left({\mathrm{_x}}{,}{\mathbf{proc}}\left({a}{,}{b}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{ta}}{,}{\mathrm{tb}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{ta}}{:=}{\mathrm{type}}{}\left({a}{[}{1}{]}{,}{'}{\mathrm{indexed}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{tb}}{:=}{\mathrm{type}}{}\left({b}{[}{1}{]}{,}{'}{\mathrm{indexed}}{'}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{ta}}{=}{\mathrm{tb}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{lexorder}}{}\left({a}{[}{2}{]}{,}{b}{[}{2}{]}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{ta}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}{:=}{\mathrm{map2}}{}\left({\mathrm{op}}{,}{1}{,}{\mathrm{_x}}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_x}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{catch}}{:}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end try}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (1)
 Map this procedure over a list.
 > map(q, [1, x, x*y*z^2]);
 $\left[\left[{}\right]{,}\left[{x}\right]{,}\left[{x}{,}{y}{,}{z}\right]\right]$ (2)