[erlang-questions] Match the records

Vlad Dumitrescu <>
Tue Jan 12 14:52:40 CET 2016


Hi!

X#myrec{f0 = F} = Y.

regards,
Vlad


On Tue, Jan 12, 2016 at 2:46 PM, Matwey V. Kornilov <
> wrote:

>
> Hello,
>
> I have the record definition with a lot of fields, so it is pretty long
> record.
>
> -record(myrec, {f0, f1, f2, f3, .....}).
>
> Let X and Y be two records of this type.
> I can not understand how should I do the following pattern matching.
>
> I want all fields of X and Y be the same, except f0, and f0 should be
> bound to new variable F. As there are a lot of fields I don't want to
> explicitly enumerate them in my code in order DRY.
>
> In other words I need a short form of:
> #myrec{f0 = F, f1 = X#myrec.f1, ...} = Y.
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160112/3655d54e/attachment.html>


More information about the erlang-questions mailing list