To clarify a little why you cannot do this, you need to know more about what a tuple is in SML.
Tuples are actually represented as entries in SML. Remember that entries are of the form {id = expr, id = expr, ..., id = expr} , where each identifier is a label.
The difference in tuples and records is given by how you index the elements in the tuple: # 1, # 2, ... (1, "foo", 42.0) is a derived form (equivalent to c) {1 = 1, 2 = "foo", 3 = 42.0} . This is perhaps best seen by the type that SML / NJ gives to this entry.
- {1 = 1, 2 = "foo", 3 = 42.0}; val it = (1,"foo",42.0) : int * string * real
Note. The type is not displayed as a record type, for example {1: int, 2: string, 3: real} . The tuple type is again a derived form of the record type.
In fact, #id not a function, and therefore it cannot be called with a variable as an "argument". This is actually a derived form (note the line of the wildcard pattern matching the pattern)
fn {id=var, ...} => var
So, in conclusion, you will not be able to do what you do not want, because these derived forms (or syntactic sugar, if you want) are not dynamic.