@@ -34,15 +34,15 @@ InstallGlobalFunction( "DeactivateDerivationInfo",
34
34
end );
35
35
36
36
InstallMethod( MakeDerivation,
37
- [ IsString, IsFunction, IsDenseList, IsPosInt, IsDenseList , IsFunction ] ,
37
+ [ IsString, IsFunction, IsDenseList, IsPosInt, IsFunction , IsFunction ] ,
38
38
39
- function ( name, target_op, used_op_names_with_multiples_and_category_getters, weight, implementations_with_extra_filters , category_filter )
39
+ function ( name, target_op, used_op_names_with_multiples_and_category_getters, weight, func , category_filter )
40
40
41
41
return ObjectifyWithAttributes(
42
42
rec ( ), NewType( TheFamilyOfDerivations, IsDerivedMethodRep ),
43
43
DerivationName, name,
44
44
DerivationWeight, weight,
45
- DerivationFunctionsWithExtraFilters, implementations_with_extra_filters ,
45
+ DerivationFunction, func ,
46
46
CategoryFilter, category_filter,
47
47
TargetOperation, NameFunction( target_op ),
48
48
UsedOperationsWithMultiplesAndCategoryGetters, used_op_names_with_multiples_and_category_getters
80
80
InstallMethod( InstallDerivationForCategory,
81
81
[ IsDerivedMethod, IsPosInt, IsCapCategory ] ,
82
82
function ( d, weight, C )
83
- local method_name, implementation_list , add_method, add_name, general_filter_list,
83
+ local method_name, func , add_method, add_name, general_filter_list,
84
84
installation_name, nr_arguments, cache_name, current_filters, current_implementation,
85
85
function_called_before_installation;
86
86
@@ -92,7 +92,7 @@ function( d, weight, C )
92
92
DerivationName( d ), " \n " ) );
93
93
94
94
method_name := TargetOperation( d );
95
- implementation_list := DerivationFunctionsWithExtraFilters ( d );
95
+ func := DerivationFunction ( d );
96
96
add_name := Concatenation( " Add" , method_name );
97
97
add_method := ValueGlobal( add_name );
98
98
@@ -102,7 +102,9 @@ function( d, weight, C )
102
102
103
103
fi ;
104
104
105
- add_method( C, implementation_list, weight : IsDerivation := true );
105
+ # use the add method with signature IsCapCategory, IsList, IsInt to avoid
106
+ # the convenience for AddZeroObject etc.
107
+ add_method( C, [ Pair( func, [ ] ) ] , weight : IsDerivation := true );
106
108
107
109
end );
108
110
@@ -176,7 +178,7 @@ end );
176
178
InstallMethod( AddDerivation,
177
179
[ IsDerivedMethodGraphRep, IsDerivedMethod ] ,
178
180
function ( G, d )
179
- local method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, current_additional_filter_list_length, impl, x;
181
+ local method_name, filter_list, number_of_proposed_arguments, current_function_argument_number, x;
180
182
181
183
if IsIdenticalObj( G, CAP_INTERNAL_DERIVATION_GRAPH ) then
182
184
@@ -192,23 +194,12 @@ function( G, d )
192
194
193
195
number_of_proposed_arguments := Length( filter_list );
194
196
195
- for impl in DerivationFunctionsWithExtraFilters( d ) do
196
-
197
- current_function_argument_number := NumberArgumentsFunction( impl[ 1 ] );
198
-
199
- if current_function_argument_number >= 0 and current_function_argument_number <> number_of_proposed_arguments then
200
- Error( " While adding a derivation for " , method_name, " : given function has " , String( current_function_argument_number ),
201
- " arguments but should have " , String( number_of_proposed_arguments ) );
202
- fi ;
203
-
204
- current_additional_filter_list_length := Length( impl[ 2 ] );
205
-
206
- if current_additional_filter_list_length > 0 and current_additional_filter_list_length <> number_of_proposed_arguments then
207
- Error( " While adding a derivation for " , method_name, " : there are " , String( current_additional_filter_list_length ),
208
- " additional filters but there should be " , String( number_of_proposed_arguments ), " (or none)" );
209
- fi ;
210
-
211
- od ;
197
+ current_function_argument_number := NumberArgumentsFunction( DerivationFunction( d ) );
198
+
199
+ if current_function_argument_number >= 0 and current_function_argument_number <> number_of_proposed_arguments then
200
+ Error( " While adding a derivation for " , method_name, " : given function has " , String( current_function_argument_number ),
201
+ " arguments but should have " , String( number_of_proposed_arguments ) );
202
+ fi ;
212
203
213
204
if NumberArgumentsFunction( CategoryFilter( d ) ) = 0 or NumberArgumentsFunction( CategoryFilter( d ) ) > 1 then
214
205
@@ -230,45 +221,17 @@ end );
230
221
InstallMethod( AddDerivation,
231
222
[ IsDerivedMethodGraph, IsFunction, IsFunction ] ,
232
223
233
- function ( graph, target_op, implementations_with_extra_filters )
224
+ function ( graph, target_op, func )
234
225
235
- AddDerivation( graph,
236
- target_op,
237
- [ ] ,
238
- [ [ implementations_with_extra_filters, [ ] ] ] );
239
-
240
- end );
241
-
242
- InstallMethod( AddDerivation,
243
- [ IsDerivedMethodGraph, IsFunction, IsDenseList ] ,
244
-
245
- function ( graph, target_op, implementations_with_extra_filters )
246
-
247
- AddDerivation( graph,
248
- target_op,
249
- [ ] ,
250
- [ [ implementations_with_extra_filters, [ ] ] ] );
226
+ AddDerivation( graph, target_op, [ ] , func );
251
227
252
228
end );
253
229
254
230
InstallMethod( AddDerivation,
255
231
[ IsDerivedMethodGraph, IsFunction, IsDenseList, IsFunction ] ,
256
232
257
- function( graph, target_op, used_ops_with_multiples,
258
- implementations_with_extra_filters )
259
-
260
- AddDerivation( graph,
261
- target_op,
262
- used_ops_with_multiples,
263
- [ [ implementations_with_extra_filters, [ ] ] ] );
264
-
265
- end );
266
-
267
- InstallMethod( AddDerivation,
268
- [ IsDerivedMethodGraph, IsFunction, IsDenseList, IsDenseList ] ,
269
-
270
- function ( graph, target_op, used_ops_with_multiples_and_category_getters, implementations_with_extra_filters )
271
- local weight, category_filter, description, loop_multiplier, category_getters, function_called_before_installation, operations_in_graph, collected_list, current_list, used_op_names_with_multiples_and_category_getters, derivation, current_implementation, x;
233
+ function ( graph, target_op, used_ops_with_multiples_and_category_getters, func )
234
+ local weight, category_filter, description, loop_multiplier, category_getters, function_called_before_installation, operations_in_graph, collected_list, used_op_names_with_multiples_and_category_getters, derivation, x;
272
235
273
236
weight := CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT( " Weight" , 1 );
274
237
category_filter := CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT( " CategoryFilter" , IsCapCategory );
@@ -280,14 +243,7 @@ InstallMethod( AddDerivation,
280
243
# # get used ops
281
244
operations_in_graph := Operations( graph );
282
245
283
- collected_list := [ ] ;
284
-
285
- for current_implementation in implementations_with_extra_filters do
286
-
287
- current_list := CAP_INTERNAL_FIND_APPEARANCE_OF_SYMBOL_IN_FUNCTION( current_implementation[ 1 ] , operations_in_graph, loop_multiplier, CAP_INTERNAL_METHOD_RECORD_REPLACEMENTS, category_getters );
288
- collected_list := CAP_INTERNAL_MERGE_PRECONDITIONS_LIST( collected_list, current_list );
289
-
290
- od ;
246
+ collected_list := CAP_INTERNAL_FIND_APPEARANCE_OF_SYMBOL_IN_FUNCTION( func, operations_in_graph, loop_multiplier, CAP_INTERNAL_METHOD_RECORD_REPLACEMENTS, category_getters );
291
247
292
248
if IsEmpty( used_ops_with_multiples_and_category_getters ) then
293
249
@@ -352,7 +308,7 @@ InstallMethod( AddDerivation,
352
308
target_op,
353
309
used_op_names_with_multiples_and_category_getters,
354
310
weight,
355
- implementations_with_extra_filters ,
311
+ func ,
356
312
category_filter );
357
313
358
314
if function_called_before_installation <> false then
@@ -365,6 +321,24 @@ InstallMethod( AddDerivation,
365
321
366
322
end );
367
323
324
+ InstallMethod( AddDerivation,
325
+ [ IsDerivedMethodGraph, IsFunction, IsDenseList ] ,
326
+
327
+ function ( graph, target_op, implementations_with_extra_filters )
328
+
329
+ Error( " passing a list of functions to `AddDerivation` is not supported anymore" );
330
+
331
+ end );
332
+
333
+ InstallMethod( AddDerivation,
334
+ [ IsDerivedMethodGraph, IsFunction, IsDenseList, IsDenseList ] ,
335
+
336
+ function ( graph, target_op, used_ops_with_multiples, implementations_with_extra_filters )
337
+
338
+ Error( " passing a list of functions to `AddDerivation` is not supported anymore" );
339
+
340
+ end );
341
+
368
342
InstallGlobalFunction( AddDerivationToCAP,
369
343
370
344
function ( arg )
@@ -975,7 +949,7 @@ InstallGlobalFunction( DerivationsOfMethodByCategory,
975
949
976
950
od ;
977
951
978
- currently_installed_funcs := DerivationFunctionsWithExtraFilters( current_derivation );
952
+ currently_installed_funcs := [ Pair( DerivationFunction( current_derivation ), [ ] ) ] ;
979
953
980
954
fi ;
981
955
0 commit comments