Added meta-list

Pascal J. Bourguignon [2015-11-18 16:25]
Added meta-list
Filename
common-lisp/cesarum/list.lisp
diff --git a/common-lisp/cesarum/list.lisp b/common-lisp/cesarum/list.lisp
index 15a9a05..326e54c 100644
--- a/common-lisp/cesarum/list.lisp
+++ b/common-lisp/cesarum/list.lisp
@@ -59,7 +59,8 @@
    ;; "HASHED-REMOVE-DUPLICATES" moved to COM.INFORMATIMAGO.COMMON-LISP.CESARUM.SEQUENCE
    "ENSURE-LIST" "PROPER-LIST-P" "LIST-LENGTHS" "LIST-ELEMENTS"
    "ENSURE-CIRCULAR" "MAKE-CIRCULAR-LIST" "CIRCULAR-LENGTH"
-   "TREE-FIND" "TREE-DIFFERENCE" "REPLACE-TREE" "MAPTREE")
+   "TREE-FIND" "TREE-DIFFERENCE" "REPLACE-TREE"
+   "META-LIST" "MAPTREE")
   (:documentation
    "
 This package exports list processing functions.
@@ -108,6 +109,14 @@ License:
                '(1 2 3 4 5 6 7 8)))


+(defun meta-list (list)
+  "
+Returns a list whose CARs are the CONS cells of the LIST.
+LIST must be a proper list.
+"
+  (loop :for meta :on list :collect meta))
+
+
 (defun ensure-list (object)
                     "
 RETURN:         If OBJECT is a list then OBJECT, otherwise a fresh
ViewGit