2. Predicates A predicate is a function used to test for some condition involving its arguments and returns nil if the condition is false, or some non-nil value if the condition is true. Name of the predicates in CL usually ends with p. Ex: numberp, standard-char-p etc.
3. overview Logical values Data Type predicates General Type Predicates Specific data type predicates Equality predicates Logical operators
4. Logical values The names nil and t are constants in Lisp This object represents logical false value and also the empty list. It can also be written as () The values of nil and t are not permitted to be changed. Data type predicates: using data type predicates one can determine whether or not it belongs to a given type, or one can compare two type specifies.
5.
6. Subtypep are supposed to return a second value of nil unless one or both of its arguments involves satisfies and, or, not or member. Subtypep should signal an error when one or both of its arguments involves values or the list form of the function type specifier Subtypep must always return the two values t and t in the case where its arguments, after expansion of specifies defined by deftype are equal. (subtypep ‘(array A) ‘ (array B)) is true if and only if (upgraded-array-element-type ‘A) is the same type as (upgraded-array-element-type ‘ b) (subtypep ‘ (complex A) ‘ (complex B)) is true if and only if (upgraded-complex-part-type ‘A) and (upgraded-complex-part-type ‘B) is of same type.
7. Specific data type predicates The following data types test for specific individual data types. null object returns true if the argument is () or false otherwise. symbolp object returns true if the argument is a symbol else returns false atom object is true if the argument is not cons otherwise its false. consp object is true if the argument is a cons, false otherwise listp objectis true if the argument is a cons or an empty list (), false otherwise Numberp object is T if the argument is any kind of number
8. Rationalp object is T if the argument is a rational number false otherwise Similarly we have floatp, charaterp, vectorp, stringp, complexp, simple-bit-vector-p, simple-string-vector-p, arrayp etc. packagep object is T if its argument is a package and otherwise is false functionp object is T if its arguments are suitable for applying to arguments, using for ex the funccall or apply function and otherwise is false Compiled-function-p object is T if its argument is any compiled code object and otherwise is false Commonp object is T if its argument is any standard CL data type, and otherwise is false
9. Equality predicates Cl provides these predicates to test for the equality of the two objects: eq, eql, equal, equalp eq x y is true if and only if x and y are the same identical objects. Ex: (eq ‘g ‘h) false (eq 3 3)true (eq “hi” “HI”) false Eql x y is true if the arguments are eq, or of there are numbers of the same type with the same value, or if there are character objects that represent the same character
12. For every entry(key1, value1) in one hash table there must be the corresponding entry(key2, value2) in the other hash table.
13.
14.
15. Visit more self help tutorials Pick a tutorial of your choice and browse through it at your own pace. The tutorials section is free, self-guiding and will not involve any additional support. Visit us at www.dataminingtools.net