Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 Ind

### 12 Prepare functions

#### 12.1 Prepare functions

##### 12.1-1 CAPOperationPrepareFunction
 ‣ CAPOperationPrepareFunction( prepare_function, category, func ) ( function )

Returns: a function

Given a non-CAP-conform function for any of the categorical operations, i.e., a function that computes the direct sum of two objects instead of a list of objects, this function wraps the function with a wrapper function to fit in the CAP context. For the mentioned binary direct sum one can call this function with "BinaryDirectSumToDirectSum" as prepare_function, the category, and the binary direct sum function. The function then returns a function that can be used for the direct sum categorical operation.

Note that func is not handled by the CAP caching mechanism and that the use of prepare functions is incompatible with WithGiven operations. Thus, one has to ensure manually that the equality and typing specifications are fulfilled.

 ‣ CAPAddPrepareFunction( prepare_function, name, doc_string[, precondition_list] ) ( function )
Adds a prepare function to the list of CAP's prepare functions. The first argument is the prepare function itself. It should always be a function that takes a category and a function and returns a function. The argument name is the name of the prepare function, which is used in CAPOperationPrepareFunction. The argument doc_string should be a short string describing the functions. The optional argument precondition_list can describe preconditions for the prepare function to work, i.e., if the category does need to have PreCompose computable. This information is also recovered automatically from the prepare function itself, so the precondition_list is only necessary if the function needed is not explicitly used in the prepare function, e.g., if you use + instead of AdditionForMorphisms.
 ‣ ListCAPPrepareFunctions( arg ) ( function )