## #222 DEFINE documentation

closed
nobody
5
2003-07-19
2003-02-03
No

The docu says

- Function: DEFINE (f(x1, ...), body)
is equivalent to f(x1,...):=&quot;body but when used inside
functions
it happens at execution time rather than at the time
of definition
of the function which contains it.

Asside from the fact that &quot; should (globally, at least also
in
&quot;Introduction to Command Line&quot;) be replaced by '',

define(f(x),Block([],local(f),Map(lambda([x,y],f[x]:y),
[1,3,5],[2,5,1]),f[x]));

returns

f(x) := f[x]

and

f(x):=''Block([],local(f),Map(lambda([x,y],f[x]:y),[1,3,5],
[2,5,1]),f[x]);

returns

f(x):=BLOCK([],LOCAL(f),MAP(LAMBDA([x,y],f[x]:y),
[1,3,5],[2,5,1]),f[x])

so, it seems that this is not really an equivalence. In
fact, it seems to
me that '' doen't do anything in this context. Furthermore

g():= f(x):=''Block([],local(f),Map(lambda([x,y],f[x]:y),
[1,3,5],[2,5,1]),f[x]);

(as well as the same statement without '' ) makes g();
return

f(x):=BLOCK([],LOCAL(f),MAP(LAMBDA([x,y],f[x]:y),
[1,3,5],[2,5,1]),f[x])

(and now f is defined), while

g():=define(f(x),Block([],local(f),Map(lambda([x,y],f[x]:y),
[1,3,5],[2,5,1]),f[x]));

makes g(); return

f(x):=f[x]

(which is what I expected) So, I think the docu should
say something like

- Function: DEFINE (f(x1, ...), body)
is equivalent to f(x1,...):=evaluated_body, where
evaluated_body is
the evaluation of body.

## Discussion

• Stavros Macrakis - 2003-07-07

Logged In: YES
user_id=588346

The problem here is that ''f(x) is not equivalent to ''(f(x)).

The documenation should say

...is equivalent to f(x1,...):=''(body)

Now, WHY is ''f(x) not equivalent to ''(f(x))? Well, that is in
my opinion a design error, but since it is documented under '',
I suppose it can't be considered a bug.

• status: open --> closed

• Logged In: YES
user_id=365569

• Logged In: YES
user_id=365569

Forgot to say it was fixed