Skip to content

Commit 8a368ab

Browse files
made CartesianEvaluationMorphismWithGivenSource purely functional
for SkeletalFinSets
1 parent 798c9fb commit 8a368ab

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "FinSetsForCAP",
1212
Subtitle := "The elementary topos of (skeletal) finite sets",
13-
Version := "2021.12-03",
13+
Version := "2021.12-04",
1414

1515
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1616
License := "GPL-2.0-or-later",

gap/SkeletalFinSetsForCAP.gi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,12 @@ end );
847847
##
848848
AddCartesianEvaluationMorphismWithGivenSource( SkeletalFinSets,
849849
function ( cat, M, N, HM_NxM )
850-
local HM_N, m;
850+
local m, n;
851851

852852
m := Length( M );
853+
n := Length( N );
853854

854-
HM_N := List( Tuples( AsList( N ), m ), x -> MapOfFinSets( M, x, N ) );
855-
856-
return MapOfFinSets( HM_NxM, List( Cartesian( HM_N, AsList( M ) ), fx -> fx[1](fx[2]) ), N );
855+
return MapOfFinSets( HM_NxM, List( [ 0 .. Length( HM_NxM ) - 1 ], i -> 1 + RemInt( QuoInt( QuoInt( i, m ), n^(m - RemInt( i, m ) - 1 ) ), n ) ), N );
857856

858857
end );
859858

gap/precompiled_categories/CategoryOfSkeletalFinSetsPrecompiled.gi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ end
2727

2828
########
2929
function ( cat_1, a_1, b_1, s_1 )
30-
return MapOfFinSets( s_1, List( Cartesian( List( Tuples( AsList( b_1 ), Length( a_1 ) ), function ( x_2 )
31-
return MapOfFinSets( a_1, x_2, b_1 );
32-
end ), AsList( a_1 ) ), function ( fx_2 )
33-
return fx_2[1]( fx_2[2] );
30+
local hoisted_1_1, hoisted_2_1;
31+
hoisted_2_1 := Length( b_1 );
32+
hoisted_1_1 := Length( a_1 );
33+
return MapOfFinSets( s_1, List( [ 0 .. Length( s_1 ) - 1 ], function ( i_2 )
34+
return 1 + REM_INT( QUO_INT( QUO_INT( i_2, hoisted_1_1 ), hoisted_2_1 ^ (hoisted_1_1 - REM_INT( i_2, hoisted_1_1 ) - 1) ), hoisted_2_1 );
3435
end ), b_1 );
3536
end
3637
########

0 commit comments

Comments
 (0)