I am trying to achieve the functionality of the following command:

Manipulate[ z, {z, 0, 1}]

but with passing the list of parameters into Manipulate from and external list, e.g.

list = {z, 0, 1};
Manipulate[ z, list ]

but with this syntax I recieve the following error:

Manipulate::vsform: "Manipulate argument \!\(ToExpression[{\"z\", 0, 1}]\) does not have the correct form for a variable specification"

How can I overcome this?


2 Answers 2

list = {z, 0, 1};
Manipulate[z, Evaluate@list]

enter image description here

Manipulate has attribute HoldAll,

{HoldAll, Protected, ReadProtected}


all arguments to a function are to be maintained in an unevaluated form

Using Evaluate@list makes Manipulate see {z,0,1} rather than the symbol list.


In addition to what kguler has said, you can also inject with With:

With[{l = list}, Manipulate[z, l] ]


Manipulate[z, #] &[list]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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