From 02d07703a8e7f7d11a90e2c59096b7299eda14a3 Mon Sep 17 00:00:00 2001 From: Tibor Gruen Date: Mon, 13 Apr 2020 17:50:51 +0200 Subject: [PATCH] Shortened global function ConvertToMapOfFinSets using PositionsProperty --- gap/CatRepsWithCAP.gi | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/gap/CatRepsWithCAP.gi b/gap/CatRepsWithCAP.gi index bfe1aef..dfe9b8a 100644 --- a/gap/CatRepsWithCAP.gi +++ b/gap/CatRepsWithCAP.gi @@ -7,7 +7,7 @@ ## InstallGlobalFunction( ConvertToMapOfFinSets, function( objects, gen ) - local O, T, isb, S, G, j, i; + local O, T, S, G, j, i; for O in objects do if Length(Intersection(gen,O)) > 0 then @@ -20,21 +20,7 @@ InstallGlobalFunction( ConvertToMapOfFinSets, Error( "unable to find target set\n" ); fi; - ## returns the positions i in L where L[i] is bound as a dense list. - isb := function(L) - local M,i,j; - j := 1; - M := []; - for i in [1..Length(L)] do - if IsBound(L[i]) then - M[j] := i; - j := j+1; - fi; - od; - return M; - end; - - S := FinSet(isb(gen)); + S := FinSet(PositionsProperty(Flat(objects),i->IsBound(gen[i]))); G := []; j := 1;