   # end
 
   # Rotate the top 3 values on the data_stack down (assuming top element is bottom-most, like an RPN calculator)
-  def compute([ "ROT3V" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [y, z, x | data_stack], return_stack, dict)
-  end
-  def compute([ "rot3v" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [y, z, x | data_stack], return_stack, dict)
+  inanycase :rot3v, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [x, y, z | data_stack], return_stack, dict) do
+      compute(remaining_input, [y, z, x | data_stack], return_stack, dict)
+    end
   end
 
   # Rotate the top 3 values on the data_stack up (assuming top element is bottom-most, like an RPN calculator)
-  def compute([ "ROT3^" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [z, x, y | data_stack], return_stack, dict)
-  end
-  def compute([ "rot3^" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [z, x, y | data_stack], return_stack, dict)
+  inanycase :"rot3^", fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [x, y, z | data_stack], return_stack, dict) do
+      compute(remaining_input, [z, x, y | data_stack], return_stack, dict)
+    end
   end
 
   # Assume "rot" is equivalent to "rot3^" for now
-  def compute([ "ROT" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [z, x, y | data_stack], return_stack, dict)
-  end
-  def compute([ "rot" | remaining_input], [x, y, z | data_stack], return_stack, dict) do
-    compute(remaining_input, [z, x, y | data_stack], return_stack, dict)
-  end
-
-  def compute([ "-ROT" | remaining_input], data_stack, return_stack, dict) when is_list(data_stack) do
-    compute(["rot", "rot" | remaining_input], data_stack, return_stack, dict)
-  end
-  def compute([ "-rot" | remaining_input], data_stack, return_stack, dict) when is_list(data_stack) do
-    compute(["rot", "rot" | remaining_input], data_stack, return_stack, dict)
+  inanycase :rot, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
+      compute([ "rot3^" | remaining_input], data_stack, return_stack, dict)
+    end
+  end
+
+  inanycase :"-rot", fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
+      compute([ "rot3v" | remaining_input], data_stack, return_stack, dict)
+    end
   end
 
   # Comments

  end

  # now detect IFs. Note that if we're already inside an if-then block, it will match above and just accumulate
  def compute([ "IF" | remaining_input ], [x | data_stack], return_stack, dict) do
    compute(remaining_input, data_stack, [x, %{if: []} | return_stack], dict)
  end
  def compute([ "if" | remaining_input ], [x | data_stack], return_stack, dict) do
    compute(remaining_input, data_stack, [x, %{if: []} | return_stack], dict)
  end

  def compute([ "DO" | remainder ], [x, y | data_stack], return_stack, dict) do
    # The way this works is:
    # DO moves the index (0) and the control (5) over to the return stack.
    # I copies the top of the return stack to the data stack.
    # LOOP increments the index (top of return stack).
    # If the index is less than the control (one below the top of return stack),
    # then it reruns the commands from DO back to LOOP.
    # If the index is >=, then it pops the index and control from the
    # return stack, and control resumes as normal.
    compute(remainder, data_stack, [x, y, %{do: remainder} | return_stack], dict)
  end
  def compute([ "do" | remainder ], [x, y | data_stack], return_stack, dict) do
    compute(remainder, data_stack, [x, y, %{do: remainder} | return_stack], dict)
  end

  def compute([ "I" | remainder ], data_stack, [x, _y, %{do: _do_block} | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [x | data_stack], return_stack, dict)
  end

  def compute([ "i" | remainder ], data_stack, [x, _y, %{do: _do_block} | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [x | data_stack], return_stack, dict)
  end

  # note implementation difference/similarity to "i". "i" assumes a loop already on the return stack
  # (and pattern-matches on that), r@ does not
  def compute([ "R@" | remainder ], data_stack, [x | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [x | data_stack], return_stack, dict)
  end
  def compute([ "r@" | remainder ], data_stack, [x | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [x | data_stack], return_stack, dict)
  end

  def compute([ ">R" | remainder ], [n | data_stack], return_stack, dict) do
    compute(remainder, data_stack, [n | return_stack], dict)
  end
  def compute([ ">r" | remainder ], [n | data_stack], return_stack, dict) do
    compute(remainder, data_stack, [n | return_stack], dict)
  end

  def compute([ "R>" | remainder ], data_stack, [n | return_stack], dict) do
    compute(remainder, [n | data_stack], return_stack, dict)
  end
  def compute([ "r>" | remainder ], data_stack, [n | return_stack], dict) do
    compute(remainder, [n | data_stack], return_stack, dict)
  end

  def compute([ "J" | remainder ], data_stack, [_x, _y, %{do: _do_block}, z | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [z | data_stack], return_stack, dict)
  end
  def compute([ "j" | remainder ], data_stack, [_x, _y, %{do: _do_block}, z | _rest_of_return_stack] = return_stack, dict) do
    compute(remainder, [z | data_stack], return_stack, dict)
  end

  # loops. holy crap NESTED LOOPS WORK.
  def compute([ "LOOP" | remainder ], data_stack, [x, y, %{do: do_block} | return_stack], dict) do
    x = x + 1
    if x < y do
      compute(do_block, data_stack, [x, y, %{do: do_block} | return_stack], dict)
    else
      compute(remainder, data_stack, return_stack, dict)
    end
  end
  def compute([ "loop" | remainder ], data_stack, [x, y, %{do: do_block} | return_stack], dict) do
    x = x + 1
    if x < y do
      compute(do_block, data_stack, [x, y, %{do: do_block} | return_stack], dict)
    else
      compute(remainder, data_stack, return_stack, dict)
    end
  end
  def compute([ "+LOOP" | remainder ], [inc | data_stack], [x, y, %{do: do_block} | return_stack], dict) do
    x = x + inc
    if x < y do
      compute(do_block, data_stack, [x, y, %{do: do_block} | return_stack], dict)
    else
      compute(remainder, data_stack, return_stack, dict)
    end
  end
  def compute([ "+loop" | remainder ], [inc | data_stack], [x, y, %{do: do_block} | return_stack], dict) do
    x = x + inc
    if x < y do
      compute(do_block, data_stack, [x, y, %{do: do_block} | return_stack], dict)
    else
      compute(remainder, data_stack, return_stack, dict)
    end
  end


    data_stack
  end

  inanycase :end, fn funcname ->
    def compute([ unquote(funcname) | _ ], [last_elem_in_data_stack], [], _) do
      last_elem_in_data_stack
    end
  end

  inanycase :end, fn funcname ->
    def compute([ unquote(funcname) | _ ], data_stack, [], _) when is_list(data_stack) do
      data_stack
    end
  end

# If-Else-Then
