[erlang-questions] How can I make a list of this

Kenneth Lakin kennethlakin@REDACTED
Wed Aug 19 14:23:20 CEST 2015


On 08/19/2015 05:13 AM, Roelof Wobben wrote:
> oke, but I do not have a list of tuples but a list of lists

If you have a list of lists, you have several options. This
http://www.erlang.org/doc/man/lists.html#foreach-2 is probably what you
want. (BTW, *do* take some time to skim the functions available in the
lists module and their descriptions.)

You can also write functions that have the pattern

fun([]) ->
  ok;
fun([H|T]) ->
  %Stuff
  fun(T).

to deal with lists of lists.

Wasn't this already covered in your study material? If it wasn't even
mentioned in passing, it's a little disturbing that your exercise
requires you to work with lists of lists, but didn't present the
knowledge required to handle them.

Anyway. All the best, man.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150819/25e13782/attachment.bin>


More information about the erlang-questions mailing list