Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsfoster/elm-heap
Heaps for elm
https://github.com/tsfoster/elm-heap
data-structures elm elm-lang elm-language heaps
Last synced: 2 months ago
JSON representation
Heaps for elm
- Host: GitHub
- URL: https://github.com/tsfoster/elm-heap
- Owner: TSFoster
- License: mit
- Created: 2017-02-06T16:42:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T14:23:31.000Z (over 4 years ago)
- Last Synced: 2024-09-30T05:22:33.607Z (3 months ago)
- Topics: data-structures, elm, elm-lang, elm-language, heaps
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/TSFoster/elm-heap/latest/
- Size: 54.7 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-heap
Data structure for heaps, in [Elm][elmlang].
[elmlang]: http://elm-lang.org/
## Usage
Install the package:
```shell
elm package install TSFoster/elm-heap
```Use the heap:
```elm
import Heap exposing (Heap, smallest, biggest, by, thenBy)type alias Person =
{ firstname : String
, surname : String
, age : Int
}init : Heap Person
init = Heap.empty (smallest |> by .surname)defaultPeople : Heap Person
defaultPeople =
Heap.fromList (biggest |> by .surname |> thenBy .firstName |> thenBy .age)
[ { firstname = "Anders", surname = "And", age = 83 }
, { firstname = "Bruce", surname = "Bogtrotter", age = 8 }
, { firstname = "Charlie", surname = "Chaplin", age = 88 }
, { firstname = "Donald", surname = "Duck", age = 83 }
]
```For full documentation, see [package.elm-lang.org][package-doc].
[package-doc]: http://package.elm-lang.org/packages/TSFoster/elm-heap/latest
# [Tests](/tests)
```shell
git clone https://github.com/TSFoster/elm-heap.git
cd elm-heap
npm install
npm test
```# License
[MIT](/LICENSE)