Skip to main content
4 of 6
added 103 characters in body
Adobe
  • 1.9k
  • 14
  • 27

Re-writing this answer gives another solution:

(format-spec "%a %a %a %b %b %b" (format-spec-make ?a "a" ?b "b")) 

Edit: Another format-spec solution

As Malabarba gives another solution in comments:

(format-spec "%a %a %a %b %b %b" '((?a . "a") (?b . "b"))) 

Edit 2: Evaluation before substitution:

Here are examples with evaluation before substitution:

(let ( (a 1) (b 2) ) (message (format-spec "a = %a; b = %b" (format-spec-make ?a a ?b b))) ) ;; ⇒ a = 1; b = 1 (let ( (a 1) (b 2) ) (message (format-spec "a = %a; b = %b" `((?a . ,a) (?b . ,b)))) ) ;; ⇒ a = 1; b = 2 
Adobe
  • 1.9k
  • 14
  • 27