Richard A. O'Keefe
Tue Aug 22 03:15:37 CEST 2017
On 21/08/17 7:38 PM, Константин Поветкин wrote:
>> 21 авг. 2017 г., в 10:30, Roger Lipscombe <
>> <mailto:>> написал(а):
>> because I came from C#,
>> which has 'Single', 'First', etc., and I kinda miss them.
> In case of ‘Single’ and ‘First’ you can use erlang:hd() or
> [FirstOrSingle | _Tail].
That doesn't do one/2.
And it does first/2 at the expense of extra work, by a possibly
very large ratio.
> If you can provide an example you are getting challenges with, it’ll be
> easier to suggest you the most suitable erlang way to solve it.
> In my experiance: lists:fold[l/r], lists:map, lists:foreach are able to
> do any kind of jobs.
Those functions cannot stop early. all/2 and any/2 can, of course,
but they cannot return a non-Boolean result.
More information about the erlang-questions