Project

General

Profile

Actions

Bug #8801

closed

Splatted assignment with Enumerator::Lazy

Bug #8801: Splatted assignment with Enumerator::Lazy

Added by Anonymous over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-08-18) [x86_64-darwin11.4.2]
[ruby-core:56713]

Description

Actual:

a = [1,2,3].lazy
=> #<Enumerator::Lazy: [1, 2, 3]>
b, *c = a
=> #<Enumerator::Lazy: [1, 2, 3]>
b
=> #<Enumerator::Lazy: [1, 2, 3]>
c
=> []

Expected:

a = [1,2,3].lazy
=> #<Enumerator::Lazy: [1, 2, 3]>
b, *c = a
=> #<Enumerator::Lazy: [1, 2, 3]>
b
=> 1
c
=> [2, 3]

Basically, I expect a lazy array to act like a non-lazy one, and that using a destructuring assignment like this is basically the same as calling #take(1) and #drop(1).

Actions

Also available in: PDF Atom