Next: , Previous: , Up: Common Lisp Package System   [Contents][Index]


3.1.6 Importing Individual Names

You can import an individual symbol with an ‘:import-from’ clause in the ‘DEFPACKAGE’. For example:

(defpackage :com.gigamonkeys.email-db
  (:use :common-lisp :com.gigamonkeys.text-db)
  (:import-from :com.acme.email :parse-email-address))

Now anywhere the name parse-email-address appears in code in the ‘COM.GIGAMONKEYS.EMAIL-DB’ package, it will be read as the symbol from ‘COM.ACME.EMAIL’. If you need to import more than one symbol from a single package, you can include multiple names after the package name in a single ‘:import-from’ clause. A ‘DEFPACKAGE’ can also include multiple ‘:import-from’ clauses in order to import symbols from different packages.