Re: counting number of rules in rule base
- To: mathgroup at christensen.cybernetics.net
 - Subject: [mg1569] Re: counting number of rules in rule base
 - From: Count Dracula <lk3a at kelvin.seas.virginia.edu>
 - Date: Sun, 25 Jun 1995 02:49:46 -0400
 - Organization: University of Virginia
 
In Message-ID: <3sd94t$n5n at news0.cybernetics.net> 
Article 880 of comp.soft-sys.math.mathematica
gaylord at uiuc.edu (richard j. gaylord) writes:
> without doing ?symb and then counting the number of rules that come up on
> my monitor screen [i keep losing count around 125 or so], how can i ask
> Mathematica for the number of rules associated with symb?
My previous message about this had a typographical error.
Two variable names, "f" and "symb", appeared in the
Module numrules, but only one name should have been used.
The Module should have read:
numrules[f_Symbol] :=
  Module[{inf},
   inf = StringToStream[ToString[Definition[f]]];
   Length[Select[ReadList[inf, Record], StringMatchQ[#1, StringJoin[ToString[f], "[*"]]&]]
         ]
-- 
 ___________________________________________________________________________________
 Levent Kitis           lk3a at cars.mech.virginia.edu    lk3a at kelvin.seas.virginia.edu
 University of Virginia Department of Mechanical, Aerospace, and Nuclear Engineering  
 ___________________________________________________________________________________