Bruce: As pointed out previously, It's a bad default for Enum.reject. It
would leave you with just the nil values. It might be an ok default for
Enum.filter though.

On Fri, Nov 18, 2016 at 1:01 PM Bruce Tate <[email protected]> wrote:

> The identify function is effectively already the default for Enum.all? and
> any?, and a few others as well.
>
> Why not make it the default for Enum.reject too?
>
> -bt
>
> On Thu, Nov 17, 2016 at 4:13 PM, OvermindDL1 <[email protected]>
> wrote:
>
> Yeah you could do `&(&1)` or so for an inline identity, though definitely
> not as clear.  :-)
>
> Constant is not as succinct though:  `&(fn->&1 end)`
> And still not clear.  ^.^
>
>
> On Thursday, November 17, 2016 at 12:14:39 PM UTC-7, Drew Olson wrote:
>
> Ignore my comment about not being about to use the shorter function
> syntax. I was confused about the precedence of &.
>
> On Thu, Nov 17, 2016 at 1:08 PM, Drew Olson <[email protected]> wrote:
>
> I've also often wished for an identity/1 in Kernel, especially because you
> cannot easily represent it with the short function syntax.
>
> On Thu, Nov 17, 2016 at 12:33 PM, OvermindDL1 <[email protected]> wrote:
>
> `identity : 'a -> 'a` is the most common function declaration like that in
> almost every functional language, would be nice to have in kernel.
>
>
> On Thursday, November 17, 2016 at 10:48:20 AM UTC-7, Louis Pop wrote:
>
> Hiya
>
> I'd like an identity function in Kernel, that's for sure.
>
> I think an identity function being the default argument to filter would be
> quite nice. I find reject a bit strange, I don't set why it exists when we
> have filter.
>
> Cheers,
> Louis
>
> On Thu, 17 Nov 2016, 17:40 Tallak Tveide, <[email protected]> wrote:
>
> I assume you mean the default function should be
>
> '''
> fn x -> !x end
> '''
>
> To reject any falsey value. It does seem reasonable, but I dont think it
> is nearly as readable as 'compact', so I vote nay to this one...
>
> In fact, isn't this a better option? (Or equally good)
>
> '''
> def filter(enum, fun \\ fn x -> x end)
> '''
>
> Actually I have also thought that a 'unity' or 'itself' function should be
> part of stdlib, to make this possible as:
>
> '''
> list
> |> Enum.filter(&itself)
> '''
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/06bc7738-3ed9-4a21-9fce-b7eb3fecd600%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/07571247-7dba-4a21-948d-89f7ac335f92%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/07571247-7dba-4a21-948d-89f7ac335f92%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/8c4a990c-77be-4d00-857b-9a26c59715f9%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/8c4a990c-77be-4d00-857b-9a26c59715f9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Bruce Tate
> President, RapidRed, LLC
> Phone: 512.772.4312 <(512)%20772-4312>
> Fax: 512 857-0415 <(512)%20857-0415>
>
> Author of Seven Languages in Seven Weeks, Deploying Rails Applications,
> From Java to Ruby, Rails: Up and Running, Beyond Java, 6 others.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAMp4_igw0oQsX3Q0i8KZ0mZqBMsdsxdzMGtSM-r4eGa7QtS5Yg%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAMp4_igw0oQsX3Q0i8KZ0mZqBMsdsxdzMGtSM-r4eGa7QtS5Yg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAOMhEnwd7LM2PeCNq_Lf0y5%2BB-druhB1bRTv1OgwxPRrMczDYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to