- 
                Notifications
    
You must be signed in to change notification settings  - Fork 103
 
Fast inclusion operation on hashmaps and hashsets #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6a5388c
              d196da7
              dd8bea1
              b15993e
              e5590d4
              57e8477
              86b1b80
              9385f83
              5ecf8f8
              4d1aaa2
              319ed14
              927287e
              4e694f9
              88400ea
              8de6641
              815bca2
              5c88c7e
              3ca2f77
              dd079a3
              012188b
              7e2de75
              2d79571
              e4de203
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -111,6 +111,7 @@ module Data.HashSet | |
| , member | ||
| , insert | ||
| , delete | ||
| , isSubsetOf | ||
| 
     | 
||
| -- * Transformations | ||
| , map | ||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -55,6 +55,7 @@ module Data.HashSet.Internal | |||||||
| , member | ||||||||
| , insert | ||||||||
| , delete | ||||||||
| , isSubsetOf | ||||||||
| 
     | 
||||||||
| -- * Transformations | ||||||||
| , map | ||||||||
| 
          
            
          
           | 
    @@ -310,6 +311,18 @@ fromMap = HashSet | |||||||
| keysSet :: HashMap k a -> HashSet k | ||||||||
| keysSet m = fromMap (() <$ m) | ||||||||
| 
     | 
||||||||
| -- | /O(n*log m)/ Inclusion of sets. | ||||||||
| -- | ||||||||
| -- ==== __Examples__ | ||||||||
| -- | ||||||||
| -- >>> fromList [1,3] `isSubsetOf` fromList [1,2,3] | ||||||||
| -- True | ||||||||
| -- | ||||||||
| -- >>> fromList [1,2] `isSubsetOf` fromList [1,3] | ||||||||
| -- False | ||||||||
| isSubsetOf :: (Eq a, Hashable a) => HashSet a -> HashSet a -> Bool | ||||||||
| isSubsetOf s1 s2 = H.isSubmapOfBy (\_ _ -> True) (asMap s1) (asMap s2) | ||||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If INLINABLE helps with specialization, it would be good to use here, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The best thing to do is always to write some sample code and pore over the Core. But that's not a hard requirement when adding new functions.  | 
||||||||
| 
     | 
||||||||
| -- | /O(n+m)/ Construct a set containing all elements from both sets. | ||||||||
| -- | ||||||||
| -- To obtain good performance, the smaller set must be presented as | ||||||||
| 
          
            
          
           | 
    ||||||||
Uh oh!
There was an error while loading. Please reload this page.