MathGroup Archive 2004

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

Search the Archive

Re: A module to write a module


"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