[erlang-questions] Updating a nested record

Kenneth Lakin kennethlakin@REDACTED
Sun May 15 23:21:35 CEST 2016

On 05/15/2016 10:52 AM, Donald Steven wrote:
> Hi everyone,
> When I update the  'note' record below it updates correctly but the
> value returned is only the sub-record 'pressure', not the whole 'note'
> record.  I'd be most grateful for the right syntax.  Thanks.

I think the syntax is:

setNpressure(N, Initial, Final, Offset, Scope) ->
  N1 = N#note{p1 = #pressure{initial = Initial, final = Final, offset =
Offset, scope = Scope}}.

Otherwise, you're just returning the .p1 field.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160515/ef15fb6b/attachment.bin>

More information about the erlang-questions mailing list