0
$\begingroup$

This question already has an answer here:

In the following case:

With[{x=1,y=2},Print[x+y]]

the values of x and y are declared in the list of local variables. How to transfer the values of x and y into With[] from an external list, like:

abc:={x=1,y=2}; With[abc,Print[x+y]]

This list of values must be understood in my case as true only when it is applied (locally true).

$\endgroup$

marked as duplicate by Jason B., Mr.Wizard Jan 8 '16 at 14:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ e.g. Unevaluated[With[abc, Hold[x + y]]] /. OwnValues[abc] there should be a nice duplicate somewhere. $\endgroup$ – Kuba Jan 8 '16 at 13:39
  • $\begingroup$ @Kuba - it's kind of hard to search for posts about With $\endgroup$ – Jason B. Jan 8 '16 at 13:47
  • 3
    $\begingroup$ May I suggest not to do this, because expressions like {x=1} evaluate naturally and their evaluation has significant consequences (setting x). They can be kept unevaluated, but it's difficult and error-prone to do so. Instead store the parameter values in a list of rules (or association) and use something like the withRules function I describe here. $\endgroup$ – Szabolcs Jan 8 '16 at 13:49
  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Jan 8 '16 at 13:57
  • 3
    $\begingroup$ (3864), (10322), (19758), (28610), (31708), (69590), (75417) $\endgroup$ – Mr.Wizard Jan 8 '16 at 14:32

Browse other questions tagged or ask your own question.