Skip to content

Different arguments for each.map vs each and map alone #9032

Description

@headius

I found a difference between each.map and each / map

# jruby 10.0.2.0 (3.4.2) 2025-08-07 cba6031bd0 Java HotSpot(TM) 64-Bit Server VM 24.0.2+12-54 on 24.0.2+12-54 +indy +jit [arm64-darwin]
[[[1]]].each {|a,b| p [a,b] }     # [[1], nil]
[[[1]]].map {|a,b| p [a,b] }      # [[1], nil]
[[[1]]].each.map {|a,b| p [a,b] } # [1, nil] (should be the same as above two)

Actual code I was writing: array_of_tuple.each_slice(2).map {|a, b| ... }

Originally posted by @tompng in #8435

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions