Udostępnij za pośrednictwem


HashIdentity.LimitedStructural<'T> Function (F#)

Implements a structural hash that is limited to hashing a fixed number of elements.

Namespace/Module Path: Microsoft.FSharp.Collections.HashIdentity

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
LimitedStructural : int -> IEqualityComparer<'T> (requires equality)

// Usage:
LimitedStructural limit

Parameters

  • limit
    Type: int

    The maximum number of elements to hash.

Return Value

An object that implements IEqualityComparer using the limited hash.

Remarks

Structural hashing recursively composes a hash of a structural object by combining the hashes of each of its constituent elements. So, if you have a list composed of 20,000 elements, the hashes of each element will be composed into the hash of the list.

To save time and mitigate the risk of a stack overflow while hashing, the limited hash allows you to specify an upper bound on the number of items you would like to consider when constructing a hash over structured data. So, if you are hashing a list of 20,000 elements, you can just use its first 18 elements.

LimitedStructural uses the limitedHash function.

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

Collections.HashIdentity Module (F#)

Microsoft.FSharp.Collections Namespace (F#)