String interpolation (included): Difference between revisions

add bQN
(Add Emacs Lisp solution)
(add bQN)
Line 696:
<lang dos>>interpolate.cmd "Mary had a X lamb" little
Mary had a little lamb</lang>
 
=={{header|BQN}}==
 
<code>_interpolate</code> is a generalized string interpolation modifier that returns a function based on the replacement character given. The function will take a string on the right and replace the given symbol with the elements of the array given on its left.
 
Here, the symbol for Nothing(`·`) is used as a replacement character.
 
<lang bqn>Str ← (3⌊•Type)◶⟨2=•Type∘⊑,0,1,0⟩
_interpolate ← {∾(•Fmt⍟(¬Str)¨𝕨)⌾((𝕗=𝕩)⊸/)𝕩}
 
'a'‿"def"‿45‿⟨1,2,3⟩‿0.34241 '·'_interpolate "Hi · am · and · or · float ·"</lang>
 
=={{header|Bracmat}}==
236

edits