Next numbered name with the same base.
(next-numbered-name name wrld) → new-name
If
This function is independent from the
Function:
(defun next-numbered-name-aux (base current-index wrld) (declare (xargs :guard (and (symbolp base) (posp current-index) (plist-worldp wrld)))) (let ((__function__ 'next-numbered-name-aux)) (declare (ignorable __function__)) (let ((name (make-numbered-name base current-index wrld))) (if (logical-namep name wrld) (next-numbered-name-aux base (1+ current-index) wrld) current-index))))
Function:
(defun next-numbered-name (name wrld) (declare (xargs :guard (and (symbolp name) (plist-worldp wrld)))) (let ((__function__ 'next-numbered-name)) (declare (ignorable __function__)) (b* (((mv is-numbered-name base index) (check-numbered-name name wrld))) (if is-numbered-name (let ((next-index (if (= index 0) (next-numbered-name-aux base (1+ (max-numbered-name-index-in-use base wrld)) wrld) (next-numbered-name-aux base (1+ index) wrld)))) (make-numbered-name base next-index wrld)) (let ((next-index (next-numbered-name-aux name 1 wrld))) (make-numbered-name name next-index wrld))))))