Message Boards Message Boards

0
|
2202 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Replace elements of associations set

Posted 2 years ago

I have the following set with two associations:

set = {F1[<|{16, 14, 13} -> 1, {16, 15, 14} -> 1, {17, 18, 20} -> 
      2, {20, 19, 18} -> 2|>], 
   F2[<|{3, 4, 10, 9} -> 3, {10, 4, 2, 8} -> 4, {5, 1, 3, 4} -> 
      1, {10, 11, 7, 9} -> 5, {5, 11, 7, 1} -> 6, {12, 5, 11, 6} -> 
      6, {11, 6, 8, 10} -> 5, {1, 3, 9, 7} -> 7, {2, 4, 14, 15} -> 
      1, {15, 16, 12, 2} -> 1, {12, 16, 13, 5} -> 1, {14, 13, 5, 4} -> 
      1, {8, 19, 18, 2} -> 2, {8, 19, 20, 6} -> 2, {6, 20, 17, 12} -> 
      2, {17, 18, 2, 12} -> 2|>]};

I want to apply, in this set, the following substitutions:

news = <|{16, 14, 13} -> 60, {16, 15, 14} -> 60, {17, 18, 20} -> 
    70, {20, 19, 18} -> 70, {3, 4, 10, 9} -> 50, {10, 4, 2, 8} -> 50|>;

How to make? I have little experience in operations with associations.

Regards,
Sinval

Attachments:
POSTED BY: Sinval Santos
2 Replies
Posted 2 years ago

Thanks for the tip Sander. I will check.

POSTED BY: Sinval Santos

Use AssociateTo https://reference.wolfram.com/language/ref/AssociateTo.htmlto update terms of an association.

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract