Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I noticed that I often turn out to have a list of substitutions in the form

list = 
{
  {var1 -> value1, var2 -> value2, ..., varn -> valuen}, 
  {var1 -> value1, var2 -> value2, ..., varn ->  valuen}
}

and need to extract some of the values (for instance for plotting). I use the syntax

{var1, var2} /. # & /@ list

Is there a shorter one?

share|improve this question
    
@PinguinDirk I disagree with your reasoning. Function has very low precedence and everything before & will be "inside" Function. The FullForm is Hold[Map[Function[ReplaceAll[List[var1,var2],Slot[1]]],list]]. But still your solution is correct :P –  Jacob Akkerboom Jul 4 '13 at 13:30
2  
oh, right, let's delete that comment (as it is too late to edit) and just keep the idea: {var1, var2} /. list. Thank you sir for pointing that out! –  Pinguin Dirk Jul 4 '13 at 13:36
    
This question appears to be off-topic because it only applies to the poster's local situation and needs. –  m_goldberg Jul 4 '13 at 14:06
    
@PinguinDirk Thank you –  Fabio Dalla Libera Jul 4 '13 at 14:30
    
@m_goldberg I don't know how to reformulate the question as to make it more easily found by related searches. If you have any idea, please feel free to edit the title or content –  Fabio Dalla Libera Jul 4 '13 at 14:31

1 Answer 1

up vote 8 down vote accepted

Yes, remove the Map entirely. For example,

{a, b} /. {{a -> q, b -> r}, {a -> s, b -> t}}
(* {{q, r}, {s, t}} *)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.