Bill Allombert on Tue, 23 Feb 2010 16:19:44 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Getting the variable number of a lexical local variable |
On Tue, Feb 23, 2010 at 09:01:48AM -0500, Charles Greathouse wrote: > > Actually, it is possible: just use the code 'n', not 'V='. > > I mean that it's not (apparently) possible to get it from the existing > signature. > > > Well, you can use > > sumformal(x,1, n, x^3 + 3) > > instead. The only difference is the use of a comma instead of =. > > I guess that's not too bad. I don't suppose there's a way to overload > it so that I can have it called with V=GGG or nGGG? No, functionnal polymorphism is not available. The closer you can do is to use DnGGG or GGGDn. This way the variable will be optionnal: DnGGG: sumformal(x, 1, n, x^3 + 3) or sumformal(, 1, n, x^3 + 3) GGGDn: sumformal(1, n, x^3 + 3, x) or sumformal(1, n, x^3 + 3) Cheers, Bill.