casey/rw_rules.rb
2023-05-09 21:20:50 -04:00

20 lines
291 B
Ruby

# frozen_string_literal: true
require 'rule'
def rule(*args)
Rule.new(*args)
end
# not a simp rule! (loops)
def add_assoc
rule(
[%i[a + b], :+, :c] => [:a, :+, %i[b + c]]
).forall(:a, :b, :c)
end
RW_RULES = [
add_assoc,
rule(%i[a + b] => %i[b + a]).forall(:a, :b)
].freeze