[Proposal] identity function

392 views
Skip to first unread message

Alexey Nikitin

unread,
Jul 2, 2019, 5:23:47 AM7/2/19
to elixir-lang-core
Like Haskell's `id` or Clojure's `identity` or Ruby's `itself`

It can be very useful sometimes. Instead of writing ugly `&(&1)` it would much more attractive to write `&identity/1` or `&id\1`
Moreover this function is already used as a default argument for some higher-order function. For example `Enum.group_by(enumerable, key_fun, value_fun \\ fn x -> x end)`

Here are some examples

```
#=> [1, 2, 3, true, 1234]

'abcdaabccc' |> Enum.sort |> Enum.chunk_by(&identity/1)
#=> ['aaa', 'bb', 'cccc', 'd']

[1, 1, 2, 3, 3, 1, 1, 5, 5] |> Enum.chunk_by(&identity/1) |> Enum.map(&hd/1)
#=> [1, 2, 3, 1, 5]

Enum.group_by('abracadabra', &identity/1)
#=> %{97 => 'aaaaa', 98 => 'bb', 99 => 'c', 100 => 'd', 114 => 'rr'}

Enum.map([1, 2, 3, 4], &identity/1)
#=> [1, 2, 3, 4]
[1,2,3,nil, true, false, 1234] |> Enum.filter(&identity/1)
```

Роман Смирнов

unread,
Jul 2, 2019, 5:47:10 AM7/2/19
to elixir-lang-core
+1
Could be very handy sometimes.

вторник, 2 июля 2019 г., 12:23:47 UTC+3 пользователь Alexey Nikitin написал:

Wiebe-Marten Wijnja

unread,
Jul 2, 2019, 5:54:53 AM7/2/19
to elixir-lang-core
I would usually be against introducing concepts to the core's standard library that can be readily and easily expressed in user code.
However, in this case I think there are two strong arguments for including the identity function in the standard library:

1. It is a great tool to help people new to functional programming with their understanding.
2. It is a lot more clear in its purpose than `&(&1)` because it has a name. (c.f. earlier operators vs named functions discussions).

~Marten/Qqwy

Bruce Tate

unread,
Jul 2, 2019, 8:52:37 AM7/2/19
to elixir-l...@googlegroups.com
Strong +1 from me. 

I also think we need default functions for some Enum functions, such as filter. 

-bt

--
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/b6b3359a-582b-4b42-88d3-10674c6227a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Regards,
Bruce Tate
CEO

Chris Keathley

unread,
Jul 2, 2019, 11:26:18 AM7/2/19
to elixir-l...@googlegroups.com
I'm also in favor of including an `id` function.


For more options, visit https://groups.google.com/d/optout.


--
Chris

Amos King

unread,
Jul 2, 2019, 11:59:38 AM7/2/19
to elixir-l...@googlegroups.com
This is a basic of functional programming and has my vote. 

Amos King
CEO
Binary Noggin

Christopher Keele

unread,
Jul 2, 2019, 12:41:46 PM7/2/19
to elixir-lang-core
I'd cast my vote against this. The proposal seems to be:

1. Create a function named 'id' or some such
2. Put it in the Kernel namespace (so it need not be prefixed)

I've been doing a lot of python lately and they have a lot of things like this, including the same 'filter' global function mentioned in this thread.

Points against:

1. It'd suck to not be able to use 'id' as a variable name, and would conflict with a lot of existing code.
2. Alternative names to 'id' or namespacing it are not shorter than '&(&1)'
3. '&(&1)' is more open to change with requirements
4. Adopting 'id' within Kernel would encourage adding more utility functions to it, exacerbating 1, like the proposed 'filter' function
5. Not adopting it within the Kernel would be hard, as there's no real appropriate place for it elsewhere in standard lib, unlike Enum's 'filter'

Generally it's a nice idea, but I can't think of a great way to make it work, and it'd open the floodgates to more utility functions that I've come to find grating in day-to-day python development.

Just my two cents,
Chris K

Michał Muskała

unread,
Jul 2, 2019, 12:55:10 PM7/2/19
to elixir-lang-core
Because Elixir is a lisp-2 language, variables and functions are in different "namespaces". This means you can have local variables with names of local functions without any issues, but it also means you need different syntax when you want to call a function contained in a variable. Or formulated differently - variables can't shadow functions. For example, consider:
bar = &foo/0
bar.() #=> 1
bar() #=> 2

def foo(), do: 1
def bar(), do: 2
Having a Kernel.id/1 function would not preclude you from using variables called id.

Michał.
--

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.

Alexey Nikitin

unread,
Jul 2, 2019, 1:42:51 PM7/2/19
to elixir-lang-core
>    1. It'd suck to not be able to use 'id' as a variable name, and would conflict with a lot of existing code.

Michał Muskała gave brilliant and comprehensive answer

 >   2. Alternative names to 'id' or namespacing it are not shorter than '&(&1)'

length is not the main point. But semantics is

>    3. '&(&1)' is more open to change with requirements

It would be still available ))

>    4. Adopting 'id' within Kernel would encourage adding more utility functions to it, exacerbating 1, like the proposed 'filter' function

The first point is not a problem in sense of variables. And you still can exclude some auto-imported functions

>    5. Not adopting it within the Kernel would be hard, as there's no real appropriate place for it elsewhere in standard lib, unlike Enum's 'filter'

It's true. That's why we should do this :)


вторник, 2 июля 2019 г., 19:41:46 UTC+3 пользователь Christopher Keele написал:

Vadim Safonov

unread,
Jul 2, 2019, 2:20:00 PM7/2/19
to elixir-lang-core
+1 would be very convenient


вторник, 2 июля 2019 г., 12:23:47 UTC+3 пользователь Alexey Nikitin написал:
Like Haskell's `id` or Clojure's `identity` or Ruby's `itself`

Christopher Keele

unread,
Jul 2, 2019, 2:25:09 PM7/2/19
to elixir-l...@googlegroups.com
Derp, I knew that. Good point.

You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe.
To unsubscribe from this group and all its topics, 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/b2149582-b8ba-4759-99ac-a634f73f3243%40Spark.

José Valim

unread,
Jul 2, 2019, 2:40:45 PM7/2/19
to elixir-l...@googlegroups.com
Thanks Chris, it is important that someone being counter arguments, even if they can be disproved. :)

I definitely see how such a small function can be useful but, at the same time, I am not convinced about the name "identity".

I found it curious that Clojure actually have an identity function because the definition of Identity they use when talking about values and change is a more complex one (and one that really stuck with me):

> By identity I mean a stable logical entity associated with a series of different values over time


Of course, my interpretation above is likely uncommon and there are other interpretations of identity that would fit nicely.

Anyway, to move the discussion forward, can someone do a more complete survey on what this function are called in many of the other languages? I just want to make sure we do our due diligence before adding it to the language.

Thank you,

José Valim
Skype: jv.ptec
Founder and Director of R&D


Wiebe-Marten Wijnja

unread,
Jul 2, 2019, 4:00:50 PM7/2/19
to elixir-lang-core
>  Anyway, to move the discussion forward, can someone do a more complete survey on what this function are called in many of the other languages? I just want to make sure we do our due diligence before adding it to the language.

Haskell: id
Clojure: identity
Ruby: Object#itself (although this is a bound method that returns the receiver rather than an unbound function taking one parameter that returns it unchanged. It is the closest thing we have built-in in Ruby, however)
Racket (and some other Lisps): identity
Python: no built-in named identity function.
JS: no built-in named identity function.
PHP: no built-in named identity function.
Kotlin: no built-in named identity function.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-l...@googlegroups.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.

Ryan Winchester

unread,
Jul 2, 2019, 4:05:57 PM7/2/19
to elixir-l...@googlegroups.com

Allen Madsen

unread,
Jul 2, 2019, 4:47:15 PM7/2/19
to elixir-l...@googlegroups.com

Bruce Tate

unread,
Jul 2, 2019, 5:02:32 PM7/2/19
to elixir-l...@googlegroups.com
I could learn to like &id/1, and also think that &ident/1 fits Elixir's style of abbreviation. My vote is for either one of those. 

-bt


For more options, visit https://groups.google.com/d/optout.


--

Parker Selbert

unread,
Jul 2, 2019, 5:07:53 PM7/2/19
to elixir-l...@googlegroups.com
I’m in favor of the addition overall. The specific function name matters less to me, &identity/1 or &id/1 would be fine.

Greg Vaughn

unread,
Jul 2, 2019, 5:11:21 PM7/2/19
to elixir-l...@googlegroups.com
Can we have some fun with this? Maybe use the unicode "identical to" symbol? ≡
:-) (only half-joking)

-Greg Vaughn
> Groxio, LLC.
> 512.799.9366
> br...@grox.io
> grox.io
>
> --
> 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-7%3DfZ2r0a8Urxvg%2B5yHee0gmXZ%3DVVMTuNo05gSOgwkf%2Bg%40mail.gmail.com.

Rich Morin

unread,
Jul 2, 2019, 7:05:25 PM7/2/19
to elixir-lang-core
> On Jul 2, 2019, at 14:11, Greg Vaughn <gva...@gmail.com> wrote:
>
> Can we have some fun with this? Maybe use the unicode "identical to" symbol? ≡
> :-) (only half-joking)

It's great that Elixir supports Unicode (how else could we spell José?), but I
really hope that using Unicode doesn't become any sort of requirement. Among
other reasons is accessibility for the blind: braille displays don't really
play nicely with non-ASCII character sets...

-r

Tyson Buzza

unread,
Jul 2, 2019, 9:31:21 PM7/2/19
to elixir-lang-core
The existing way of doing this might allow beginners to develop a better intuition for the Elixir's capture operator.

For example consider this code for creating a lookup map from a list of maps:

```
lookup = Enum.map(map_list, & {&1.id, &2.name}) |> Enum.into(%{})
```

Knowing about `& &1` allowed me to then intuit that the `& {&1.id, &2.name}` bit of the code above might be possible.

Tyson Buzza

unread,
Jul 2, 2019, 9:38:23 PM7/2/19
to elixir-lang-core
In my post before, the code example I gave should have been `& {&1.id, &1.name}`


On Tuesday, July 2, 2019 at 5:23:47 PM UTC+8, Alexey Nikitin wrote:

Alexey Nikitin

unread,
Jul 3, 2019, 2:41:15 AM7/3/19
to elixir-lang-core
The name may be not the best. It has mathematical roots. But everyone is used to it. It's like "lambda" :) Who could ever imagine that the greek letter is an anonymous function.
But as well as "identity" is the most understandable and familiar name for fp-fans. People look for it by intuition https://stackoverflow.com/questions/35616191/is-there-an-identity-function-in-elixir

Thus I consider the "identity" name the best option

вторник, 2 июля 2019 г., 21:40:45 UTC+3 пользователь José Valim написал:
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-l...@googlegroups.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.

Виталий Миляков

unread,
Jul 3, 2019, 2:47:37 AM7/3/19
to elixir-lang-core
+1
Great Idea! 

Alexis Brodeur

unread,
Jul 3, 2019, 8:16:22 AM7/3/19
to elixir-lang-core
While this is a great idea, and I am overall in favor of an `Kernel.identity/1`, let me play devil's advocate for a bit...

According to lib/elixir/src/elixir_locals.erl, all `def`s in a module are validated to not clash against an already imported function from other modules.  By introducing `Kernel.identity/1`, modules in the wild already using a `identity/1` function would cease to compile, therefore making this change a breaking one, according to my current understanding of the compiler.

A simple `test.exs` module
```ex
defmodule Test do
  def test do
    inspect("term")
  end

  def inspect(term, opts \\ []) do
    IO.puts("my inspect/2")
  end
end

Test.test
```

against the current `master` of elixir yields:
```
== Compilation error in file /Users/brodeuralexis/test.exs ==
** (CompileError) /Users/brodeuralexis/test.exs:6: imported Kernel.inspect/1 conflicts with local function
    (elixir) src/elixir_locals.erl:94: :elixir_locals."-ensure_no_import_conflict/3-lc$^0/1-0-"/2
    (elixir) src/elixir_locals.erl:95: anonymous fn/3 in :elixir_locals.ensure_no_import_conflict/3
    /Users/brodeuralexis/test.exs:1: (file)
```

Tyson Buzza

unread,
Jul 3, 2019, 11:19:28 AM7/3/19
to elixir-l...@googlegroups.com
What about calling it the `passthrough` function? That way it does exactly what it says on the tin. This name comes from electronics rather than functional programming or math though.

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/c42c687b-681f-4863-9628-6819affd8738%40googlegroups.com.

Wiebe-Marten Wijnja

unread,
Jul 3, 2019, 11:32:38 AM7/3/19
to elixir-lang-core
I would be all for changing the way Kernel is imported to allow a name that exists in Kernel to be redefined (potentially generating a warning), because regardless of what name we choose, if this behaviour is not altered then adding any function to Kernel will be a breaking change.

On the other hand: I do not think this is the first time that a new function is added to kernel after 1.0 (or is it)? What approach was taken in those earlier cases?

~Marten/Qqwy

Rich Morin

unread,
Jul 7, 2019, 9:33:17 PM7/7/19
to elixir-l...@googlegroups.com
> On Jul 2, 2019, at 02:23, Alexey Nikitin <tank...@gmail.com> wrote:
>
> Like Haskell's `id` or Clojure's `identity` or Ruby's `itself`

In the spirit of bikeshedding, I'll submit that Clojure's `identity`
takes up too much space for my taste. So, I prefer Haskell's `id` or
perhaps Kotlin's `it`.

-r


Bruce Tate

unread,
Jul 8, 2019, 8:48:52 AM7/8/19
to elixir-l...@googlegroups.com
ooohhhh I really like *it*. 

To compress nils, 

Enum.filter( list, &it/1 )

id is likely to be pretty invasive and might be a more broadly breaking change. 

-bt

--
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.

For more options, visit https://groups.google.com/d/optout.


--

Regards,
Bruce Tate
CEO

Alexey Nikitin

unread,
Jul 8, 2019, 11:44:50 AM7/8/19
to elixir-lang-core

Please do not invent new names. It will only get worse

понедельник, 8 июля 2019 г., 4:33:17 UTC+3 пользователь Rich Morin написал:

Paul Schoenfelder

unread,
Jul 8, 2019, 11:58:53 AM7/8/19
to elixir-l...@googlegroups.com
My two cents: use `identity`, or `id` if it absolutely must be ridiculously concise, but keep it simple. In my opinion, functional programmers will almost universally expect one of those two, and everyone else probably won't care because the concept will be new to them. I can't say that I've found myself missing the lack of a standard library `identity` function thus far, but I can see the benefit in readability if we start seeing it replace usages of anonymous functions that just return their argument.

Paul
--
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.

Amos King

unread,
Jul 8, 2019, 12:03:06 PM7/8/19
to elixir-l...@googlegroups.com
I like identity because it is fairly standard and will probably not conflict with as many other libraries that are currently in the ecosystem. 


Amos King
CEO
Binary Noggin

Alexey Nikitin

unread,
Jul 12, 2019, 8:03:39 AM7/12/19
to elixir-lang-core
Any news here? @José Valim, let's do this. Almost everyone reacted to this with enthusiasm. It would be nice. Without this function elixir couldn't be a category :) Let's make elixir Lisp again!


вторник, 2 июля 2019 г., 21:40:45 UTC+3 пользователь José Valim написал:
Thanks Chris, it is important that someone being counter arguments, even if they can be disproved. :)
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-l...@googlegroups.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.

Chulki Lee

unread,
Jul 12, 2019, 12:59:49 PM7/12/19
to elixir-lang-core
I'm happy to see Elixir adopting FP concept here ([identity function](https://en.wikipedia.org/wiki/Identity_function)), but I'm not sure it's good to add it to `Kernel` (as it's imported by default!) - or even in Elixir core.

Why should we add this to Elixir core, instead of "extending" with module?

```elixir
defmodule FP do
  def identity(a), do: a
end

def module YourApp do
  import FP

  def hello do
    'abcdaabccc' |> Enum.sort |> Enum.chunk_by(&identity/1)
  end
end
```

For example, that library can be de-facto helper for such FP utility functions.

José Valim

unread,
Jul 12, 2019, 1:15:20 PM7/12/19
to elixir-l...@googlegroups.com
Generally speaking, I agree with Chulki Lee.

I understand the value of the identity function. But the cons of adding it to Kernel is that we partially take the name away from everyone else, unless they unimport it, and ultimately the implementation of identity/1 is not doing much to wararnt this loss.

José Valim
Skype: jv.ptec
Founder and Director of R&D

--
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/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.com.

Bruce Tate

unread,
Jul 12, 2019, 1:18:00 PM7/12/19
to elixir-l...@googlegroups.com
> Why should we add this to Elixir core, instead of "extending" with module?

I have been a big proponent of this for a long time because just about every code base uses the identity function and it's a barrier to those who would learn Elixir. 

Rather than import or call &FP.identity/1, most would just continue to use something like & &1, and that's generally tough on beginners. 

-bt

--
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/2e98526b-e83c-4b92-8035-26bce95da822%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Jul 12, 2019, 1:21:49 PM7/12/19
to elixir-l...@googlegroups.com
If the goal is teaching, then I think "fn x -> x end" beats both "&identify/1" and "& &1" in terms of clarity, as identity itself is still a concept that needs to be explained.


José Valim
Skype: jv.ptec
Founder and Director of R&D

Chulki Lee

unread,
Jul 12, 2019, 1:33:45 PM7/12/19
to elixir-lang-core
This is exact reason I'm against adding it to Kernel :) I already have a code using "identity". What would it happen when I upgrade to new Elixir version having this feature?)



Let's look at the list of functions/macros in Kernel  and its description - https://hexdocs.pm/elixir/Kernel.html
 
It mainly consists of:
  • basic language primitives, such as arithmetic operators, spawning of processes, data type handling, etc.
  • macros for control-flow and defining new functionality (modules, functions, and so on)
  • guard checks for augmenting pattern matching

I don't think this new addition (identity/1) does not fit well with Kernel.

Don't get me wrong - I *like* adopting such concepts in Elixir. There are already some functions using such common or mathematical terms (such as List.foldl/3)

However, adding it to Kernel should be more conservative. We cannot more and more such functions into Kernel only because 1) it's convenient and 2) there is not other places to hold it in Elixir core.


 


On Friday, July 12, 2019 at 10:15:20 AM UTC-7, José Valim wrote:
Generally speaking, I agree with Chulki Lee.

I understand the value of the identity function. But the cons of adding it to Kernel is that we partially take the name away from everyone else, unless they unimport it, and ultimately the implementation of identity/1 is not doing much to wararnt this loss.

José Valim
Skype: jv.ptec
Founder and Director of R&D


On Fri, Jul 12, 2019 at 6:59 PM Chulki Lee <chul...@gmail.com> wrote:
I'm happy to see Elixir adopting FP concept here ([identity function](https://en.wikipedia.org/wiki/Identity_function)), but I'm not sure it's good to add it to `Kernel` (as it's imported by default!) - or even in Elixir core.

Why should we add this to Elixir core, instead of "extending" with module?

```elixir
defmodule FP do
  def identity(a), do: a
end

def module YourApp do
  import FP

  def hello do
    'abcdaabccc' |> Enum.sort |> Enum.chunk_by(&identity/1)
  end
end
```

For example, that library can be de-facto helper for such FP utility functions.

--
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.

Bruce Tate

unread,
Jul 12, 2019, 4:28:30 PM7/12/19
to elixir-l...@googlegroups.com
:) all good. 

I do think that both & &1 and fn x -> x end  and & &1 are both harder to scan  than &identity/1 as it's almost always better to name a concept for a beginner (or most anyone, for that matter). In my classes we often write an identity function as an intermediate teaching step because I can name the concept. There's less to grok at once. 

But no big deal... if we're closing this I will respect your decision. 

José, what would you say to have the identity function as a default to things like Enum.filter and Enum.group_by? Some of the other Enumerable functions have defaults, such as sort. There's no breaking change and it obviates the need for the identity function in quite a few places. 

Examples: a word counter, where the words might be nil: 

words
|> Enum.filter
|> Enum.group_by
|> Map.new(fn {x, y} -> {x, length(y)} end)

Solves the problem of identity for some of the important use cases; no breaks of backward compatibility; discoverable through existing docs.
-bt



For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Jul 12, 2019, 4:43:40 PM7/12/19
to elixir-l...@googlegroups.com
Filtering nils may be considered bad practice (i.e. why do you have nils there?) so I think it should be done explicitly. And it may be more readable to do with Enum.reject(&is_nil/1).

Enum.group_by with identity by default has no purpose. You are only going to group the elements themselves. At best it is a count of the elements in the list, but not an efficient one at that.

Personally, the only time I recall needing &identity/1 is in Agent.get/2, but even there we want to force you to say what you want, to avoid unecessary data copy.


José Valim
Skype: jv.ptec
Founder and Director of R&D

Rich Morin

unread,
Jul 12, 2019, 5:10:14 PM7/12/19
to elixir-lang-core
> On Jul 12, 2019, at 13:43, José Valim <jose....@plataformatec.com.br> wrote:
>
> Filtering nils may be considered bad practice (i.e. why do you have nils there?)

I use them, on occasion, to support a "maybe" type.

> ... it may be more readable to do with Enum.reject(&is_nil/1).

Cool! I just replaced four instances of `Enum.filter(&(&1))` with `Enum.reject(&is_nil/1)`.
FWIW, I'd love to see an annotated collection of suggested Elixir idioms such as this one.

-r

Sven Gehring

unread,
Jul 13, 2019, 12:26:15 AM7/13/19
to elixir-l...@googlegroups.com
I definitely agree that it's better to import it from an additional module if need be.

If we ignore the Metaprogramming parts, Elixir has a very easy Syntax and the &(&1) notation is one of the only non-intuitive things to learn. Compared to other languages, there are virtually no 'weird' syntax elements you have to 'just remember' when you start out, so I am actually in favor of teaching people this shorthand instead of hiding it from them. (It's really not THAT complicated)

Also, as José said, you can always use "fn x -> x end", which is about the same length as "&identity/1" and also obvious in what it does.

I don't think expanding the Kernel just for the sake of adopting concepts of similar ecosystems is worth it. 

Sven

--
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.

Chris Keathley

unread,
Jul 14, 2019, 11:34:36 AM7/14/19
to elixir-l...@googlegroups.com
I understand that the desire from the core team isn't to add this. I'm OK with that decision despite feeling like it would be a good addition That's fine.

But I do take issue with this "slippery slope" argument that adding `identity` to Elixir would somehow open the door to numerous other functions being added to Elixir. Which is silly. Because we aren't talking about adding some untold number of functions to Elixir. We're talking about `identity`. If the core team had decided that `identity` was worth having in the language would we still not add it because later someone could add the `snausages` function? No. Of course not. That's a nonsensical argument. Improvements to the language should be considered on their own terms.


For more options, visit https://groups.google.com/d/optout.


--
Chris

Masoud Ghorbani

unread,
Jul 15, 2019, 3:30:45 AM7/15/19
to elixir-lang-core
Isn't possible to have something like JavaScript arguments which correspond with a list of parameters passed to function? 
its more handy to lookup a parameter in a list or map until working with a function to get a given parameter.


On Tuesday, July 2, 2019 at 11:10:45 PM UTC+4:30, José Valim wrote:
Thanks Chris, it is important that someone being counter arguments, even if they can be disproved. :)

I definitely see how such a small function can be useful but, at the same time, I am not convinced about the name "identity".

I found it curious that Clojure actually have an identity function because the definition of Identity they use when talking about values and change is a more complex one (and one that really stuck with me):

> By identity I mean a stable logical entity associated with a series of different values over time


Of course, my interpretation above is likely uncommon and there are other interpretations of identity that would fit nicely.

Anyway, to move the discussion forward, can someone do a more complete survey on what this function are called in many of the other languages? I just want to make sure we do our due diligence before adding it to the language.

Thank you,
José Valim
Skype: jv.ptec
Founder and Director of R&D
--

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/fffd5b76-4385-40de-93bd-148f1b94bb27%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe.
To unsubscribe from this group and all its topics, 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/b2149582-b8ba-4759-99ac-a634f73f3243%40Spark.

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 elixir-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAD9kT2R41gmZXU9_YAqAdyJQDP-M37j-mgUet-okoeBzF%3DdMDA%40mail.gmail.com.

Andrea Leopardi

