Project

General

Profile

Actions

Bug #7706

closed

Lazy#zip should not call `lazy`

Added by marcandre (Marc-Andre Lafortune) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
r38825
Backport:
[ruby-core:51472]

Description

Current implementation of Lazy#zip has problems:

  1. calls lazy when this is not excepted, necessary nor documented. Any reason to not call each instead?

  2. calls lazy without checking previously for type:

    [1].lazy.zip(42) # =>NoMethodError: undefined method `lazy' for 42:Fixnum

    expected same as [1].zip(42), i.e. a TypeError

  3. inefficient in the case where all arguments are arrays

I'll address these when I get a chance. I don't understand why lazy is called instead of each though. Anyone?

Actions

Also available in: Atom PDF

Like0
Like0