home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / PRINTTIM.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  590 b   |  28 lines

  1.  
  2. (*********************************************************************
  3.  
  4.         Adapted from
  5.         Roman E. Maeder: Programming in Mathematica,
  6.         Second Edition, Addison-Wesley, 1991.
  7.  
  8.  *********************************************************************)
  9.  
  10.  
  11. PrintTime::usage = "PrintTime[expr] prints the time it takes
  12.     to evaluate expr and returns the result of the evaluation."
  13.  
  14. Begin["`Private`"]
  15.  
  16. SetAttributes[PrintTime, HoldAll]
  17.  
  18. PrintTime[expr_] :=
  19.     Module[{timing},
  20.         timing = Timing[expr];
  21.         Print[ timing[[1]] ];
  22.         timing[[2]]
  23.     ]
  24.  
  25. End[]
  26.  
  27. Null
  28.