Dear Will Chen, Dear Forum,
> On 14 Apr 2020, at 21:42, Will Chen <oxei...@gmail.com> wrote: > > Size(...) doesn't seem to work for dictionaries. > > Is there a way to return its size? (or do we have to track it separately as > we add to it?) > When we designed dictionaries, Size had not been on the list of access functions (as i would be kbnown by the calling algorithm anyhow). However for the current implementations of dictionaries, it would not be hard to add `Size` methods, if they do not exist yet. I think the following installations shoudl do so. InstallMethod(Size,"for list dictionaries",true,[IsListDictionary],0, function(d) return Length(d!.list); end); InstallMethod(Size,"for list lookup dictionaries",true, [IsListLookupDictionary],0, function(d) return Length(d!.entries); end); InstallMethod(Size,"for position dictionaries",true,[IsPositionDictionary],0, function(d) return SizeBlist(d!.blist); end); InstallMethod(Size,"for hash tables",true,[IsHash],0, function(ht) return ht!.NumberKeys; end); Best, Alexander Hulpke _______________________________________________ Forum mailing list Forum@gap-system.org https://mail.gap-system.org/mailman/listinfo/forum