Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Treatment of function arguments.

Posted 4 years ago

I am new to the Wolfram Language and am trying to learn to read code. Below is a figure showing some expressions and the evaluation of those expressions.

I would expect (as it turns out, wrongly) that the expressions in lines 5 and 6 would give the same result, but they do not.

It seems to me that the argument seen by ToString in the two cases (5,6) should be the same and, thus, give the same result.

If one asserts that the argument seen by ToString in line 5 is '2+3' and in line 6 is 'Unevaluated[2+3]', then one would have to explain why in line 3 the List function does not get '2+3' as its argument which, apparently, it does not. Neither ToString nor List have Hold Attributes of any kind.

Any insights or suggested reading would be appreciated.

enter image description here

POSTED BY: Terry Stewart
Posted 4 years ago

Terry:

What a great observation.

According to the documentation, after you expand all of the sections (especially the "Properties & Relations" section):

Unevaluated works only where it appears; it is not propagated.

Along with the examples, I take this to mean that the Wolfram Language does not expect variables to hold values that include Unevaluated[].

One of the items on my wish list is for the documentation to default to uncollapsed. I often find it difficult to guess which section has the info I need, so I end up opening every section every time.

Have a great and safe holiday.

POSTED BY: Mike Besso
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard