A more syntactically compact way?

*To*: mathgroup at smc.vnet.net*Subject*: [mg62991] A more syntactically compact way?*From*: "Trevor Baca" <trevorbaca at gmail.com>*Date*: Sat, 10 Dec 2005 06:03:01 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

This is a question about using assigning an upvalue to a symbol and "type"-checking the symbol with some sort of Q predicate: If we define a "type" with the predicate ... fooQ[f_] := MatchQ[f, foo[_Integer, _Integer]] ... then assigning an upvalue this way doesn't work ... foo /: jiggle[f_?fooQ] := First[f]^Last[f] TagSetDelayed::tagnf: Tag foo not found in jiggle[f_?fooQ] ... and assigning an upvalue this way .... foo /: jiggle[f_foo] := First[f]^Last[f] ... does (syntactically) work, but at the cost of checking only the *head* but not the "type". So, to both successfully assign the upvalue AND check "type", I usually use something like: foo /: bar[f_foo?fooQ] := First[f] * Last[f] which works fine. Question: is there a syntactically more compact solution? Trevor.

**Follow-Ups**:**Re: A more syntactically compact way?***From:*Omega Consulting <info@omegaconsultinggroup.com>