ruby picture

RCR 156: Enumerable#zip(an_enumerable)

Submitted by flgr (Wed Oct 01 19:10:40 UTC 2003)

Abstract

This is a legacy RCR from Ruby Garden, submitted by flgr. Matz has declared these RCRs obsolete, and asked that their authors resubmit them in the new format.

I'm not sure whether this is a bug or just a missing feature, but #zip seems to be lacking some symmetry:

("a".."b").zip([1, 2]) # => [["a", 1], ["b", 2]]
[1, 2].zip("a".."b") # TypeError: cannot convert Range into Array

IMHO both should produce the same result which I'd assume to be no exception.

Problem

(RCR imported from old format)

Proposal

Analysis

(RCR imported from old format)

Implementation

(RCR imported from old format)
ruby picture
Comments Current voting

Re: Enumerable#zip(an_enumerable) (, 2003-10-02 18:17:25)

huh, Range#to_ary seems to be not-defined, while to_a is... any particular reason why that implicit casting is missing?

Kero.


Strongly opposed 0
Opposed 0
Neutral 0
In favor 0
Strongly advocate 0
ruby picture
If you have registered at RCRchive, you may now sign in below. If you have not registered, you may sign up for a username and password. Registering enables you to submit new RCRs, and vote and leave comments on existing RCRs.
Your username:
Your password:

ruby picture

Powered by .