Created
April 18, 2018 17:10
-
-
Save crcx/2ba73ba23239614f9c1d76a8e5e44511 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement `choose`, a conditional combinator which will execute one of | |
two functions, depending on the state of a flag. We take advantage of | |
a little hack here. Store the pointers into a jump table with two | |
fields, and use the flag as the index. Default to the *false* entry, | |
since a *true* flag is -1. | |
~~~ | |
: choice:true | |
d 0 | |
: choice:false | |
d 0 | |
: choose | |
i listlist | |
r choice:false | |
r choice:true | |
i liadfeca | |
r choice:false | |
i re...... | |
~~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment