Added a few notes to the #uxntal page on how to quote/unquote opcodes and functions. "Quoting" here means to defer an operation, as in in, evaluating it later. It's doubles as a little introduction to Uxn's self-modification patterns.
http://wiki.xxiivv.com/site/uxntal_immediate.html
http://wiki.xxiivv.com/site/uxntal_immediate.html
Potassium
in reply to Devine Lu Linvega • • •I still don't quite understand the use-case of leaving unexecuted opcodes on the stack though. In your example you use use quoting to apply an operation recursively to an array, but I imagine that a method could be written which gives identical results but does not use quoting. If that's the case then what's the advantage of writing unexecuted opcodes to the stack? There must be a reason. What am I missing?
Devine Lu Linvega
in reply to Potassium • • •You won't be needing this in the tutorials, although you might need to be familiar with the context of quoting/unquoting of subroutines.
This is just to illustrate the concept. In a calculator program for example, you might en up having to juggle the opcode literals on the stack.
Sometimes if I need to either do one of two things with a boolean, I might do:
( b -- res ) LIT2 ADD MUL ROT JMP SWP POP #00 STR $1