Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make it so maple.gcd?? shows source code #1209

Closed
williamstein opened this issue Nov 19, 2007 · 13 comments
Closed

make it so maple.gcd?? shows source code #1209

williamstein opened this issue Nov 19, 2007 · 13 comments

Comments

@williamstein
Copy link
Contributor

On Nov 19, 2007 8:29 AM, Jason Grout <jason-sage@creativetrax.com> wrote:
> 
> William Stein wrote:
> 
> >  3. Dumb question -- Where is the actual source code of anything in Maple?
> >      I'm skimming through my Maple install to see some actual source code and
> >      I can't find anything.  The lib/ directory has lots of .mla
> > files, but these are all
> >      pre-compiled binary files -- no source code.  Is there some tool
> > included with
> >      Maple to decompile them?     (I'm not being rhetorical, I simply don't know
> >      how to actually view source code of Maple functions, even if I wanted to.)
> 
> Some links dealing with this:
> 
> http://www.mapleprimes.com/blog/jacquesc/old-timer-techniques
> 
> http://www.mapleprimes.com/forum/algorithms-used-in-maple
> 
> http://thproxy.jinr.ru/Documents/MapleV/qa/section3_4.html
> 
> I've used the printlevel and I think the showstat techniques before.
> Unfortunately, I can't test them because I no longer have access to
> Maple (at least on my home machine).  I guess that's they whole point
> again---even if there is some way for someone to get the output of the
> procedure, it doesn't do me any good because I don't have Maple and
> can't check it anyway.

This *does* work in Maple 11:

sage: maple_console()
    |\^/|     Maple 11 (APPLE UNIVERSAL OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2007
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> print(gcd);
                                  proc(aa, bb, cofa::name, cofb::name)  ...  end proc

> interface(verboseproc=2);
                                                           1

> print(gcd);              
proc(aa, bb, cofa::name, cofb::name)
local Z, GCD, a, b;
option `Copyright (c) 1992 by the University of Waterloo. All rights reserved.`;
    if 2 < nargs and member(cofa, indets(aa) union indets(bb)) then error "The optional 3rd argument given to `\
...

I wonder what proportion of the 1300 or so top-level functions in Maple (according
to a sage's maple.[tab]) actually have source code.    

Interestingly, I bet I can make it so 

  sage: maple.gcd??

will show the source code using one you suggest above.  Trac ticket:
   

> Whether or not using printlevel or showstat is legal (in light of Josh's
> response from Maple) is an interesting question.  They are built-in
> capabilities meant for introspection.  They were also encouraged by the
> Maple people in the above posts.

<tinfoil hat> Maybe it is a trap.  :-)  </tinfoil hat>

 - William

Component: interfaces

Issue created by migration from https://trac.sagemath.org/ticket/1209

@mwhansen
Copy link
Contributor

comment:3

New patch added.

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jan 27, 2008

comment:4

I say apply, even though this patch spawns a new maple for each query. mhansen couldn't get 'maple.gcd?' to work without doing that, so it can be a new ticket.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Jan 27, 2008

comment:5

Merged in Sage 2.10.1.rc1

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Jan 27, 2008
@williamstein
Copy link
Contributor Author

comment:6

Referee report:

  • All doctests pass. Excellent.

  • Line 455: "trys" --> "tries"

  • It would be good if you also added something to the programming guide that explains the new _sage_src_ "protocol" that you just invented in the course of making this patch.

@williamstein williamstein reopened this Jan 27, 2008
@williamstein williamstein changed the title make it so maple.gcd?? shows source code [with patch, needs update (was posiive review)] make it so maple.gcd?? shows source code Jan 27, 2008
@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title [with patch, needs update (was posiive review)] make it so maple.gcd?? shows source code [with patch, needs update - was positive review] make it so maple.gcd?? shows source code Feb 12, 2008
@mwhansen
Copy link
Contributor

Attachment: 1209.patch.gz

@mwhansen
Copy link
Contributor

comment:8

New patch that fixes the typo is posted. I made the programming guide suggestion #2335 .

@mwhansen mwhansen changed the title [with patch, needs update - was positive review] make it so maple.gcd?? shows source code make it so maple.gcd?? shows source code Feb 27, 2008
@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 28, 2008

comment:9

I get some reject against my 2.10.3.rc0:

sage$ patch -p1 --dry-run < trac_1209.patch
patching file sage/interfaces/maple.py
Hunk #1 succeeded at 485 with fuzz 2 (offset 35 lines).
Hunk #2 FAILED at 584.
1 out of 2 hunks FAILED -- saving rejects to file sage/interfaces/maple.py.rej
patching file sage/misc/sagedoc.py
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file sage/misc/sagedoc.py.rej

Am I missing a dependency or do I just need a rebase here?

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title make it so maple.gcd?? shows source code [might need rebase] make it so maple.gcd?? shows source code Feb 28, 2008
@mwhansen
Copy link
Contributor

Attachment: 1209.2.patch.gz

@mwhansen
Copy link
Contributor

comment:10

New patch posted which should apply cleanly.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 28, 2008

comment:11

Closer, but still not across the finish line:

sage$ patch -p1 --dry-run < trac_1209.2.patch
patching file sage/interfaces/maple.py
Hunk #1 succeeded at 485 with fuzz 2 (offset 35 lines).
Hunk #2 FAILED at 584.
1 out of 2 hunks FAILED -- saving rejects to file sage/interfaces/maple.py.rej

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title [might need rebase] make it so maple.gcd?? shows source code [does need rebase] make it so maple.gcd?? shows source code Feb 28, 2008
@mwhansen
Copy link
Contributor

Attachment: 1209.3.patch.gz

@mwhansen
Copy link
Contributor

comment:12

This last one should do it.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 28, 2008

comment:13

Merged 1209.3.patch in Sage 2.10.3.rc0

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Feb 28, 2008
@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title [does need rebase] make it so maple.gcd?? shows source code make it so maple.gcd?? shows source code Feb 28, 2008
@sagetrac-mabshoff sagetrac-mabshoff mannequin reopened this Feb 28, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants