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

Zhongzheng Liu liuzhongzheng2012@REDACTED
Thu Nov 16 03:19:15 CET 2017


As far as I know, there is no constructor function for list or tuple.

We have maps:new(), why not lists:new() or tuple:new() ?

                             Liu Zhongzheng


2017-11-14 18:15 GMT+08:00 Cons T Åhs <cons@REDACTED>:
>
> 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>:
>>
>> 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
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list