# New Ticket Created by  Jan-Olof Hendig 
# Please include the string:  [perl #129363]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129363 >


While discussing RT #129321 TimToady found another problem with duckmap, see

http://irclog.perlgeek.de/perl6/2016-09-26#i_13285724

The problem can be shown with a couple of examples, one with duckmap where
structure is lost

dogbert@dogbert-VirtualBox ~/repos/rakudo $ ./perl6 -e 'my @a = [1,
[2,3],4]; dd duckmap(-> Int $x { $x ~~ Int ?? $x !! Any }, @a)'
(1, (2, 3), 4)

According to TimToady the result should have been

[1, [2, 3], 4]

deepmap, on other hand, does retain structure as can be shown with

dogbert@dogbert-VirtualBox ~/repos/rakudo $ ./perl6 -e 'my @a = [1,[2,3],4];
say @a.deepmap({ $_ + 1 })'
[2 [3 4] 5]

/dogbert17


Reply via email to