Using `satisfies` c` and` in Common Lisp

I read in the Google Common Lisp Style Guide (see the last section) that there is an error in Common Lisp, the standard is relative to and as a type specifier. Namely, that this is not a β€œshort circuit” or equivalent, that the evaluation order is not guaranteed, contrary to what is assumed in the example :

 (and integer (satisfies evenp)) 

However, looking at section 4.4 of CLtL2, he stated that

When typep processes the and type specifier, it always checks each of the component types in order from left to right and stops processing as soon as it finds one intersection component to which the given object does not belong.

This section further explains that this is so as to allow satisfies to be filtered by another type, to avoid errors.

Can we safely assume that this is a mistake in the Google Style Guide or the behavior has changed with CLtL2?

+8
types lisp common-lisp cltl2
source share
1 answer

I had the same problem a few years ago.

I did not find anything in ANSI CL that supports ordering or filtering. But there is also no issue that discusses change. The example you mentioned assumes an interpretation of CLtL2.

Thus, it makes sense to assume that the compiler can change the type order and that this has changed with CLtL2.

+8
source share

All Articles