Inline FISH or FISH Fragments
In addition to the @ symbol convention, there is an alternate syntax for connecting FISH to the command line. Anything found inside square brackets [] is recognized and treated as inline FISH. Its contents are interpreted as a FISH function in-place and immediately evaluated, with the result being substituted as if an @ symbol were found. This can save the user from setting up a large number of global symbols that exist as trivial extensions of base parameters. Brackets [] can be used to delimit FISH code that will be executed “inline” in a command. For example:
ball create id [ballID] position [ballPos] radius [ballRad]
FISH fragments can also be executed directly as a convenient shorthand for single-line FISH without having to create an explicit function:
[global fred = math.cos(4.5)]
[execute_my_imported_fish_intrisic(with,three,arguments)]
Note that inline FISH is parsed and executed every time an attempt to evaluate the token is made, which might happen several times while the command as a whole is processed. Be aware of possible side effects and efficiency issues.
Was this helpful? ... | PFC 6.0 © 2019, Itasca | Updated: Nov 19, 2021 |