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

Richard A. O'Keefe ok@REDACTED
Tue Nov 14 23:00:28 CET 2017

On 14/11/17 9:50 PM, Richard Carlsson 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 suggest rolling your own.

cons(H, T) -> [H|T].

erlang:apply(?MODULE, cons, [H,T])

More information about the erlang-questions mailing list