Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Common Lisp

(require :asdf)
(asdf:load-asd (uiop:getenv "DEFINGERPRINTER_ASD"))
(asdf:load-system "defingerprinter")
(defingerprinter:load-library (uiop:getenv "DEFINGERPRINTER_LIBRARY"))

(defingerprinter:with-redactor (redactor)
  (multiple-value-bind (text status)
      (defingerprinter:redact redactor "Contact alice@example.com" :language "en")
    (unless (eq status :ok)
      (error "redact failed: ~A" status))
    (write-line text)))

Output: Contact [EMAIL_1]. redact returns the text and a status; with-redactor closes the context on exit.

Run

Install CFFI, Babel, and Bordeaux-Threads. With the Nix package:

PREFIX=$(cd result && pwd -P)
DEFINGERPRINTER_ASD="$PREFIX/share/common-lisp/source/defingerprinter/defingerprinter.asd" \
DEFINGERPRINTER_LIBRARY="$PREFIX/lib/libdefingerprinter.dylib" \
  sbcl --script examples/lisp.lisp

Use .so instead of .dylib on Linux.