Generate a suitable name for a temporary file.
Signature: (tempfile basename &optional (state 'state)) →
Example:
(tempfile "foo") --> ("/tmp/jared-31721-foo" <state>)
Note: this function is attachable. If you need to generate temporary file
names using some other scheme, you can define your own strategy and attach it
to
The intent is that this function should produce a good
Macro:
(defmacro tempfile (basename &optional (state 'state)) (cons 'tempfile-fn (cons basename (cons state 'nil))))
Definition:
(encapsulate (((tempfile-fn * state) => (mv * state) :formals (basename state) :guard (stringp basename))) (local (value-triple :elided)) (defthm type-of-tempfile-fn (or (stringp (mv-nth 0 (tempfile-fn basename state))) (not (mv-nth 0 (tempfile-fn basename state)))) :rule-classes :type-prescription) (defthm state-p1-of-tempfile-fn (implies (force (state-p1 state)) (state-p1 (mv-nth 1 (tempfile-fn basename state))))) (defthm w-state-of-tempfile-fn (equal (w (mv-nth 1 (tempfile-fn basename state))) (w state))))
Theorem:
(defthm type-of-tempfile-fn (or (stringp (mv-nth 0 (tempfile-fn basename state))) (not (mv-nth 0 (tempfile-fn basename state)))) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-tempfile-fn (implies (force (state-p1 state)) (state-p1 (mv-nth 1 (tempfile-fn basename state)))))
Theorem:
(defthm w-state-of-tempfile-fn (equal (w (mv-nth 1 (tempfile-fn basename state))) (w state)))