Mercurial > core / lisp/std/macs/control.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
0e00dec3de03
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; std/macs/control.lisp --- Control Flow Macros 8 (defmacro xor (&rest datums) 9 "Evaluates its arguments one at a time, from left to right. If more than one 10 argument evaluates to a true value no further DATUMS are evaluated, and NIL is 11 returned as both primary and secondary value. If exactly one argument 12 evaluates to true, its value is returned as the primary value after all the 13 arguments have been evaluated, and T is returned as the secondary value. If no 14 arguments evaluate to true NIL is returned as primary, and T as secondary 16 (with-gensyms (xor tmp true) 18 (declare (ignorable ,tmp)) 20 ,@(mapcar (lambda (datum) 21 `(if (setf ,tmp ,datum) 23 (return-from ,xor (values nil nil)) 26 (return-from ,xor (values ,true t))))))