Changeset 5087


Ignore:
Timestamp:
12/12/03 13:49:21 (18 years ago)
Author:
piso
Message:

COPY-ALIST

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/assoc.lisp

    r4371 r5087  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: assoc.lisp,v 1.4 2003-10-14 16:04:29 piso Exp $
     4;;; $Id: assoc.lisp,v 1.5 2003-12-12 13:49:21 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    8989    (setq alist (acons (car x) (car y) alist))))
    9090
     91;;; From SBCL.
    9192(defun copy-alist (alist)
    92   (if (atom alist)
     93  "Return a new association list which is EQUAL to ALIST."
     94  (if (endp alist)
    9395      alist
    9496      (let ((result
    9597       (cons (if (atom (car alist))
    9698           (car alist)
    97            (cons (caar alist) (cdar alist)) )
     99           (cons (caar alist) (cdar alist)))
    98100       nil)))
    99101  (do ((x (cdr alist) (cdr x))
     
    105107               (cons (caar x) (cdar x)))
    106108           nil)))))
    107             ;; Non-null terminated alist done here.
    108             ((atom x)
    109              (unless (null x)
    110                (rplacd splice x))))
     109      ((endp x)))
    111110  result)))
Note: See TracChangeset for help on using the changeset viewer.