Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Control@{h[3], 0, 1}

It is puzzling. (The motive for h[i] is to build a list of controls.)

share|improve this question
up vote 6 down vote accepted

It seems that Control is just a wrapper for Manipulate`Control, and that function expects a Symbol as its first argument:

Control[]; (*preload*)

ClearAttributes[Manipulate`Control, {Protected, ReadProtected}]

Block[{$Context = "Manipulate`Dump`"},
 Definition[Manipulate`Control] // Print;
]
Manipulate`Control[var_, Manipulate`Dump`opts___Rule, ControlType -> type_, 
  opts2___Rule] := Manipulate`Control[var, type, Manipulate`Dump`opts, opts2]

Manipulate`Control[var_Symbol, Manipulate`Dump`opts : OptionsPattern[]] := 
 Manipulate`Control[var, Automatic, Manipulate`Dump`opts]

Manipulate`Control[{var_Symbol, args___}, Manipulate`Dump`opts : OptionsPattern[]] :=
  Manipulate`Control[{var, args}, Automatic, Manipulate`Dump`opts]

. . .

All but the first definition use _Symbol which requires that the Head of the expression be Symbol, and the first definition just calls one of the others.

This seems like an oversight as one can easily configure a slider with h[3]:

Dynamic[h[3]]
Slider[Dynamic[h[3]], {0, 1}]
share|improve this answer
    
Thank you @Mr.Wizard . The code you wrote is somewhat too complicated for me but I understand the comment following it. Manipulate too allows h[3]. But what is Manipulate`Control? – User18 Mar 1 at 16:33
1  
@User18 Manipulate`Control seems to be the internal function that Control is transformed into the course of evaluation and Front End formatting. I am attempting to follow internal definitions to arrive at this conclusion. The point is that if I am correct and Control relies upon Manipulate`Control, and the latter only works with Symbols, then the observed behavior is expected if disappointing. – Mr.Wizard Mar 1 at 17:05
    
That's most helpful. It is strange that in the MMA Documentation I cannot find information about it, nor the usage of the ` sign acting not as a number mark. Then where should I look them up? – User18 Mar 2 at 2:58
1  
@User18 Manipulate`Control is an internal, behind-the-scenes function and I would not expect to find documentation for it. The use of the backtick here is for Context; this Control is in the context Manipulate` . The regular Control is in the System` context. See: reference.wolfram.com/language/tutorial/Contexts.html – Mr.Wizard Mar 2 at 11:34
    
.@Mr.Wizard Having learned about contexts I now understand the code you posted. Thanks a lot! Ah, it seems we both had a little problem with typing code when the code contained the code wrapper. – User18 Mar 2 at 14:15

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.