/[emacs]/emacs/lisp/emacs-lisp/cl-macs.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/cl-macs.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by monnier, Fri Nov 30 00:56:45 2001 UTC revision 1.32 by monnier, Fri Nov 30 08:22:46 2001 UTC
# Line 1844  The form returns true if TAG was found a Line 1844  The form returns true if TAG was found a
1844    "(shiftf PLACE PLACE... VAL): shift left among PLACEs.    "(shiftf PLACE PLACE... VAL): shift left among PLACEs.
1845  Example: (shiftf A B C) sets A to B, B to C, and returns the old A.  Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
1846  Each PLACE may be a symbol, or any generalized variable allowed by `setf'."  Each PLACE may be a symbol, or any generalized variable allowed by `setf'."
1847    (if (not (memq nil (mapcar 'symbolp (butlast (cons place args)))))    (cond
1848        (list 'prog1 place     ((null args) place)
1849              (let ((sets nil))     ((symbolp place) `(prog1 ,place (setq ,place (shiftf ,@args))))
1850                (while args     (t
1851                  (cl-push (list 'setq place (car args)) sets)      (let ((method (cl-setf-do-modify place 'unsafe)))
1852                  (setq place (cl-pop args)))        `(let* ,(car method)
1853                `(setq ,(cadar sets)           (prog1 ,(nth 2 method)
1854                       (prog1 ,(caddar sets)             ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args))))))))
                        ,@(nreverse (cdr sets))))))  
     (let* ((places (reverse (cons place args)))  
            (form (cl-pop places)))  
       (while places  
         (let ((method (cl-setf-do-modify (cl-pop places) 'unsafe)))  
           (setq form (list 'let* (car method)  
                            (list 'prog1 (nth 2 method)  
                                  (cl-setf-do-store (nth 1 method) form))))))  
       form)))  
1855    
1856  (defmacro rotatef (&rest args)  (defmacro rotatef (&rest args)
1857    "(rotatef PLACE...): rotate left among PLACEs.    "(rotatef PLACE...): rotate left among PLACEs.

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26