Reputation: 49
I have a list of variables {a,b,c,d} (the lists I have are much bigger, this is a small example). I want to make the following list: {a->1, b->1, c->1, d->1}. I tried {a,b,c,d}->1, but this does not work and I dont know how to search for the right keywords.
Upvotes: 1
Views: 278
Reputation: 4341
That is pretty easy in Mathematica:
Thread[{a, b, c} -> 1]
Now, that you know this one function Thread
, go into the documentation center and read through the material. Then you can look at the very bottom of the doc-page and you find plenty of guides and related functions that give you hints on where to go from there.
Upvotes: 2