Hi Chris,
I am trying to design a protocol with 4 different types of blocks. Right now, I am managing one variable that decides the block type and use them to evaluate 4 different conditional transitions in a state to branch out.
I am trying to design the code in a way such that I can also load individual task protocols that only run that type of block. For this, it would be nice if I could somehow use something like a dictionary from block/task type to appropriate state name string, and just have the following transition that will allow me to branch out, so that I can just reuse that code for whatever purposes:
goto (
target = typeToStateDict[taskType]
)
This currently doesn’t seem possible – it seems that the literal string is taken to be the state name. Is this unavoidable? If so, is there any way to make the target state of a transition dependent on a variable, without having to define multiple conditional transitions? While this is not strictly necessary, I think it would help manage the code in a easier way for me.
Separately, on a similar note, is there a functional programming-like way to pass in a macro or function (f1) as a parameter/argument into another macro (f2), so that I can run different f1’s within f2 in a flexible way by simply changing the argument? I would guess that this is difficult, but would be great if this is possible!