hope icon indicating copy to clipboard operation
hope copied to clipboard

Define and implement dictionary methods for manipulation of nested values

Open xandkar opened this issue 10 years ago • 0 comments

Something along the lines of:

-spec get_path(t(K, Elt), Path :: [K]) ->
      {ok, Elt}
    | {error, {not_found, K}}
    when Elt :: {leaf, V} | {node, t(K, Elt)}
    .

-spec set_path(t(K, Elt)), Path :: [K], Elt) ->
      {ok, t(K, Elt)}
    | {error, {not_found, K}}
    when Elt :: {leaf, V} | {node, t(K, Elt)}
    .

When a nonexistent node is encountered during a set operation, should it be created or should we exit with an error? Should either behavior just be an option?

xandkar avatar Aug 22 '14 22:08 xandkar