[erlang-questions] Which built-in function makes [H|T] ?

Cons T Åhs cons@REDACTED
Tue Nov 14 11:15:14 CET 2017


> On 14 Nov 2017, at 09:50, Richard Carlsson <carlsson.richard@REDACTED> wrote:
> 
> Most operators have a corresponding function in the 'erlang' module. For example, A + B can be written erlang:'+'(A,B). However, the cons operator [|] does not, as far as I know.

I’ve always considered this a gross oversight for several reasons.  One is that you have to write your own local fun when you want to pass it as higher order functional argument, another is that should one generate Erlang code directly one has to take care of this and generate special syntax.  Then there is the personal obvious reason :-)

Cons

> 
> 
> 
> 
>         /Richard
> 
> 2017-11-14 8:56 GMT+01:00 Zhongzheng Liu <liuzhongzheng2012@REDACTED <mailto:liuzhongzheng2012@REDACTED>>:
> Hi mail-list:
> 
> Which built-in function work as   fun(H, T) -> [H|T] end ?
> 
> i.e how to fill the following expression without user defined function ?
> 
> [H|T] = erlang:apply(???, ???, [H, T]).
> 
> 
> Thanks
> 
>                            Liu zhongzheng
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-questions <http://erlang.org/mailman/listinfo/erlang-questions>
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171114/1b034725/attachment.htm>


More information about the erlang-questions mailing list