The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.symbolic

Topic: Maple procedures
Replies: 11   Last Post: Jul 22, 2004 10:13 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Joe Riel

Posts: 95
Registered: 12/8/04
Re: Maple procedures
Posted: Jun 22, 2004 9:21 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Carl Devore wrote:
> On 21 Jun 2004, John Creighton wrote:
>

>>Is there anyway way to read how maple procedures are programmed?
>
>
> In addition to Joe Riel's suggestion, sometimes showstat(procedure_name)
> gives more readable output than eval(procedure_name). And sometimes the
> eval(...) will be the more readable one.


A disadvantage of showstat, particularly if you want to cut and paste
the output, is that it includes line numbers. Here is a simple
procedure I threw together to remove the line numbers.

PrintProc := proc(p::name,lines::{posint,posint..posint})
local s,width;
option `Copyright (C) 2004 by Joseph S. Riel. All rights reserved.`;
description "Print like showstat, but without line numbers";
width := interface('screenwidth'=infinity);
try
s := sprintf("%s",debugopts('procdump'=
`if`(nargs=1,p,[p,lines])));
# This is a bit crude, but easier than counting the digits in
# the line numbers.
use StringTools in
s := RegSubs("\n [0-9] "="\n ",s);
s := RegSubs("\n [0-9][0-9] "="\n ",s);
s := RegSubs("\n [0-9][0-9][0-9] "="\n ",s);
s := RegSubs("\n[0-9][0-9][0-9][0-9] "="\n ",s);
# Decrease initial indentation to 2.
s := RegSubs("\n "="\n ",s);
end use;
printf("%s",s);
catch "procedure name expected":
error "%1 is not a procedure name",p
finally interface('screenwidth'=width)
end try;
NULL
end:


Joe Riel





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.