On Thu Jul 04 09:28:09 2013, masak wrote:
> <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.

13:17 <+dalek> rakudo/nom: 07ef21e | duff++ | src/core/Any.pm:
13:17 <+dalek> rakudo/nom: Fixes RT #118755
13:17 <+dalek> rakudo/nom: review:
               https://github.com/rakudo/rakudo/commit/07ef21ed55

Closable with tests?

-- 
Will "Coke" Coleda

Reply via email to