Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
(defvar *language* :en
|
||||
"The language to use for messages (defaults to English)")
|
||||
|
||||
(defmacro with-language ((language) &body body)
|
||||
"Locally binds *LANGUAGE* to LANGUAGE"
|
||||
`(let ((*language* ,language))
|
||||
,@body))
|
||||
|
||||
(defgeneric complain% (language about)
|
||||
;; The % indicates this is an “internal” implementation detail.
|
||||
(:method ((language (eql :en)) (about (eql :weather)))
|
||||
"It's too cold in winter"))
|
||||
|
||||
(defun complain (about)
|
||||
"Complain about something indicated by ABOUT"
|
||||
(princ (complain% *language* about) *error-output*)
|
||||
(terpri *error-output*)
|
||||
(finish-output *error-output*)
|
||||
nil)
|
||||
|
||||
(defmethod complain% ((language (eql :es)) (about (eql :weather)))
|
||||
"Hace demasiado frío en invierno")
|
||||
|
||||
|
||||
(complain :weather)
|
||||
(with-language (:es)
|
||||
(complain :weather))
|
||||
(complain :weather)
|
||||
|
||||
⇓
|
||||
|
||||
It's too cold in winter
|
||||
Hace demasiado frío en invierno
|
||||
It's too cold in winter
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
(defun do-something (argument &key ((secret-arg secret) "default"))
|
||||
(format t "Argument is ~a, secret is ~a" argument secret))
|
||||
|
||||
;; Normal caller
|
||||
(do-something "Foo")
|
||||
;; Special caller:
|
||||
(do-something "Foo" 'secret-arg "Bar")
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#+sbcl
|
||||
(defun user-name+home-phone (user-id)
|
||||
"Returns the “real name” and “home phone” for user with ID USER-ID as multiple values.
|
||||
Reads the GECOS field. SBCL+Linux-specific, probably."
|
||||
(destructuring-bind (real-name office office-phone home-phone &rest _)
|
||||
(uiop:split-string (sb-posix:passwd-gecos (sb-posix:getpwuid user-id))
|
||||
:separator ",")
|
||||
(declare (ignore office office-phone _))
|
||||
(values real-name home-phone)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue