Recursive dot operation #17

Open
opened 2025-10-11 11:25:54 +00:00 by UserCurt · 0 comments
UserCurt commented 2025-10-11 11:25:54 +00:00 (Migrated from codeberg.org)

A recursive dot operation allows recursively selecting fields across a hierarchy of data, descending into any depth in the tree. Syntax is not yet fully decided, though there are two options are currently under consideration:

  • Glob-like syntax: /A/**/X
  • XPath-like syntax: /A//X
S = struct(A = struct(B=1, X=2, D=struct(E=struct(X=3), F=struct(X=4))), C = struct(X=5))
R = mpath.resolve(S, "/A/**/X") % [/A/X; /A/D/E/X; /A/F/X]

There may be downstream bugs introduced or other unexpected consequences introduced by this because branches can no longer be assumed to be the same depth anymore.

Some other closely related ideas:

  • Limit depth to a particular range
  • Have an optional level (depth being 0 or 1)
A recursive dot operation allows recursively selecting fields across a hierarchy of data, descending into any depth in the tree. Syntax is not yet fully decided, though there are two options are currently under consideration: - Glob-like syntax: `/A/**/X` - XPath-like syntax: `/A//X` ```matlab S = struct(A = struct(B=1, X=2, D=struct(E=struct(X=3), F=struct(X=4))), C = struct(X=5)) R = mpath.resolve(S, "/A/**/X") % [/A/X; /A/D/E/X; /A/F/X] ``` There may be downstream bugs introduced or other unexpected consequences introduced by this because branches can no longer be assumed to be the same depth anymore. Some other closely related ideas: - Limit depth to a particular range - Have an optional level (depth being 0 or 1)
Sign in to join this conversation.
No description provided.