Skip to content

Commit

Permalink
document A-NUMBERV. A-MEMBER-OFV, FUNCALLV, and APPLYV
Browse files Browse the repository at this point in the history
  • Loading branch information
nikodemus committed Oct 31, 2011
1 parent 7260a7d commit 109860f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
4 changes: 0 additions & 4 deletions TODO
Expand Up @@ -34,8 +34,6 @@
******* <=v
******* >v
******* >=v
******* a-numberv
******* a-member-ofv
******* count-trues
******* count-truesv
******* +v
Expand All @@ -44,8 +42,6 @@
******* /v
******* minv
******* maxv
******* funcallv
******* applyv
******* apply-substitution
******* linear-force
******* divide-and-conquer-force
Expand Down
4 changes: 4 additions & 0 deletions doc/screamer.texinfo
Expand Up @@ -449,6 +449,8 @@ of Screamer.
@include include/macro-screamer-assert!.texinfo
@include include/macro-screamer-known?.texinfo
@include include/macro-screamer-decide.texinfo
@include include/fun-screamer-applyv.texinfo
@include include/fun-screamer-funcallv.texinfo
@include include/fun-screamer-andv.texinfo
@include include/fun-screamer-orv.texinfo
@include include/fun-screamer-booleanpv.texinfo
Expand All @@ -462,6 +464,8 @@ of Screamer.
@include include/fun-screamer-slash-equals-v.texinfo
@include include/fun-screamer-lt-v.texinfo
@include include/fun-screamer-a-booleanv.texinfo
@include include/fun-screamer-a-numberv.texinfo
@include include/fun-screamer-a-member-ofv.texinfo
@include include/fun-screamer-a-realv.texinfo
@include include/fun-screamer-a-real-abovev.texinfo
@include include/fun-screamer-a-real-belowv.texinfo
Expand Down
21 changes: 21 additions & 0 deletions screamer.lisp
Expand Up @@ -5687,6 +5687,15 @@ arguments. Secondly, any non-boolean argument causes it to fail."
(defun assert!-notv-funcallv (f &rest x) (assert!-constraint f nil x))

(defun funcallv (f &rest x)
"F must be a deterministic function. If all arguments X are bound, returns
the result of calling F on the dereferenced values of arguments.
Otherwise returns a fresh variable V, constrained to be equal to the result
of calling F on the dereferenced values of arguments.
Additionally, if all but one of V and the argument variables become known, and
the remaining variable has a finite domain, then that domain is further
restricted to be consistent with other arguments."
(let ((f (value-of f)))
(if (variable? f)
(error "The current implementation does not allow the first argument~%~
Expand Down Expand Up @@ -5725,6 +5734,15 @@ arguments. Secondly, any non-boolean argument causes it to fail."
(assert!-constraint f nil (arguments-for-applyv x xs)))

(defun applyv (f x &rest xs)
"F must be a deterministic function. If all arguments X are bound, returns
the result of calling F on the dereferenced values of spread arguments.
Otherwise returns a fresh variable V, constrained to be equal to the result
of calling F on the dereferenced values of arguments.
Additionally, if all but one of V and the argument variables become known, and
the remaining variable has a finite domain, then that domain is further
restricted to be consistent with other arguments."
(let ((f (value-of f)))
(if (variable? f)
(error "The current implementation does not allow the first argument~%~
Expand Down Expand Up @@ -6598,11 +6616,14 @@ The expression \(A-REAL-BETWEENV LOW HIGH) is an abbreviation for:
v))

(defun a-numberv (&optional (name nil name?))
"Returns a variable whose value is constained to be a number."
(let ((v (if name? (make-variable name) (make-variable))))
(assert! (numberpv v))
v))

(defun a-member-ofv (values &optional (name nil name?))
"Returns a variable whose value is constrained to be one of VALUES.
VALUES can be either a vector or a list designator."
(let ((v (if name? (make-variable name) (make-variable))))
(assert! (memberv v values))
(value-of v)))
Expand Down

0 comments on commit 109860f

Please sign in to comment.