======================================================= I welcome VSRE emails. Learn more at http://vsre.info/ =======================================================
--
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 elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/576949a3-93e2-4117-b1f1-ab4621f10e88%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.
The reason `Function.identity/1` was added after it was requested many times previously, was that at some point everyone agreed that it would improve Elixir's documentation, because it is easier to search for than `&(&1)`.
The `const` pattern is much less wide-spread. In e.g. Haskell it sees some use in places where it is the single (or at least by far the simplest) way to make things typecheck in a pure functional environment.
In Elixir, I suspect that it would be used much less commonly. The fact that our functions contain statements that are executed from top to bottom and rebindable variable names means that we are even less likely to use it anywhere.
As such, I don't think `const` is a function that is important
enough to include in the standard library.
Of course, I'm very much open to evidence of the contrary ^_^. Do
you have any example code of where you'd see `const` being useful?
~Marten/Qqwy
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/f8b6009d-e21a-434a-96e0-e2c6ae3c1a0e%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/f8b6009d-e21a-434a-96e0-e2c6ae3c1a0e%40googlegroups.com.
Stream.repeatedly( fn -> :padding end) |> Enum.take(4)
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/294d4f77-6b91-4316-a152-0c209fad12db%40googlegroups.com.
I’d argue back that this particular pattern, where you want a list of fixed length with the same value, is much better served by `List.duplicate/2`.
I think in general, higher order combinator functions like identity, const, flip, and friends are usually used to facilitate the point-free style of programming in languages like Haskell. And in general point-free style usually does not lead to the most readable code.
Again, referring to the example provided, if I know anonymous functions, I know what’s going on. When using `Funcion.const`, I have to understand that concept as well. There’s one extra thing to learn.
Michał.
Regards,
Bruce Tate
CEO
--
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
elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6%3DfheYjjyQ7xiWYkP0B0t%2BfoGae9OGtkDDSvSpD4s_Sg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/294d4f77-6b91-4316-a152-0c209fad12db%40googlegroups.com.
--
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 elixir-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6%3DfheYjjyQ7xiWYkP0B0t%2BfoGae9OGtkDDSvSpD4s_Sg%40mail.gmail.com.
On Feb 4, 2020, at 07:35, Ben Wilson <benwil...@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/1a49eabe-6509-41c7-b425-21e207737472%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/05581EC8-0AF0-4301-8B45-4F0B78544B2D%40binarynoggin.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/1a49eabe-6509-41c7-b425-21e207737472%40googlegroups.com.
--
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 elixir-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/05581EC8-0AF0-4301-8B45-4F0B78544B2D%40binarynoggin.com.
> The code Function.constant(c) is much more expressive and descriptive than fn _ -> c end.To be clear, if this could work without macros, I'd be inclined to agree, although I recognize that there may be some who do not. My issue personally is that there simply isn't any function you can write that will behave this way, for all values of `c`. You could build `constant` as a macro, but I think that ends up killing the whole "name a concept" thing, because really the dominant concept at hand ends up being how macros work.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/89aa185d-368d-4c95-ac41-d5e91f343b7b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/89aa185d-368d-4c95-ac41-d5e91f343b7b%40googlegroups.com.
On Feb 5, 2020, at 15:16, Jesse Claven <jesse....@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/c7496796-b29c-4039-b95d-c76bb7d9c6a1%40googlegroups.com.