Commit 4d113710 authored by Luís Oliveira's avatar Luís Oliveira

New function: FEATUREP

Added respective documentation in manual as well.
parent d13f04db
...@@ -18,4 +18,5 @@ ...@@ -18,4 +18,5 @@
(:file "functions" :depends-on ("package" "symbols" "macros")) (:file "functions" :depends-on ("package" "symbols" "macros"))
(:file "lists" :depends-on ("package" "functions")) (:file "lists" :depends-on ("package" "functions"))
(:file "sequences" :depends-on ("package" "lists")) (:file "sequences" :depends-on ("package" "lists"))
(:file "numbers" :depends-on ("package" "sequences")))) (:file "numbers" :depends-on ("package" "sequences"))
(:file "features" :depends-on ("package"))))
...@@ -80,6 +80,7 @@ terms and conditions: ...@@ -80,6 +80,7 @@ terms and conditions:
* Array Utilities:: * Array Utilities::
* Type Designator Manipulation:: * Type Designator Manipulation::
* Mathematical Utilities:: * Mathematical Utilities::
* Features::
@end menu @end menu
@node Top @node Top
...@@ -209,4 +210,11 @@ terms and conditions: ...@@ -209,4 +210,11 @@ terms and conditions:
@include include/fun-alexandria-variance.texinfo @include include/fun-alexandria-variance.texinfo
@include include/fun-alexandria-standard-deviation.texinfo @include include/fun-alexandria-standard-deviation.texinfo
@c FIXME: get a better section name
@node Features
@comment node-name, next, previous, up
@section Features
@include include/fun-alexandria-featurep.texinfo
@bye @bye
(in-package :alexandria)
(defun featurep (feature-expression)
"Returns T if the argument matches the state of the *FEATURES*
list and NIL if it does not. FEATURE-EXPRESSION can be any atom
or list acceptable to the reader macros #+ and #-."
(etypecase feature-expression
(symbol (not (null (member feature-expression *features*))))
(cons (ecase (first feature-expression)
(:and (every #'featurep (rest feature-expression)))
(:or (some #'featurep (rest feature-expression)))
(:not (not (featurep (cadr feature-expression))))))))
...@@ -116,5 +116,4 @@ ...@@ -116,5 +116,4 @@
#:coercef #:coercef
;; Errors ;; Errors
#:required-argument #:required-argument
)) ))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment