home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / OPTIONUS.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  720 b   |  33 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. BeginPackage["OptionUse`"]
  12.  
  13. g::usage = "g[n, options...] serves as an example for using options."
  14.  
  15. Opt1::usage = "Opt1 is an option of g[]."
  16.  
  17. Opt2::usage = "Opt2 is another option of g[]."
  18.  
  19. Options[g] = {Opt1 -> val1, Opt2 -> val2}
  20.  
  21. Begin["`Private`"]
  22.  
  23. g[ n_, opts___Rule ] :=
  24.     Module[ {opt1, opt2},
  25.         opt1 = Opt1 /. {opts} /. Options[g];
  26.         opt2 = Opt2 /. {opts} /. Options[g];
  27.         {n, opt1, opt2}
  28.     ]
  29.  
  30. End[]
  31.  
  32. EndPackage[]
  33.