Comment by petropolis for I think the confusion here involves the fact that...
Thank you! First time that I hear about Sage-level functions versus Python functions.
View ArticleAnswer by DSM for Consider the following function:def f(n) : def retfunc(x) :...
I think the confusion here involves the fact that your examples use f(1) as an expression, but Python functions and the values those functions take are two different things. There are several ways to...
View ArticleComment by petropolis for Your error is not due to recursion. The following...
Thank you Laurent for your help. "The following code does not produce the error." Unfortunately the code also does not produce what I need :) "I don't really understand what you are trying to do."...
View ArticleAnswer by Laurent Claessens for Consider the following function:def f(n) :...
Your error is not due to recursion. The following example (slightly simplified with respect to yours) produces the same error : def f(n) : def retfunc(x) : if n==0: return 1 return x*f(3) return...
View ArticleType error in recursion
Consider the following function: def f(n) : def retfunc(x) : return 1 if n == 0 else x*add(f(n-k) for k in (1..n)) return retfunc The test w = f(9); print w, type(w) gives "function retfunc at...
View Article
More Pages to Explore .....