You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current setup of Set#to_a& has the following example in the docs: # Set{1, 2, 3, 4, 5}.to_a { |i| i // 2 } # => [0, 1, 2], which doesn't seem about right since there should be 5 elements present, as well as looking at the method so doesn't it actually do anything with the accepted block:
def to_a(& : T -> U) : Array(U) forall U
array = Array(U).new(size)
@hash.each_key do |key|
array << key
end
array
end
Hum, the implementation is indeed wrong, as it never calls the block, but the documentation may still be correct about the intent of filtering duplicates 😕
I tried looking at Ruby, but there's no Set#to_a(&) method.
The current setup of
Set#to_a&
has the following example in the docs:# Set{1, 2, 3, 4, 5}.to_a { |i| i // 2 } # => [0, 1, 2]
, which doesn't seem about right since there should be 5 elements present, as well as looking at the method so doesn't it actually do anything with the accepted block:Link to the method in code:
crystal/src/set.cr
Line 390 in 096f89b
The text was updated successfully, but these errors were encountered: