[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

COMMENT 3 on the book CL Recipes A Problem-Solution Approach by Edi Weitz

kodifik

6/5/2016 5:09:00 PM

;;; COMMENT 3 on the book CL Recipes A Problem-Solution Approach by Edi Weitz
;;; On the same example as before chap.3-12 pag.83
;;; Sometimes it can be convenient to define default args :
(defun simply-join (list &optional (separator " ")) ; could be "" as well
(format nil (format nil "~~{~~A~~^~A~~}" separator) list))
;;; so that (simply-join '("C" "C++" "C#")) simply works.

;;; Alternatively, the example function could be transformed
;;; into a "variadic" one with its list argument "spliced" :
;;; (join separator string1 string2 string3 ...)

;;; ...but not both things simultaneously, since default args
;;; are incompatible with variadic functions.