I have terms in Erlang that contain {localref, integer()} sub-terms, like so: Z = {leaf,…
- User
I have terms in Erlang that contain {local_ref, integer()} sub-terms, like so:
Z = {leaf, {ty, <<0:5>>, {{0,nil},finite}, [], {leaf,0}, {{leaf,0}, #{2 => {node, {ty_tuple,2, [{local_ref,-576460752303422591},{local_ref,-576460752303422559}]}, {leaf,1}, {leaf,0}}}}, {{leaf,0},#{}}}}
What would be the most efficient way of transforming such a term where all local_refs are replaced given by a mapping M?
e.g
replace(Z, #{{local_ref,-576460752303422591} => {node, 5})
would replace all occurrences of {local_ref,-576460752303422591} by {node, 5} in Z.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.