On Tue, Jul 15, 2008 at 7:47 AM, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> Memo'izing (saving results) is the whole raison d'etre of f[](), and not
> doubly evaluating the RHS defeats that purpose.
Yeah, I guess so --- I was looking at foo[x](y) as a function construction
so I was surprised by the extra evaluation. But foo[x] := ... by itself is
indeed a memoizing function in Maxima. There is some conceptual
tension between memoizing, which evaluates, and function construction,
which doesn't.
At this point I'm not inclined to press further for changing CONSTLAM.
It is easy enough (once one understands) to defeat the first evaluation
if that is desired. I'll just throw some explanation in the reference
manual about the behavior of foo[x](y).
> If you don't want the double evaluation, why not just use ordinary functions
> foo(x,y):=... or the fully memoizing function foo[x,y]:=...?
Well, I didn't invent the example at hand ... it was encountered
by an unfortunate user. FWIW I am inclined to think it is OK to have
two or more ways to do something, so long as they all work.
Robert