casey/rw_rules.rb

20 lines
291 B
Ruby
Raw Permalink Normal View History

2023-05-09 21:20:50 -04:00
# 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