Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Enumerations/ACL2/enumerations.acl2
Normal file
22
Task/Enumerations/ACL2/enumerations.acl2
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(defun symbol-to-constant (sym)
|
||||
(intern (concatenate 'string "*" (symbol-name sym) "*")
|
||||
"ACL2"))
|
||||
|
||||
(defmacro enum-with-vals (symbol value &rest args)
|
||||
(if (endp args)
|
||||
`(defconst ,(symbol-to-constant symbol) ,value)
|
||||
`(progn (defconst ,(symbol-to-constant symbol) ,value)
|
||||
(enum-with-vals ,@args))))
|
||||
|
||||
(defun interleave-with-nats-r (xs i)
|
||||
(if (endp xs)
|
||||
nil
|
||||
(cons (first xs)
|
||||
(cons i (interleave-with-nats-r (rest xs)
|
||||
(1+ i))))))
|
||||
|
||||
(defun interleave-with-nats (xs)
|
||||
(interleave-with-nats-r xs 0))
|
||||
|
||||
(defmacro enum (&rest symbols)
|
||||
`(enum-with-vals ,@(interleave-with-nats symbols)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue