def NewLoopWord((stack, dictionary)): ''' This command takes all the items on the stack and puts them into a tuple with the Loop Handler function in front of them. A Loop consumes the top item on the stack, then depending on it's "truth" either runs the commands in its tuple and repeats if it's true or stops looping altogether if it's false. Put the first command to run on the stack first, then the second, and so on, so that the last item to run is on the top of the stack when you run this command. ''' words = tuple(reversed(list(iterStack(stack)))) loop = (handle_loop, ) + words return (loop, ()), dictionary
def NewSeqWord((stack, dictionary)): ''' This command takes all the items on the stack and puts them into a tuple with the Sequence Handler function in front of them. The items on the stack should all be commands from the dictionary, either functions or combo commands. You get these by using the "lookup" command on the names of the functions you want. Put the first command to run on the stack first, then the second, and so on, so that the last item to run is on the top of the stack when you run this command. ''' words = tuple(reversed(list(iterStack(stack)))) seq = (handle_sequence, ) + words return (seq, ()), dictionary
def NewLoopWord((stack, dictionary)): ''' This command takes all the items on the stack and puts them into a tuple with the Loop Handler function in front of them. A Loop consumes the top item on the stack, then depending on it's "truth" either runs the commands in its tuple and repeats if it's true or stops looping altogether if it's false. Put the first command to run on the stack first, then the second, and so on, so that the last item to run is on the top of the stack when you run this command. ''' words = tuple(reversed(list(iterStack(stack)))) loop = (handle_loop,) + words return (loop, ()), dictionary
def NewSeqWord((stack, dictionary)): ''' This command takes all the items on the stack and puts them into a tuple with the Sequence Handler function in front of them. The items on the stack should all be commands from the dictionary, either functions or combo commands. You get these by using the "lookup" command on the names of the functions you want. Put the first command to run on the stack first, then the second, and so on, so that the last item to run is on the top of the stack when you run this command. ''' words = tuple(reversed(list(iterStack(stack)))) seq = (handle_sequence,) + words return (seq, ()), dictionary
def NewEnstackener((stack, dictionary)): stack = list(iterStack(stack)) stack.append(enstacken) stack = tuple(reversed(stack)) return (stack, ()), dictionary