Hi Guilers, I've added a hash reader extension in ice-9 boot to do strings interpolation.
One can interpolate expressions in a string by using the `@' character before the expressions. If that characters is doubled, then it acts as an escaping to insert itself without evaluation. The interpolation is done by extracting the expressions and putting them in a call to `format'. Expressions are all formatted with `~a', which is perhaps a little bit limiting here. As an optimization, if there's no expression to interpolate, then no call to `format' is done and a string is returned instead. Example of interpolations: #"foo" -> "foo" #"9^2=@(* 9 9)" -> (format #f "9^2=~a" (* 9 9)) #"one=@1" -> (format #f "one=~a" 1) #"bar@'buz" -> (format #f "bar=~a" (quote buz)) #"@me@@gnu.org" -> (format #f "~a...@gnu.org" me) #"me@@gnu.org" -> "m...@gnu.org" #"@@no-suffix@" -> "@weird" #"@@suffix@@" -> "@weird@" Olivier dion (2): Add reader extension for interpolated strings. Add tests for strings interpolation reader extension. module/ice-9/boot-9.scm | 37 ++++++++++++++++++++++++++++++++++++ test-suite/tests/reader.test | 11 ++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) -- 2.38.1