def unify(other)
return other.unify(self) if Array === other
return self if other == self and (not self.unknown?)
return self if other.nil?
if self.unknown? and other.unknown? then
self.type = other.type
self.list = other.list? or self.list?
elsif self.unknown? then
self.type.contents = other.type.contents
self.list = other.list?
elsif other.unknown? then
other.type.contents = self.type.contents
other.list = self.list?
elsif self.function? and other.function? then
self_fun = self.type.contents
other_fun = other.type.contents
self_fun.unify_components other_fun
else
raise TypeError, "Unable to unify #{self.inspect} with #{other.inspect}"
end
return self
end