Dear All,
I cannot find in the help how to access the values of switches. What I actually wanted to do, is to save the value of a switch at the start of an included file (e.g., echo), set it to something (off), do what that file does, and then set it back to its original value. All the stuff I wrote is in normal algebraic mode.
Can someone point me in the right direction?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The setting of a switch called switch is represented by the value of the lisp variable !switch: the value is t for on and nil for off. However, changing the settings of some switches runs additional code, so in general you can't just change the value of !switch to change the switch setting. To save and then reset the switch called switch from algebraic-mode code, you could do this:
global '(oldswitch!*);
symbolic << oldswitch! := !switch; off1 'switch >>; % or use on1 to turn the switch on.
Include your code here.
symbolic onoff('switch, oldswitch!*);
Note that I haven't checked that the code above runs correctly. If you have trouble with it then you are welcome to email me privately.
If you want to see how switches work then please see the file packages/rlisp/switch.red in the REDUCE source code tree.
Dear All,
I cannot find in the help how to access the values of switches. What I
actually wanted to do, is to save the value of a switch at the start of an
included file (e.g., echo), set it to something (off), do what that file does,
and then set it back to its original value. All the stuff I wrote is in normal
algebraic mode.
Can someone point me in the right direction?
Dear All,
I cannot find in the help how to access the values of switches. What I actually wanted to do, is to save the value of a switch at the start of an included file (e.g., echo), set it to something (off), do what that file does, and then set it back to its original value. All the stuff I wrote is in normal algebraic mode.
Can someone point me in the right direction?
Thank you.
The setting of a switch called switch is represented by the value of the lisp variable !switch: the value is t for on and nil for off. However, changing the settings of some switches runs additional code, so in general you can't just change the value of !switch to change the switch setting. To save and then reset the switch called switch from algebraic-mode code, you could do this:
global '(oldswitch!*);
symbolic << oldswitch! := !switch; off1 'switch >>; % or use on1 to turn the switch on.
Include your code here.
symbolic onoff('switch, oldswitch!*);
Note that I haven't checked that the code above runs correctly. If you have trouble with it then you are welcome to email me privately.
If you want to see how switches work then please see the file packages/rlisp/switch.red in the REDUCE source code tree.
Francis
Thank you. Your code works.