Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.8K Views
|
2 Replies
|
1 Total Like
View groups...
Share
Share this post:

[Solved] Obtaining attributes weird behavior can anyone explain this?

Posted 5 years ago
POSTED BY: Chess Denman
2 Replies

Well, as I understand, the clue you seek is actually inside the Attributes function. Or, more precisely, in the Attributes of the Attributes function. A line like

Attributes[Attributes]

returns a list

{HoldAll, Listable, Protected}

HoldAll attribute means that a function with this attribute does not perform any trasformations of the input arguments and "looks" at them just like you do. So, when you write Attributes[names[[3220]]] WL does not evaluate names[[3220]] and the Attributes function "sees" only the internal representation of names[[3220]] that is Part[names, 3220]. And the Head of this expression is Part, not something from Symbol, String or HoldPattern.

However, you can force Wolfram Language to evaluate the input of any function by calling the Evaluate function. Try running the following:

Attributes[Evaluate[names[[3220]]]]
POSTED BY: Nikolay Shilov
Posted 5 years ago

Wow, Thank you so much. That works Furthermore your answer was incredibly helpful. Chess

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