# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #118755] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118755 >
<colomon> does this imply we should have (for instance) first-rw, which returns the container of the first value that smartmatches? <colomon> or perhaps more interestingly, grep-rw? <pmichaud> I think that .first perhaps ought to be "is rw" <pmichaud> grep is already rw-like, or should be. <pmichaud> grep returns the elements maching a criteria, not just the values matching a criteria <colomon> r: my @a = 1..10; @a.grep(* %% 2).>>++; say @a <camelia> rakudo 8a76ba: OUTPUT«1 3 3 5 5 7 7 9 9 11» * colomon 's head explodes <masak> if .grep works like that, surely .first should as well :) <masak> r: my @a = 1..10; @a.first(* %% 2).>>++; say @a <camelia> rakudo 8a76ba: OUTPUT«Cannot modify an immutable [BLA BLA BLA] * masak submits rakudobug <pmichaud> note that grep works like that in p5 as well * colomon is split between one side that says "THAT'S AWESOME!" and another that says "That's a grotesque distortion of what should be a nice functional method." <pmichaud> in some sense, it *is* a functional method in this form. It's returning exactly the elements that matched (the containers), without imposing a decontainerize operation on them <pmichaud> if you decontainerize, you're not getting the elements that matched, you're getting the values of the elements that matched.