MathGroup Archive 2004

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

Search the Archive

Re: A module to write a module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48910] Re: A module to write a module
  • From: "Peltio" <peltio at twilight.zone>
  • Date: Wed, 23 Jun 2004 02:51:02 -0400 (EDT)
  • References: <c9pfkj$sr9$1@smc.vnet.net>
  • Reply-to: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
  • Sender: owner-wri-mathgroup at wolfram.com

"Goyder Dr HGD" wrote

Sorry, I tripped on the cut&paste and left the /. out of the code in my
previous posting.
The code should read:

ModuleTemplate[a_] := NotebookWrite[SelectedNotebook[],
    Cell[BoxData[
    MakeBoxes @@ ( Hold[
        (* Code with placeholders starts here *)
        ClearAll[ppp];
        ppp::usage = ps1;
        ppp[] := Module[
            {},
            Print[ps2];
        ]
        (* Code with placeholders ends here *)
    ] /. (*Placeholders replacement *)
            {ppp -> a,
            ps1 -> StringJoin[ToString[a], "[]..."],
            ps2 -> StringJoin[ToString[a], " at Stage 1:"]}
    )], "Input"]
]

Also, replacing Hold[] with HoldComplete[] might help in treating certain
special cases (with Sequences and the like).

cheers,
Peltio
Invalid address in reply-to. Crafty demunging required to mail me.


  • Prev by Date: Printing Rotated Text from a Mac
  • Next by Date: Re: Problem rendering fonts (?) in mathematica
  • Previous by thread: A module to write a module
  • Next by thread: Re: A module to write a module