Skip to content

Instantly share code, notes, and snippets.

@devinus
Created August 21, 2012 16:04
Show Gist options
  • Select an option

  • Save devinus/3416855 to your computer and use it in GitHub Desktop.

Select an option

Save devinus/3416855 to your computer and use it in GitHub Desktop.
-define(proplist_to_record(RecordName, Proplist),
lists:map(
fun ({K, V}) ->
{K, proplists:get_value(K, Proplist, V)}
end,
lists:zip(
record_info(fields, RecordName),
tl(tuple_to_list(#RecordName{}))
)
)
).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment