Behavior of Part inside Function

2019-09-03 14:49发布

问题:

The following gives some strange "Part" warnings

Clear[f];
f = Function[{x}, x[[1]] == x[[2]]]

However if I execute the second line again, it works without warnings, any idea what's going on?

回答1:

Are you sure? I don't see any warnings in version 7.0.1:

In[1]:= Clear[f];
        f=Function[{x},x[[1]]==x[[2]]]

Out[2]= Function[{x},x[[1]]==x[[2]]]