[erlang-questions] Match the records
Matwey V. Kornilov
matwey.kornilov@REDACTED
Tue Jan 12 14:54:20 CET 2016
Many thanks!
12.01.2016 16:52, Vlad Dumitrescu пишет:
> Hi!
>
> X#myrec{f0 = F} = Y.
>
> regards,
> Vlad
>
>
> On Tue, Jan 12, 2016 at 2:46 PM, Matwey V. Kornilov
> <matwey.kornilov@REDACTED <mailto:matwey.kornilov@REDACTED>> 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
> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
>
More information about the erlang-questions
mailing list