Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
Suppose we want to pass an arbitrary function onto another function (for example to draw a graph of a user-chosen function such as sin() or cos()). In ::SHE+ILA:: we use the "NONOP" operator, "&" for this (we may also use "&" in C++ to pass the address of a function or array without evaluating it, hence my choice of that symbol for the NONOP operator). Another use of "&" is for slicing an expression, i.e. splitting it up into its underlying characters, for example if we say "woo <:: 456" we specify woo as the numeric value 456. Remembering that ::SHE+ILA:: stores numerics in BCD, we may now say "ttyout &woo[1]" to print the value 4, or "ttyout &woo[3]" to print the value 6, thus selecting individual digits within the variable "woo". We can also select individual expressions within a function definition, for example if "myfun <:: [](){ ttyout "hello world"}" then &myfun[1] has the value ttyout, and &myfun[2] has the value "hello world"... and better still &myfun[2][1] is "h", and so on :)