String interpolation (included): Difference between revisions

Content added Content deleted
(Added more general multi-field interpolation function for APL)
Line 633: Line 633:


∇r ← s sInterp sv
∇r ← s sInterp sv
⍝⍝ \brief A multi-field string interpolation function
⍝⍝ Interpolate items in sv into s (string field substitution)
⍝ s: string - format string, '_' (underscore) interpolation points
⍝⍝
sv: vector - vector of items to interpolate into s
⍝⍝ \param[⍺] - format string
r: interpolated string
⍝⍝ \param[⍵] - vector of strings to interpolate into s
⍝⍝ ]return r - interpolated string
⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝
s[('_'=s)/⍳⍴s] ← ⊃¨sv
s[('_'=s)/⍳⍴s] ← ⊃¨sv
r ← ∊s
r ← ∊s