[erlang-questions] How can I make a list of this
Wed Aug 19 14:46:10 CEST 2015
On Wed, Aug 19, 2015 at 05:23:20AM -0700, Kenneth Lakin wrote:
> 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.)
Just to reinforce Kenneth's last comment here, reading and
searching the documentation to find functions is a fairly important
piece of learning. It's tedious, but it's not going to be wasted
time. Very few people carry round in their heads all of the functions
of even the most common modules (like lists). Nobody will have the
whole erlang API in their head. So it's normal, when writing code, to
spend time reading or searching through every function description
that even vaguely looks like it might do what you want. The time taken
in this exercise will decrease as you get more used to the language,
and as you become familiar with the most often used functions, but
there's no good substitute for the tedious business of trudging
through the docs.
In fact, for your specific problem here, I would *strongly*
recommend doing that for the lists module, as you'll find the answer
to your list-of-lists problem almost immediately. :) (And yes, I did
know about the function in question... but I had forgotten it was
called that until I went to read the docs).
When reading the docs like this, even if you don't find the
function you're looking for, it isn't wasted time, because you might
just see a function that you find you need tomorrow -- and then you
know where to find it. Or even just know that the function exists,
which is at least half of the battle.
I'd suggest that modules you should at least read through the whole
documentation for are: io, io_lib, lists, orddict or dict (very
similar APIs), proplists, and string. That will give you a good idea
of what's possible, and maybe where to find it.
Hugo Mills | Q: What goes, "Pieces of seven! Pieces of seven!"?
hugo@REDACTED carfax.org.uk | A: A parroty error.
PGP: E2AB1DE4 |
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the erlang-questions