MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Defining a predicate

  • To: mathgroup at
  • Subject: Defining a predicate
  • From: Michael Carter <ECON076 at>
  • Date: Tue, 21 Jun 1994 11:02:25 +1200

I want to define a predicate (TableauQ) to recognise a system (list) of 
equations, so that I set $PrePrint to apply TableForm to such a 
system. The following works:

	TableauQ[_] := False
	TableauQ[{_Equal..}] := True
	$PrePrint = If[TableauQ[#], TableForm[#],#]&;

However, the logic of providing a blanket False (TableauQ[_] := 
False), which is then overridden when appropriate pattern matches, 
bothers me. Is the explicit False necessary?

On p. 227 of the good book, Wolfram writes:

	An important feature of Mma property-testing functions whose 
names end in Q is that they always return False if they cannot 
determine whether the expression has the given property. 

That behaviour also seems appropriate in my example. Is it possible 
to make user defined predicates exhibit the same behaviour?

Michael Carter                      m.carter at

Department of Economics             voice: + 64 3 364 2524
University of Canterbury            fax:   + 64 3 364 2635
Private Bag 4800

  • Prev by Date: Re: help
  • Next by Date: Re: cell brackets
  • Previous by thread: Re: New math.el
  • Next by thread: Re: Defining a predicate