Bill Allombert on Wed, 24 Nov 2010 19:16:19 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
display of true closures |
Hello PARI-dev, I have changed the way closures are displayed in SVN revision 12759. Let ? convol(f,g)=(n->sum(k=0,n,f(n-k)*g(k))) %1 = (f,g)->n->sum(k=0,n,f(n-k)*g(k)) before: ? convol(a,b) %2 = (n)->sum(k=0,n,f(n-k)*g(k)) (the information about the value of f and was not printed) now: ? convol(a,b) %2 = (n)->my(f=a,g=b);sum(k=0,n,f(n-k)*g(k)) This has two advantages: First it documently clearly how closures work with gp and in particular why a() always return 1 in the following example do not work iter()=my(x=0);()->x++ a=iter(); a() a() Secondly, it is now safe to copy-paste a closure or to write it to a text file, since no information is lost. I like to thanks Maximilian Hasler for bringing this issue. Cheers, Bill