Skip to main content
Fix code, results, and formatting
Source Link
Basil
  • 12.8k
  • 45
  • 71

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"a = 1; b = 12" (let ( (a 1)   (b 2) )   (message (format-spec "a = %a; b = %b" `((?a . ,a) (?b . ,b)))) ) ;; ⇒ a"a = 1; b = 22" 

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 

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)) (format-spec "a = %a; b = %b" (format-spec-make ?a a ?b b))) ;; ⇒ "a = 1; b = 2" (let ((a 1) (b 2)) (format-spec "a = %a; b = %b" `((?a . ,a) (?b . ,b)))) ;; ⇒ "a = 1; b = 2" 
replaced http://emacs.stackexchange.com/ with https://emacs.stackexchange.com/
Source Link

Re-writing this answerthis 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 

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 

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 
added 103 characters in body
Source Link
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")) 

EditEdit: Another format-spec solution

In commentsAs Malabarba suggests that '((?a . "a") (?b . "b")) might also be used. This works for strings, but doesn't seem to be working for numbersgives 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 = a;1; b = b2 

Re-writing this answer gives another solution:

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

Edit:

In comments Malabarba suggests that '((?a . "a") (?b . "b")) might also be used. This works for strings, but doesn't seem to be working for numbers:

(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 = a; b = b 

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 
added 473 characters in body
Source Link
Adobe
  • 1.9k
  • 14
  • 27
Loading
syntax highlighting
Source Link
Kaushal Modi
  • 26.4k
  • 4
  • 84
  • 193
Loading
Source Link
Adobe
  • 1.9k
  • 14
  • 27
Loading