   end
 
   # true/false constants
-  def compute([ "FALSE" | remaining_input], data_stack, return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
-  end
-  def compute([ "false" | remaining_input], data_stack, return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
-  end
-
-  def compute([ "TRUE" | remaining_input], data_stack, return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-  def compute([ "true" | remaining_input], data_stack, return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-
-  def compute([ "AND" | remaining_input], [y, x | data_stack], return_stack, dict) do
-    out = if ((y != 0) and (x != 0)), do: -1, else: 0
-    compute(remaining_input, [out | data_stack], return_stack, dict)
-  end
-  def compute([ "and" | remaining_input], [y, x | data_stack], return_stack, dict) do
-    out = if ((y != 0) and (x != 0)), do: -1, else: 0
-    compute(remaining_input, [out | data_stack], return_stack, dict)
-  end
-
-  def compute([ "OR" | remaining_input], [y, x | data_stack], return_stack, dict) do
-    out = if ((y != 0) or (x != 0)), do: -1, else: 0
-    compute(remaining_input, [out | data_stack], return_stack, dict)
-  end
-  def compute([ "or" | remaining_input], [y, x | data_stack], return_stack, dict) do
-    out = if ((y != 0) or (x != 0)), do: -1, else: 0
-    compute(remaining_input, [out | data_stack], return_stack, dict)
-  end
-
-  def compute([ "NOT" | remaining_input], [0 | data_stack], return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-  def compute([ "not" | remaining_input], [0 | data_stack], return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-  def compute([ "NOT" | remaining_input], [_truthy | data_stack], return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
-  end
-  def compute([ "not" | remaining_input], [_truthy | data_stack], return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
-  end
-
-  def compute([ "INVERT" | remaining_input], [0 | data_stack], return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-  def compute([ "invert" | remaining_input], [0 | data_stack], return_stack, dict) do
-    compute(remaining_input, [-1 | data_stack], return_stack, dict)
-  end
-  def compute([ "INVERT" | remaining_input], [_truthy | data_stack], return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
-  end
-  def compute([ "invert" | remaining_input], [_truthy | data_stack], return_stack, dict) do
-    compute(remaining_input, [0 | data_stack], return_stack, dict)
+  inanycase :false, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
+      compute(remaining_input, [0 | data_stack], return_stack, dict)
+    end
+  end
+
+  inanycase :true, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
+      compute(remaining_input, [-1 | data_stack], return_stack, dict)
+    end
+  end
+
+  inanycase :and, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [y, x | data_stack], return_stack, dict) do
+      out = if ((y != 0) and (x != 0)), do: -1, else: 0
+      compute(remaining_input, [out | data_stack], return_stack, dict)
+    end
+  end
+
+  inanycase :or, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [y, x | data_stack], return_stack, dict) do
+      out = if ((y != 0) or (x != 0)), do: -1, else: 0
+      compute(remaining_input, [out | data_stack], return_stack, dict)
+    end
+  end
+
+  inanycase :not, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [0 | data_stack], return_stack, dict) do
+      compute(remaining_input, [-1 | data_stack], return_stack, dict)
+    end
+  end
+  inanycase :not, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [_truthy | data_stack], return_stack, dict) do
+      compute(remaining_input, [0 | data_stack], return_stack, dict)
+    end
+  end
+
+  inanycase :invert, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [0 | data_stack], return_stack, dict) do
+      compute(remaining_input, [-1 | data_stack], return_stack, dict)
+    end
+  end
+  inanycase :invert, fn funcname ->
+    def compute([ unquote(funcname) | remaining_input], [_truthy | data_stack], return_stack, dict) do
+      compute(remaining_input, [0 | data_stack], return_stack, dict)
+    end
   end
 
   # Rotation

# Basically going through implementing all the functionality illustrated at:
# https://www.forth.com/starting-forth/

defmodule RPNForthThing do

  def remove_backslashed_text(input) when is_binary(input) do
    Regex.replace(~r/\\(?:[^\n])*\n/m, input, "\n")
  end

  defguard map_key?(map, key) when is_map(map) and :erlang.is_map_key(key, map)

  def initialize do
    initialize(System.argv)

  end

  # negate (similar)
  inanycase :negate, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], [n | data_stack], return_stack, dict) do
      compute(remaining_input, [-n | data_stack], return_stack, dict)
    end
  end

  # random numbers
  inanycase :rand, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
      compute(remaining_input, [:rand.uniform | data_stack], return_stack, dict)
    end
  end

  # max
  inanycase :max, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], [a, b | data_stack], return_stack, dict) do
      max = case a < b do
        true -> b
        false -> a
      end
      compute(remaining_input, [max | data_stack], return_stack, dict)
    end
  end

  # min
  inanycase :min, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], [a, b | data_stack], return_stack, dict) do
      min = case a < b do
        true -> a
        false -> b
      end
      compute(remaining_input, [min | data_stack], return_stack, dict)
    end
  end

  # abs
  inanycase :abs, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], [n | data_stack], return_stack, dict) do
      compute(remaining_input, [abs(n) | data_stack], return_stack, dict)
    end
  end

  # inspection. just spits out the remaining instructions, and the data_stack and dict states
  # Sort of, shockingly simple?
  inanycase :inspect, fn funcname ->
    def compute([ unquote(funcname) | remaining_input], data_stack, return_stack, dict) do
      IO.puts "Remaining instructions:"
      IO.inspect remaining_input
      IO.puts "Data Stack:"
      IO.inspect data_stack
      IO.puts "Return Stack:"
      IO.inspect return_stack
      IO.puts "Dictionary:"
      IO.inspect dict
      compute(remaining_input, data_stack, return_stack, dict)
    end
  end

  # Logic/Booleans
