20 lines
291 B
Ruby
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
|