From ff06318e249fd707cce137fc0f8bc531916ead5c Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Fri, 2 Sep 2022 13:18:40 +0200 Subject: [PATCH] CapJitAddTypeSignature( "LazyArray", [ IsInt, IsFunction ], ... ) --- CompilerForCAP/PackageInfo.g | 2 +- CompilerForCAP/gap/InferDataTypes.gi | 47 ++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/CompilerForCAP/PackageInfo.g b/CompilerForCAP/PackageInfo.g index 8c6df48668..1b85b507d4 100644 --- a/CompilerForCAP/PackageInfo.g +++ b/CompilerForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CompilerForCAP", Subtitle := "Speed up computations in CAP categories", -Version := "2022.09-03", +Version := "2022.09-04", Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ), License := "GPL-2.0-or-later", diff --git a/CompilerForCAP/gap/InferDataTypes.gi b/CompilerForCAP/gap/InferDataTypes.gi index 9ecaa9b0e2..26edab8d0d 100644 --- a/CompilerForCAP/gap/InferDataTypes.gi +++ b/CompilerForCAP/gap/InferDataTypes.gi @@ -919,10 +919,17 @@ CapJitAddTypeSignature( "ListWithIdenticalEntries", [ IsInt, IsObject ], functio end ); CapJitAddTypeSignature( "Concatenation", [ IsList ], function ( input_types ) + local filter; - Assert( 0, input_types[1].element_type.filter = IsList ); + if input_types[1].element_type.filter = IsList then + filter := IsList; + elif input_types[1].element_type.filter = IsLazyArray then + filter := IsLazyArray; + else + Error( input_types[1].element_type.filter, " is not in [ IsList, IsLazyArray ]\n" ); + fi; - return rec( filter := IsList, element_type := input_types[1].element_type.element_type ); + return rec( filter := filter, element_type := input_types[1].element_type.element_type ); end ); @@ -1101,6 +1108,42 @@ CapJitAddTypeSignature( "MatElm", [ IsList, IsInt, IsInt ], function ( input_typ end ); +CapJitAddTypeSignature( "LazyArray", [ IsInt, IsFunction ], function ( input_types ) + + return rec( filter := IsLazyArray, element_type := rec( filter := IsInt ) ); + +end ); + +CapJitAddTypeSignature( "LazyStandardInterval", [ IsInt ], function ( input_types ) + + return rec( filter := IsLazyArray, element_type := rec( filter := IsInt ) ); + +end ); + +CapJitAddTypeSignature( "LazyInterval", [ IsInt, IsInt ], function ( input_types ) + + return rec( filter := IsLazyInterval, element_type := rec( filter := IsInt ) ); + +end ); + +CapJitAddTypeSignature( "LazyConstantArray", [ IsInt, IsInt ], function ( input_types ) + + return rec( filter := IsLazyConstantArray, element_type := rec( filter := IsInt ) ); + +end ); + +CapJitAddTypeSignature( "LazyArrayFromList", [ IsList ], function ( input_types ) + + return rec( filter := IsLazyArrayFromList, element_type := rec( filter := IsInt ) ); + +end ); + +CapJitAddTypeSignature( "ListOfValues", [ IsLazyArray ], function ( input_types ) + + return rec( filter := IsList, element_type := rec( filter := IsInt ) ); + +end ); + CapJitAddTypeSignature( "LazyHList", [ IsList, IsFunction ], function ( args, func_stack ) args := ShallowCopy( args );