Skip to main content
deleted 4 characters in body
Source Link
sjdh
  • 7.8k
  • 5
  • 38
  • 48

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules?

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 6}, {a -> 7, b -> 8, c -> 9}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 6}, {a -> 7, b -> 8, c -> 9}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules?

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 6}, {a -> 7, b -> 8, c -> 9}}

This is how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}
Tweeted twitter.com/#!/StackMma/status/180580195990904832
corrected numbers in formula
Source Link
sjdh
  • 7.8k
  • 5
  • 38
  • 48

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 56}, {a -> 67, b -> 78, c -> 89}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 5}, {a -> 6, b -> 7, c -> 8}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 6}, {a -> 7, b -> 8, c -> 9}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}
Source Link
sjdh
  • 7.8k
  • 5
  • 38
  • 48

From a list to a list of rules

Starting from these two lists,

var = {a, b, c} 
values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}}

how can I generate a list of rules

rules = {{a -> 1, b -> 2, c -> 3}, {a -> 4, b -> 5, c -> 5}, {a -> 6, b -> 7, c -> 8}}

This is what how far I have got

In: {{a, b, c}, {1, 2, 3}} // Transpose
In: Rule @@@ %
Out: {{a, 1}, {b, 2}, {c, 3}}
Out: {a -> 1, b -> 2, c -> 3}