@@ -34,15 +34,15 @@ InstallGlobalFunction( "DeactivateDerivationInfo",
3434end );
3535
3636InstallMethod( MakeDerivation,
37- [ IsString, IsFunction, IsDenseList, IsPosInt, IsDenseList , IsFunction ] ,
37+ [ IsString, IsFunction, IsDenseList, IsPosInt, IsFunction , IsFunction ] ,
3838
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 )
4040
4141 return ObjectifyWithAttributes(
4242 rec ( ), NewType( TheFamilyOfDerivations, IsDerivedMethodRep ),
4343 DerivationName, name,
4444 DerivationWeight, weight,
45- DerivationFunctionsWithExtraFilters, implementations_with_extra_filters ,
45+ DerivationFunction, func ,
4646 CategoryFilter, category_filter,
4747 TargetOperation, NameFunction( target_op ),
4848 UsedOperationsWithMultiplesAndCategoryGetters, used_op_names_with_multiples_and_category_getters
8080InstallMethod( InstallDerivationForCategory,
8181 [ IsDerivedMethod, IsPosInt, IsCapCategory ] ,
8282function ( 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,
8484 installation_name, nr_arguments, cache_name, current_filters, current_implementation,
8585 function_called_before_installation;
8686
@@ -92,7 +92,7 @@ function( d, weight, C )
9292 DerivationName( d ), " \n " ) );
9393
9494 method_name := TargetOperation( d );
95- implementation_list := DerivationFunctionsWithExtraFilters ( d );
95+ func := DerivationFunction ( d );
9696 add_name := Concatenation( " Add" , method_name );
9797 add_method := ValueGlobal( add_name );
9898
@@ -102,7 +102,9 @@ function( d, weight, C )
102102
103103 fi ;
104104
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 );
106108
107109end );
108110
@@ -176,7 +178,7 @@ end );
176178InstallMethod( AddDerivation,
177179 [ IsDerivedMethodGraphRep, IsDerivedMethod ] ,
178180function ( 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;
180182
181183 if IsIdenticalObj( G, CAP_INTERNAL_DERIVATION_GRAPH ) then
182184
@@ -192,23 +194,12 @@ function( G, d )
192194
193195 number_of_proposed_arguments := Length( filter_list );
194196
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 ;
212203
213204 if NumberArgumentsFunction( CategoryFilter( d ) ) = 0 or NumberArgumentsFunction( CategoryFilter( d ) ) > 1 then
214205
@@ -230,45 +221,17 @@ end );
230221InstallMethod( AddDerivation,
231222 [ IsDerivedMethodGraph, IsFunction, IsFunction ] ,
232223
233- function ( graph, target_op, implementations_with_extra_filters )
224+ function ( graph, target_op, func )
234225
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 );
251227
252228end );
253229
254230InstallMethod( AddDerivation,
255231 [ IsDerivedMethodGraph, IsFunction, IsDenseList, IsFunction ] ,
256232
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;
272235
273236 weight := CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT( " Weight" , 1 );
274237 category_filter := CAP_INTERNAL_RETURN_OPTION_OR_DEFAULT( " CategoryFilter" , IsCapCategory );
@@ -280,14 +243,7 @@ InstallMethod( AddDerivation,
280243 # # get used ops
281244 operations_in_graph := Operations( graph );
282245
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 );
291247
292248 if IsEmpty( used_ops_with_multiples_and_category_getters ) then
293249
@@ -352,7 +308,7 @@ InstallMethod( AddDerivation,
352308 target_op,
353309 used_op_names_with_multiples_and_category_getters,
354310 weight,
355- implementations_with_extra_filters ,
311+ func ,
356312 category_filter );
357313
358314 if function_called_before_installation <> false then
@@ -365,6 +321,24 @@ InstallMethod( AddDerivation,
365321
366322end );
367323
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+
368342InstallGlobalFunction( AddDerivationToCAP,
369343
370344 function ( arg )
@@ -975,7 +949,7 @@ InstallGlobalFunction( DerivationsOfMethodByCategory,
975949
976950 od ;
977951
978- currently_installed_funcs := DerivationFunctionsWithExtraFilters( current_derivation );
952+ currently_installed_funcs := [ Pair( DerivationFunction( current_derivation ), [ ] ) ] ;
979953
980954 fi ;
981955
0 commit comments