Skip to content

Instantly share code, notes, and snippets.

@ktakashi
Created January 11, 2014 10:25
Show Gist options
  • Save ktakashi/8369222 to your computer and use it in GitHub Desktop.
Save ktakashi/8369222 to your computer and use it in GitHub Desktop.
Case insensitive intern
(defun my-intern (s &rest package)
(declare (type string s)
(type symbol package)
(optimize (debug 0) (speed 3) (safety 0)))
(let ((readtable-case (readtable-case *readtable*)))
(apply #'intern (case readtable-case
((:upcase) (string-upcase s))
((:downcase) (string-downcase s))
((:preserve) s)
((:invert) ;; lazy..
(error ":invert is not supported")))
package)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment