Skip to content

fisxoj/format-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

format-string

Build Status Coverage Status

Templated strings for common lisp.

(let ((name "format-string")
      (use "templated strings")
      (how-many "as many as you want"))

  #`${name} is a package implementing ${use} as a reader macro.
You can insert one, two, or ${how-many} variables into a string so that it's
arguably more readable than a format string in some circumstances.`)

; => "format-string is a package implementing templated strings as a reader macro.
; You can insert one, two, or as many as you want variables into a string so that it's
; arguably more readable than a format string in some circumstances."

Using in your project

Probably the sanest way is to use named readtables, like so:

(named-readtables:in-readtable format-string:syntax)

(defvar potato-type "yukon")

(defvar exclamation #`I love ${potato-type} potatoes!`)

But you can also bind the function to a macro dispatcher

(set-dispatch-macro-character #\# #\` #'format-string:parse-format-string)

Releases

No releases published

Sponsor this project

Packages

No packages published