[GAP Forum] counting elements

Joe Bohanon jbohanon2 at gmail.com
Fri May 14 15:47:16 BST 2010


This also works for arrays.  (Matter of fact, a string is just an array 
of characters).

Joe

Robert Morse wrote:
> The Length and Collected commands are what you are looking for.
>
> gap> list:="abbccc";;
> gap> Length(list);
> 6
> gap> Collected(list);
> [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ]
>
>
> Robert F. Morse
>
>
>
> On Fri, May 14, 2010 at 4:47 AM, Jan Schneider <jansch2 at gmx.de> wrote:
>   
>> Hi there,
>> I'm just wondering, whether you all can tell me how to count the objects of a list. If I define for example a list:="abbccc", how do I manage to let GAP count the letters?
>> Hope to hear from you soon.
>>
>> Thanks
>> Stefan
>> --
>> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>>
>> _______________________________________________
>> Forum mailing list
>> Forum at mail.gap-system.org
>> http://mail.gap-system.org/mailman/listinfo/forum
>>
>>     
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>
>   




More information about the Forum mailing list