Can I format a dotted list?
No, formats iterations on the corresponding lists.
There are many possible ways to implement what you want. Here I present two of them.
Save control bar, change data
(defun ensure-proper-list (value)
(typecase value
(null nil)
(cons (cons (car value)
(ensure-proper-list (cdr value))))
(t (list value))))
, :
(defun encode-options (options)
"Turns an alist into url query parameters."
(format nil
"~{~{~A=~A~}~^&~}"
(mapcar #'ensure-proper-list options)))
,
(defun print-alist (stream data &optional colonp atsignp)
(declare (ignore colonp atsignp))
(destructuring-bind (head . tail) data
(format stream "~A=~A" head (if (consp tail) (first tail) tail))))
:
(defun encode-options (options)
"Turns an alist into url query parameters."
(format nil
"~{~/lib:print-alist/~^&~}"
options))
, lib, , print-alist (a.k.a. COMMON- LISP -USER), , , , . 22.3.5.4 Tilde Slash: :
, ~/name/, . ":" "::", COMMON- LISP -USER.
~/.
source
share