When the next input cell is evaluated (f) is Flat for pattern matching, but not for evaluation.

ClearAll[f]   Attributes[f] = {Flat} ;   f[x_, y_] := {x, y}   Attributes[f] = {}  ... [1, 2, 3]    (*  The head f is Flat for pattern matching .   *)

{f[1], {f[2], f[3]}}

f[f[f[1]]]   (*  Nested layers of f are not Flattened .   *)

f[f[f[1]]]

It now seems like (f) has the same definition twice.  We can evaluate ( f[x_,y_]=. ) once to get rid of one definition, but we need to use ( f[x_,y_]=. ) again to get rid of the second definition.  Alternatively we could use Clear[f] and all definitions for (f) would be removed in one step.

? f

Global`f

f[x_, y_] := {x, y}
f[x_, y_] := {x, y}

f[x_, y_] =.

? f

Global`f

f[x_, y_] := {x, y}

f[x_, y_] =.

Now (f) has no definitions.

??f

Global`f

{f[1, 2], f[f[1]]}

{f[1, 2], f[f[1]]}


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page