Optimized list generation with nconc vs. append
authorKevin Rosenberg <kevin@rosenberg.net>
Sun, 6 Jun 2010 17:12:03 +0000 (11:12 -0600)
committerKevin Rosenberg <kevin@rosenberg.net>
Sun, 6 Jun 2010 17:12:03 +0000 (11:12 -0600)
parse-common.lisp
sql-classes.lisp

index 67a523636f787679afcac0c3689f4747700467b7..ae7af531d762865617de025b4ad5bc2d9b998acc 100644 (file)
@@ -45,8 +45,8 @@
 (defun ufile-pathname (ufile &optional (extension ""))
   "Return pathname for a umls filename with an optional extension"
   (assert (typep ufile 'ufile))
-  (let* ((dirs (append (list (dir ufile))
-                       (awhen (subdir ufile) (list it))))
+  (let* ((dirs (nconc (list (dir ufile))
+                      (awhen (subdir ufile) (list it))))
          (name-list (delimited-string-to-list (fil ufile) #\.))
          (name (if (second name-list)
                    (first name-list)
index 8031ace4553584dfdf6f2e3411881cdae0f41bd8..64cc4b3499b46834a622a4c4b1588cf621651b18 100644 (file)
@@ -911,8 +911,8 @@ is OBJNAME from TABLE where WHERE-NAME field = WHERE-VALUE with FIELDS"
                                 only-exact-if-match limit &key extra-lookup-args)
   (let ((uobjs '()))
     (dolist (word (delimited-string-to-list str #\space))
-      (setq uobjs (append uobjs
-                          (kmrcl:flatten (apply obj-lookup-fun word :srl srl extra-lookup-args)))))
+      (setq uobjs (nconc uobjs
+                         (kmrcl:flatten (apply obj-lookup-fun word :srl srl extra-lookup-args)))))
     (let ((sorted
            (funcall sort-fun str
                     (delete-duplicates uobjs :test #'= :key key))))