Erlang - list comprehensions - populating records

Posted by tbikeev on Stack Overflow See other posts from Stack Overflow or by tbikeev
Published on 2010-06-18T06:14:39Z Indexed on 2010/06/18 10:23 UTC
Read the original article Hit count: 141

Filed under:
|
|

I have a simple record structure consisting of a header (H) and a list of the data lines (D) 1:N. All header lines must start with a digit. All data lines have a leading whitespace. There also might be some empty lines (E) in between that must be ignored.

L = [H, D, D, E, H, D, E, H, D, D, D].

I would like to create a list of records:

-record(posting,{header,data}).

using list comprehension. Whats the best way to do it?

© Stack Overflow or respective owner

Related posts about erlang

Related posts about lists