Permalink
Browse files

Refactor VersionSpace#generalize.

  • Loading branch information...
1 parent 24d1d99 commit a5c2600973d9904e938a32dd8a0e18f269cc9943 @arthurschreiber committed Apr 12, 2011
Showing with 5 additions and 7 deletions.
  1. +5 −7 ruby/lib/version_space.rb
View
@@ -75,13 +75,11 @@ def more_general?(a, b)
end
def generalize(hyp1, hyp2)
- return [] if hyp1 == []
-
- hyp1.each_with_index.map do |item, index|
- if item == :_
- hyp2[index]
- elsif hyp2[index] == :_ || item == hyp2[index]
- item
+ hyp1.zip(hyp2).map do |a, b|
+ if a == :_
+ b
+ elsif a == b || b == :_
+ a
else
:*
end

0 comments on commit a5c2600

Please sign in to comment.