LISTING FOR >udd>sm>ds>w>ml>lisp_destructuring_let_ COMPILED BY Multics LISP Compiler, Version 2.13c, July 11, 1983 ON 05/05/00 1835.9 mdt Fri IN BEHALF OF Schroth.SysMaint.m ;;; ************************************************************** ;;; * * ;;; * Copyright, (C) Massachusetts Institute of Technology, 1982 * ;;; * * ;;; ************************************************************** ;; -*- Mode: Lisp; Lowercase: True -*- (%include backquote) (declare (macros t)) (declare (special let-macro-vals)) (defprop let let/ macro macro) (defun let/ macro (x) (displace x (do ((body (let-macro-flush-declares (cddr x))) (pairs (reverse (cadr x)) (cdr pairs)) (vars nil) (let-macro-vals nil) (tem)) ((null pairs) (setq body (let-macro-cons-declares (cddr x) body)) (cond ((or (not (null vars)) (not (null (cdr body)))) `((lambda ,vars . ,body) . ,let-macro-vals)) (t (car body)))) (cond ((atom (car pairs)) (or (symbolp (car pairs)) (error "Garbage found in LET pattern: " (car pairs) 'fail-act)) (setq vars (cons (car pairs) vars)) (setq let-macro-vals (cons nil let-macro-vals))) (t (setq tem vars) (setq vars (let-macro-get-vars (caar pairs) vars)) (or (eq tem vars) (setq body (nconc (let-macro-hair (caar pairs) (cadar pairs) let-macro-vals) body)))))))) (defun let-macro-get-vars (pattern vars) (cond ((null pattern) vars) ((atom pattern) (or (symbolp pattern) (error "Garbage found in LET pattern: " pattern 'fail-act)) (setq let-macro-vals (cons nil let-macro-vals)) (cons pattern vars)) (t (let-macro-get-vars (cdr pattern) (let-macro-get-vars (car pattern) vars))))) (defun let-macro-flush-declares (body) (cond ((or (atom body) (atom (car body)) (not (eq (caar body) 'declare))) body) (t (let-macro-flush-declares (cdr body))))) (defun let-macro-cons-declares (obody nbody) (cond ((or (atom obody) (atom (car obody)) (not (eq (caar obody) 'declare))) nbody) (t (cons (car obody) (let-macro-cons-declares (cdr obody) nbody))))) (defprop desetq desetq/ macro macro) (defun desetq/ macro (x) (displace x (do ((p (cdr x) (cddr p)) (body nil) (tem)) ((null p) `(progn . ,body)) (cond ((atom (cdr p)) (error "Odd number of args to DESETQ: " x 'fail-act)) ((atom (car p)) (or (symbolp (car p)) (error "Garbage found in DESETQ pattern: " (car p) 'fail-act)) (and (null (car p)) (error "Bad DESETQ pattern: " (car p) 'fail-act)) (setq body (nconc body `((setq ,(car p) ,(cadr p)))))) (t (setq tem (cons nil nil)) (setq body (nconc body `((setq ,(let-macro-get-last-var (car p)) . ,tem) . ,(let-macro-hair (car p) (cadr p) tem))))))))) (defun let-macro-get-last-var (pattern) (cond ((atom pattern) pattern) (t (or (let-macro-get-last-var (cdr pattern)) (let-macro-get-last-var (car pattern)))))) (defun let-macro-hair (pattern code cell) (cond ((null pattern) nil) ((atom pattern) (rplaca cell code) nil) (t ((lambda (avar dvar) (cond ((null avar) (cond ((null dvar) nil) (t (let-macro-hair (cdr pattern) `(cdr ,code) cell)))) ((null dvar) (let-macro-hair (car pattern) `(car ,code) cell)) (t (rplaca cell code) ((lambda (acell dcell) (cons `(setq ,avar . ,acell) (nconc (let-macro-hair (car pattern) `(car ,dvar) acell) (cons `(setq ,dvar . ,dcell) (let-macro-hair (cdr pattern) `(cdr ,dvar) dcell))))) (cons nil nil) (cons nil nil))))) (let-macro-get-last-var (car pattern)) (let-macro-get-last-var (cdr pattern)))))) (defprop let* let*/ macro macro) (defun let*/ macro (x) (displace x (cond ((null (cdadr x)) `(let . ,(cdr x))) (t (do ((a (reverse (cadr x)) (cdr a)) (b (let-macro-flush-declares (cddr x)) `((let (,(car a)) . ,b)))) ((null (cdr a)) `(let (,(car a)) . ,(let-macro-cons-declares (cddr x) b)))))))) (sstatus feature destructuring_let) INCLUDE FILE >ldd>incl>backquote.incl.lisp ;;; ;;; backquote.incl.lisp - BSG 10/9/79 ;;; Loads lisp_backquote_ into either the compiler or interpreter ;;; environment. ;;; ;;; Modified 10/30/82 by Richard Lamson to use eval-when and ;;; (status feature backquote) ;;; (eval-when (eval compile) (or (status feature backquote) (load (catenate (car (namelist (truename infile))) ">lisp_backquote_")))) Functions Defined Name Offset Offset Name desetq macro 325 0 let macro let macro 0 172 let-macro-get-vars let* macro 750 246 let-macro-flush-declares let-macro-cons-declares 271 271 let-macro-cons-declares let-macro-flush-declares 246 325 desetq macro let-macro-get-last-var 520 520 let-macro-get-last-var let-macro-get-vars 172 540 let-macro-hair let-macro-hair 540 750 let* macro Functions Referenced displace let-macro-flush-declares let-macro-hair error let-macro-get-last-var nconc let-macro-cons-declares let-macro-get-vars reverse ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved