3

Consider the following:

tmpExpr = {1 a, 2 a, 3 a, 4 a} (*here a proxy for possibly a very long list*);
tmpIcon = Iconize[tmp, "my list"]

I think it would be useful if

Select[tmpIcon/.a->3, EvenQ]

would return the same thing as

Select[tmpExpr/.a->3, EvenQ]

Instead, one must do

Select[First[tmpIcon] /. a -> 3, EvenQ]

and this solution might be difficult for beginners to find.

Wouldn't it make sense to have an UnIconize[a_IconizedObject] that does effectively the same thing so that casual users can find it?

Would there be a fundamental problem to have an IconizedObject evaluate to its first argument for Evaluate[IconizedObject]?

Jagra
  • 14,343
  • 1
  • 39
  • 81
Craig Carter
  • 4,416
  • 16
  • 28
  • in your second line of code tmp should be tmpExpr – andre314 Jan 16 '21 at 11:40
  • 3
    This isn’t the way that iconized objects are meant to be used I think. When you write tmpIcon=Iconize[tmp, "my list"], you are supposed to highlight the Iconize expression and evaluate it in place, creating the icon. – Jason B. Jan 16 '21 at 12:57
  • 2
  • @JasonB. Thanks. I agree that it was probably not the intention that they be used that way (I did see Szbloc's post). The question is why not have an UnIconize. I think there are plausibly useful use cases, making one up here: sol = Iconize[Solve[a x^3 + b x^2 + c x + d == 0,x],"roots of polynomial"]; values = Function[{a,b,c,d},x/.UnIconize[sol]] – Craig Carter Jan 16 '21 at 16:55
  • @CraigCarter - in your example, what is the purpose of using Iconize? What does it add? – Jason B. Jan 16 '21 at 17:07
  • @JasonB. It has the advantage of things looking tidier perhaps. Isn’t that the main point of Iconize? – Craig Carter Jan 16 '21 at 18:26
  • It is tidier only if you use the output icon itself in an input somewhere. The icon evaluates as the list. tmpIcon is not the icon and does not represent the list, but the list can be extracted from it with First. – Jean-Pierre Jan 16 '21 at 19:13
  • The kernel version of UnIconize seems to be First: try First[tmpIcon]. Does that accomplish what you want? – Michael E2 Jan 16 '21 at 19:49
  • By the way, "Possible Issues" under Iconize spells out the difference between the output icon and the result of the evaluation creating the icon. – Jean-Pierre Jan 16 '21 at 20:16

1 Answers1

5

Normally we don't like code images posted on this site, but I think in this case we should allow it, so I'm going ahead. Consider the following.

code

Clicking on Uniconize in the drop-down list, will give the following expression:

Select[{a, 2 a, 3 a, 4 a} /. a -> 3, EvenQ]

So Uniconize exists as a front-end command, but not as a system function. It can also be accessed by choosing Un/Iconize Selection from the Edit menu. I believe that the Wolfram developers see no compelling use for an Uniconize kernel function. With Iconize, it is different. Iconize can take up to two arguments and a Method option (for indicating a compression method), so it needs to be implemented as a kernel function

You should also be aware that ref/Iconize > Properties & Relations discusses thus issue.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
  • Yes, I was aware of that. I am thinking of the case where you wouldn’t want to see the list—in a non-artificial scenario, the list could be several screens full of an expression. For example, the Solve case in the comments above. The question isn’t about how to do it, it is a question about why something is missing that I think is potentially useful for beginners. – Craig Carter Jan 16 '21 at 19:56
  • 2
    @CraigCarter I think it comes down to the design of the function - you aren't meant to write var = Iconize[...], no kernel variable in normal use should be set that way. Iconize is meant to store expressions in a notebook. So if you did a long computation and want the results in the notebook but don't want to look at them, do something like var = Solve[...]; Iconize[var, "solve result"] So the kernel still knows that var is the useful thing, and the notebook has a copyable and usable version of the result. – Jason B. Jan 16 '21 at 20:07
  • @CraigCarter. "I am thinking of the case where you wouldn’t want to see the list". Iconize handles that case beautifully — you just evaluate the Iconize expression in place. Now you have you giant expression shrunk down to where it takes up vyery little screen space but it is still easily accessed any time you want it – m_goldberg Jan 16 '21 at 20:26
  • 1
    @JasonB. Would you say that Iconize is similar to MatrixForm, in that it is a wrapper that affects display, which can be copied and used as input in the FE; however, when stored in a kernel variable, it no longer represents the data it wraps? (Or words to that effect.) – Michael E2 Jan 16 '21 at 21:08
  • I don't use MatrixForm very often myself, but what you describe sounds like a good comparison. – Jason B. Jan 17 '21 at 02:51