Containers and strictness continued
Felipe Lessa
felipe.lessa at gmail.com
Fri Jul 9 07:08:17 EDT 2010
On Fri, Jul 9, 2010 at 6:56 AM, Milan Straka <fox at ucw.cz> wrote:
> Hi all,
>
> for my work on the containers I need to settle some questions about strictness.
> Thank you very much for your opinions.
Thanks for looking into this! =)
> Discussion ends: 23. July 2010.
>
> 1) Strictness of keys and values in the datatype.
>
> Currently we have the following strictness flags in the datatypes:
> - IntMap: !key value
> - IntSet: !key
> - Map: !key value
> - Set: key
>
> I vote for changing Set to store keys also strict.
>
> Storing values as nonstrict probably makes sense.
+1 for strict Set keys
> 2) Strictness of keys and values in the method definitions.
>
> The IntMap.lookup (lookup k t = ... seq k ...) evaluates the given key
> even if it is not needed (when searching empty tree). Some methods are
> more carefull.
>
> I vote for all IntMap, IntSet, Map and Set methods that are given a key
> value (insert, delete, member, ...) to be strict in the keys. This
> a) would be consistent with 1)
> b) would be a bit more efficient (~5% in the IntMap.lookup case)
+1 for strictness in keys on all functions.
> 3) Strict folds
>
> Currently there are no strict folds.
>
> I vote for adding strict folds (fold', foldWithKey' when appropriate) to
> all Map, Set, IntMap, IntSet.
Not sure about this one, but it's probably +1 as well.
Cheers,
--
Felipe.
More information about the Libraries
mailing list