unread,
Jul 15, 2019, 5:12:22 AM7/15/19
to elixir-l...@googlegroups.com
My 2 cents. To me a strong argument against this is that &identity/1 still looks confusing to newcomers with the capture syntax (how many "why can't I just write identity like in Js questions do we get after all), so summed with the other arguments against it makes me not want to add this to the language personally.

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/2bb429a8-e583-48c1-a335-8660c115b24f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Andrea Leopardi

Alexey Nikitin

unread,
Jul 18, 2019, 8:26:15 AM7/18/19
to elixir-lang-core
What's wrong with you? What planet are you from? Any functional language has this function. These are basic concepts of mathematics and functional programming. What a "slippery slope"? It's insane. This function just must to be here, that's all. The standard library has `fn x -> x end` everywhere. So if you didn't know, this thing has a name!

воскресенье, 14 июля 2019 г., 18:34:36 UTC+3 пользователь Chris Keathley написал:
I understand that the desire from the core team isn't to add this. I'm OK with that decision despite feeling like it would be a good addition That's fine.

But I do take issue with this "slippery slope" argument that adding `identity` to Elixir would somehow open the door to numerous other functions being added to Elixir. Which is silly. Because we aren't talking about adding some untold number of functions to Elixir. We're talking about `identity`. If the core team had decided that `identity` was worth having in the language would we still not add it because later someone could add the `snausages` function? No. Of course not. That's a nonsensical argument. Improvements to the language should be considered on their own terms.

On Sat, Jul 13, 2019 at 12:26 AM Sven Gehring <cbr...@gmail.com> wrote:
I definitely agree that it's better to import it from an additional module if need be.

If we ignore the Metaprogramming parts, Elixir has a very easy Syntax and the &(&1) notation is one of the only non-intuitive things to learn. Compared to other languages, there are virtually no 'weird' syntax elements you have to 'just remember' when you start out, so I am actually in favor of teaching people this shorthand instead of hiding it from them. (It's really not THAT complicated)

Also, as José said, you can always use "fn x -> x end", which is about the same length as "&identity/1" and also obvious in what it does.

I don't think expanding the Kernel just for the sake of adopting concepts of similar ecosystems is worth it. 

Sven

On Fri, Jul 12, 2019, 23:10 Rich Morin <r.d...@gmail.com> wrote:
> On Jul 12, 2019, at 13:43, José Valim <jose...@plataformatec.com.br> wrote:
>
> Filtering nils may be considered bad practice (i.e. why do you have nils there?)

I use them, on occasion, to support a "maybe" type.

> ... it may be more readable to do with Enum.reject(&is_nil/1).

Cool!  I just replaced four instances of `Enum.filter(&(&1))` with `Enum.reject(&is_nil/1)`.
FWIW, I'd love to see an annotated collection of suggested Elixir idioms such as this one.

-r

--
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.

--
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.


--
Chris

Louis Pilfold

unread,
Jul 18, 2019, 8:40:31 AM7/18/19
to elixir-lang-core
Hi Alexey

In this mailing list and in the Elixir community in general we want to create a friendly and welcoming environment. Please refrain from calling people's opinions "insane" and try to be respectful of others.

For more information please read the Elixir code of conduct

Thanks,
Louis


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/aa6ad3d9-abc6-4afb-b153-26491d3cc6b4%40googlegroups.com.

Alexey Nikitin

unread,
Jul 18, 2019, 11:13:30 AM7/18/19
to elixir-lang-core
I apologize for that. I was very upset about the revert. It was unacceptable. I am so sorry.

четверг, 18 июля 2019 г., 15:40:31 UTC+3 пользователь Louis Pilfold написал:

Bruce Tate

unread,
Jul 21, 2019, 8:48:13 AM7/21/19
to elixir-l...@googlegroups.com
I want to speak to the beginners argument.  I am not guessing. I spend 6-8 hours teaching and mentoring every week, and it's more when school is in. Concepts are easier to teach when those concepts have names and big concepts can be broken down into smaller ones. The students I teach are about 80% new to FP and about 40% new to programming in general. 

I will take the advice of mixing in FP.identity if it cuts against the grain of what Elixir is about. 

Thanks to all for making Elixir the best it can be... let's keep it civil. I think it makes a lot of sense to take José's suggestion and collect some of these concepts into a library and prove their worth there, to language learners and otherwise. 

-bt


For more options, visit https://groups.google.com/d/optout.


--

Chris McCord

unread,
Jul 30, 2019, 12:29:20 PM7/30/19
to elixir-l...@googlegroups.com
I’m just catching up on this thread now, but I’m in the “not valuable enough to be added” camp. I’ve personally never needed such an abstraction – on my own or while teaching. Also, an anon function serves the purpose when needed without introducing a new concept. From the beginner perspective, I think `identify` adds more noise where it isn’t needed. Even following this thread and reading other lang usage, I still find the name awkward and struggle to see it being a net benefit to my code vs what I’d happily write today. Given how trivial it is to return the value yourself in a concise and clear way, I don’t think the value of it squatting in kernel is enough to justify an addition to the std lib. 

Allen Madsen

unread,
Jul 30, 2019, 12:47:08 PM7/30/19
to elixir-l...@googlegroups.com
I don't have a strong opinion on this function's inclusion. It's not mandatory that it live in Kernel though. It could exist on Function.

Ben Wilson

unread,
Jul 30, 2019, 12:50:38 PM7/30/19
to elixir-lang-core
I think having Enum.filter(list, &Function.identity/1) actually reads pretty well. It avoids the issue with putting it in Kernel, and provides a very explicit name which speaks to Bruce's goal of naming concepts.
--

Andrea Leopardi

--
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.


--

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-l...@googlegroups.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.

Bruce Tate

unread,
Jul 30, 2019, 2:00:13 PM7/30/19
to elixir-l...@googlegroups.com
+1 from me. 

-bt

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/586eb969-e70d-44cb-98df-47b8f6c188d0%40googlegroups.com.

eksperimental

unread,
Jul 30, 2019, 11:40:52 PM7/30/19
to elixir-l...@googlegroups.com
`Function.identity/1`: I think you just hit the nail on the head with this one.

Nice middle ground
I'm +1 for this one.
> >>>> *> By identity I mean a stable logical entity associated with a series
> >>>> of different values over time*
> >>>>
> >>>> https://clojure.org/about/state#_working_models_and_identity
> >>>>
> >>>> Of course, my interpretation above is likely uncommon and there are
> >>>> other interpretations of identity that would fit nicely.
> >>>>
> >>>> Anyway, to move the discussion forward, can someone do a more complete
> >>>> survey on what this function are called in many of the other languages? I
> >>>> just want to make sure we do our due diligence before adding it to the
> >>>> language.
> >>>>
> >>>> Thank you,
> >>>>
> >>>> *José Valim*
> >>>> www.plataformatec.com.br
> >>>> Skype: jv.ptec
> >>>> Founder and Director of R&D
> >>>>
> >>>>
> >>>> On Tue, Jul 2, 2019 at 8:25 PM Christopher Keele <christ...@gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Derp, I knew that. Good point.
> >>>>>
> >>>>> On Tue, Jul 2, 2019 at 9:55 AM Michał Muskała <mic...@muskala.eu>
> >>>>> wrote:
> >>>>>
> >>>>>> Because Elixir is a lisp-2 language, variables and functions are in
> >>>>>> different "namespaces". This means you can have local variables with names
> >>>>>> of local functions without any issues, but it also means you need different
> >>>>>> syntax when you want to call a function contained in a variable. Or
> >>>>>> formulated differently - variables can't shadow functions. For example,
> >>>>>> consider:
> >>>>>>
> >>>>>> bar = &foo/0
> >>>>>> bar.() #=> 1
> >>>>>> bar() #=> 2
> >>>>>> def foo(), do: 1def bar(), do: 2
> >>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/fffd5b76-4385-40de-93bd-148f1b94bb27%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 a topic in
> >>>>>> the Google Groups "elixir-lang-core" group.
> >>>>>> To unsubscribe from this topic, visit
> >>>>>> https://groups.google.com/d/topic/elixir-lang-core/tB61BHYIH1s/unsubscribe
> >>>>>> .
> >>>>>> To unsubscribe from this group and all its topics, 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/b2149582-b8ba-4759-99ac-a634f73f3243%40Spark
> >>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/b2149582-b8ba-4759-99ac-a634f73f3243%40Spark?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 elixir-l...@googlegroups.com.
> >>>>> To view this discussion on the web visit
> >>>>> https://groups.google.com/d/msgid/elixir-lang-core/CAD9kT2R41gmZXU9_YAqAdyJQDP-M37j-mgUet-okoeBzF%3DdMDA%40mail.gmail.com
> >>>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAD9kT2R41gmZXU9_YAqAdyJQDP-M37j-mgUet-okoeBzF%3DdMDA%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 elixir-lang-co...@googlegroups.com.
> >>> To view this discussion on the web visit
> >>> https://groups.google.com/d/msgid/elixir-lang-core/2bb429a8-e583-48c1-a335-8660c115b24f%40googlegroups.com
> >>> <https://groups.google.com/d/msgid/elixir-lang-core/2bb429a8-e583-48c1-a335-8660c115b24f%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>>
> >> --
> >>
> >> Andrea Leopardi
> >> an.le...@gmail.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-lang-co...@googlegroups.com.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/elixir-lang-core/CAM9Rf%2BJEN7vuwxxZFkrB8NytCCaSPAKtroMeA1sqe91n5SoFXg%40mail.gmail.com
> >> <https://groups.google.com/d/msgid/elixir-lang-core/CAM9Rf%2BJEN7vuwxxZFkrB8NytCCaSPAKtroMeA1sqe91n5SoFXg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> >> .
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> >
> > --
> >
> > Regards,
> > Bruce Tate
> > CEO
> >
> >
> > <https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>
> >
> > Groxio, LLC.
> > 512.799.9366
> > br...@grox.io
> > grox.io
> >
> > --
> > 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-65ztTOMoVhZ407PghmYA0OBcuVhDatcjYx6Xw7f52pMQ%40mail.gmail.com
> > <https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-65ztTOMoVhZ407PghmYA0OBcuVhDatcjYx6Xw7f52pMQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
> >
> > --
> > 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/702CFF39-BCFF-416F-BF28-81A5E1516903%40chrismccord.com
> > <https://groups.google.com/d/msgid/elixir-lang-core/702CFF39-BCFF-416F-BF28-81A5E1516903%40chrismccord.com?utm_medium=email&utm_source=footer>
> > .
> >
>

Steve Morin

unread,
Jul 30, 2019, 11:51:40 PM7/30/19
to elixir-l...@googlegroups.com

José Valim

unread,
Jul 31, 2019, 6:00:44 AM7/31/19
to elixir-l...@googlegroups.com
I like the proposal for Function.identity/1 too.

The main concern is that one would generally expect for functions in Function module to receive or return functions, which is not the case here. Although I believe we can make it work on this case because the only use case for Function.identity/1 is to be given as argument where an anonymous function would be expected.


José Valim
Skype: jv.ptec
Founder and Director of R&D

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/586eb969-e70d-44cb-98df-47b8f6c188d0%40googlegroups.com.

Devon Estes

unread,
Jul 31, 2019, 1:40:57 PM7/31/19
to elixir-lang-core
What about Function.identity/0, that returns an anonymous identify function?

def identity(), do: &(&1)

So usage would look like:

Enum.map(list, Function.identity())

That (to me) works just as well as Function.identity/1, and keeps with the convention of functions in the Function module returning functions.

It is an additional layer of indirection, but I honestly don’t think this is going to be a feature that’s used by anyone other than advanced users. It might be confusing to those new to FP, but those folks won’t even think to use this feature, at least not by name.

José Valim

unread,
Jul 31, 2019, 2:36:53 PM7/31/19
to elixir-l...@googlegroups.com
I thought about said approach but returning anonymous functions are not very common in Elixir (probably due to the lack of currying) and also less efficient. So I would prefer Function.identity/1.


José Valim
Skype: jv.ptec
Founder and Director of R&D

--
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.

OvermindDL1

unread,
Aug 2, 2019, 11:04:47 AM8/2/19
to elixir-lang-core
On Wednesday, July 31, 2019 at 12:36:53 PM UTC-6, José Valim wrote:
I thought about said approach but returning anonymous functions are not very common in Elixir (probably due to the lack of currying) and also less efficient. So I would prefer Function.identity/1.


Just for reference, one of my benchmarks:
```
Name                     ips        average  deviation         median         99th %
Direct-Apply         23.02 M      0.0434 μs     ±7.10%      0.0420 μs      0.0540 μs
Direct               22.77 M      0.0439 μs     ±8.35%      0.0420 μs      0.0630 μs
Anon-Module          15.32 M      0.0653 μs   ±105.61%      0.0600 μs       0.100 μs
Anon-Closure         15.21 M      0.0658 μs   ±183.59%      0.0600 μs       0.100 μs
Anon-Empty           14.02 M      0.0713 μs     ±7.08%      0.0690 μs      0.0920 μs
Indirect             12.49 M      0.0801 μs     ±8.96%      0.0760 μs       0.110 μs
Indirect-Apply       12.49 M      0.0801 μs     ±7.03%      0.0760 μs       0.100 μs

Comparison:  
Direct-Apply         23.02 M
Direct               22.77 M - 1.01x slower
Anon-Module          15.32 M - 1.50x slower
Anon-Closure         15.21 M - 1.51x slower
Anon-Empty           14.02 M - 1.64x slower
Indirect             12.49 M - 1.84x slower
Indirect-Apply       12.49 M - 1.84x slower

Memory usage statistics:

Name              Memory usage
Direct-Apply             280 B
Direct                   280 B - 1.00x memory usage
Anon-Module              280 B - 1.00x memory usage
Anon-Closure             280 B - 1.00x memory usage
Anon-Empty               280 B - 1.00x memory usage
Indirect                 280 B - 1.00x memory usage
Indirect-Apply           280 B - 1.00x memory usage
``` 

Direct's are direct calls, like `SomeModule.somefunc()`, Indirects are `module_in_variable.somefunc()` (and apply is the `apply/3` function), anon-module is of the `&SomeModule.somefunc/0` form, anon-closure is capturing local non-static state  and returning that, and anon-empty is just `fn() -> nil end`.  No clue why anon-empty is the slowest but that's very consistent on these runs no matter how many times I run the benchmark on multiple computers.

So module calls are the fastest by an almost imperceptible amount.  Then again you can just return a module call from the function itself...  ^.^

And I think it's not the currying in Elixir is why, I actually do return quite a few anonymous functions in a lot of my code, it's easy enough, it's just that it's not the 'style' of many elixir'ists, many of them don't come from functional languages so they don't think in a functional programming style.  Functional programming is not just focusing on the functions, it is the transformation of the functions as well, which isn't really done in 'most' of the elixir ecosystem.

José Valim

unread,
Aug 2, 2019, 11:13:02 AM8/2/19
to elixir-l...@googlegroups.com
Precisely. In any case, a PR for Function.identity/1 would be appreciated.
--

Tai An Su

unread,
Dec 23, 2019, 3:28:33 AM12/23/19
to elixir-lang-core
I use `Enum.group_by([1, 1, 2, 3, 4, 4], &(&1))` to count the number of item apparence once for a while, so identity definately help on reveal the intension.

Talking about the length of code, Haskell name this function `id/0`, so maybe we can consider `Function.id/1` if it's not too misleading.

Wondering if anyone working on this or it's still in discussion, if not I'm more then glad to send a PR either you guys like `Function.id/1` or `Function.identity/1`

José Valim於 2019年8月2日星期五 UTC+8下午11時13分02秒寫道:

Tai An Su

unread,
Dec 23, 2019, 3:32:24 AM12/23/19
to elixir-lang-core
Oh it's already in the master repo. Sorry for the disturb.

Tai An Su於 2019年12月23日星期一 UTC+8下午4時28分33秒寫道:

Bruce Tate

unread,
Dec 23, 2019, 5:52:50 AM12/23/19
to elixir-l...@googlegroups.com
Very happy to see this. 

-bt

--
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.

Tallak Tveide

unread,
Dec 23, 2019, 3:32:07 PM12/23/19
to elixir-lang-core
Reply all
Reply to author
Forward
0 new messages