New to .fp12 / FMP20

Not sure that chained/nested command structures are an improvement. Most of my code can be written far more concisely, compact, and condensed, using nested commands, but 100% of the time, I will err on verbosity, resulting in readability / maintainability / "debugability", over short. I'd rather repeat commands multiple times than to nest a command structure.

IMG_8919

Those arguments might sway me in other situations but they aren't convincing me here. Especially as it's a core function and any improvements to it's performance and behaviour will flow straight into plain-vanilla usage. Nesting the function when it allows for an optional number of parameters might kindly be described as eccentric. :wink:

Substitute ( 
  tbl::fld 
; ["&" ; "&"]
; ["<" ; "&lt;"]
; [">" ; "&gt;"] 
)
Substitute ( Substitute ( Substitute ( tbl::fld ; "&" ; "&amp;" ) ; "<" ; "&lt;" ) ; ">"   ; "&gt;" )
2 Likes

In this case, I agree with you. The "case" type structure of Substitute lends itself well to repeated arguments; IMHIO, it is more the aspect of nested commands that lends itself to verbosity and resultant maintainability over a minor tradeoff in performance

It's not very fair to show calculations that way and it is a weired concept of adding semicolons, but the last one, in front of the expression pair

Substitute ( Substitute ( Substitute ( 
  tbl::fld ; 
  "&" ; "&amp;" ) ; 
  "<" ; "&lt;" ) ;
  ">"   ; "&gt;" )

does not look that much worse - and I doubt that there is a major performance tradeoff since in both cases the commands are done in sequence. It might be easy to run a test for comparison.

What I actually hate is the nesting [ ], which are not required e.g. for a case statement.

I guess that you have this substitution command within a custom formula already?