1.6 ACL2 Books
1.6.1 "data-structures/list-theory"
| |
|
Examples: |
> (deflist even-listp (l) evenp) |
eval:1:0: defun: defined outside of begin-below at: HERE |
in: (defun even-listp (l) (cond ((null? l) (quote t)) |
((pair? l) (if (not (member (evenp (car l)) (quote (nil |
())))) (even-listp (cdr l)) (quote ()))) (else (quote ())))) |
> (even-listp (list 2 4 6)) |
eval:2:0: application: bad syntax in: (top/error . |
even-listp) |
> (even-listp (list 1 3 5)) |
eval:3:0: application: bad syntax in: (top/error . |
even-listp) |
> (even-listp 'not-a-list) |
eval:4:0: application: bad syntax in: (top/error . |
even-listp) |
1.6.2 "data-structures/structures"
| |||||||||||||
|
Examples: | |||
> (defstructure circle radius) | |||
mutual-recursion: defined outside of begin-below at: HERE | |||
in: (mutual-recursion (defun circle (radius2) (circle3 | |||
radius2)) (defun weak-circle-p (x) (weak-circle-p4 x)) | |||
(defun circle-p (x) (circle-p5 x)) (defun circle-radius (x) | |||
(circle-radius7 x))) | |||
> (circle 10) | |||
eval:6:0: application: bad syntax in: (top/error . circle) | |||
> (circle-radius (circle 10)) | |||
eval:7:0: application: bad syntax in: (top/error . | |||
circle-radius) | |||
> (circle-p (circle 10)) | |||
eval:8:0: application: bad syntax in: (top/error . circle-p) | |||
> (circle-p 'not-a-circle) | |||
eval:9:0: application: bad syntax in: (top/error . circle-p) | |||
| |||
mutual-recursion: defined outside of begin-below at: HERE | |||
in: (mutual-recursion (defun rect (temp16 temp17) (rect18 | |||
temp16 temp17)) (defun weak-rect-p (x) (weak-rect-p19 x)) | |||
(defun rect-p (x) (rect-p20 x)) (defun rect-width (x) | |||
(rect-width22 x)) (defun rect-height (x) (rect-height23 x))) | |||
> (rect 10 20) | |||
eval:11:0: application: bad syntax in: (top/error . rect) | |||
> (rect-width (rect 10 20)) | |||
eval:12:0: application: bad syntax in: (top/error . | |||
rect-width) | |||
> (rect-height (rect 10 20)) | |||
eval:13:0: application: bad syntax in: (top/error . | |||
rect-height) | |||
> (rect-p (rect 10 20)) | |||
eval:14:0: application: bad syntax in: (top/error . rect-p) | |||
> (rect-p (rect -10 -20)) | |||
eval:15:0: application: bad syntax in: (top/error . rect-p) | |||
> (rect-p 'not-a-rect) | |||
eval:16:0: application: bad syntax in: (top/error . rect-p) |