Why does FriCAS print "n=13" in the following simple example of a
nested function in the interpreter? There is no assignment to n.
---
wsp...@debian:~$ fricas -nox
GCL (GNU Common Lisp) 2.6.7 CLtL1 Sep 1 2008 14:01:57
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License: GPL due to GPL'ed components: (XGCL READLINE BFD UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter
Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to /tmp/
openServer result 0
FriCAS (AXIOM fork) Computer Algebra System
Version: FriCAS 2009-03-11
Timestamp: Thursday June 18, 2009 at 08:43:43
-----------------------------------------------------------------------------
Issue )copyright to view copyright notices.
Issue )summary for a summary of useful system commands.
Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------
(1) ->
(1) -> )r test3.input
gpp (p,n) ==
-- nested function
g(x,r,m,c) ==
output("c=",c)
output("n=",n)
output("m=",m)
if c = m then r else g(x-1,r*x,m,c+1)
output("p=",p)
output("n=",n)
g(p,1,n,0)
Type: Void
-- test
gpp(13,1)
Compiling function g with type (Integer,Integer,Integer,Integer) ->
Integer
Compiling function gpp with type (PositiveInteger,PositiveInteger)
-> Integer
p= 13
n= 1
c= 0
n= 1
m= 1
c= 1
n= 13
m= 1
(2) 13
Type: PositiveInteger
(3) -> )q
wsp...@debian:~$
---
Regards,
Bill Page.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---