Group Abstract Group Abstract

Message Boards Message Boards

A very simple but perplexing result from Mathematica


When I execute the following, the result is obvious and expected:

f [ Graphics@Circle[ ] ]

But when I execute the following, I should obtain the same result but instead get an error:

{Graphics@Circle[ ] } /. List -> f

This is the root of some serious difficulties I am having in more complicated situations.

POSTED BY: David Vasholz
2 years ago

Exploring this using InputForm one discovers that


evaluates to

Circle[{0, 0}]

so, when you do the List->f replacement this becomes

Circle[f[0, 0]]

however, the first argument of Circle must be a coordinate list pair. Hence, the error message. If f[0,0] were to evaluate to a coordinate list pair then presumably the error would not occur.

POSTED BY: David Reiss
2 years ago

Thank you very much. I forgot my rule could mess things up deep within the expression to which it is applied.

POSTED BY: David Vasholz
1 year ago