Skip to content

Heap interface (for priority queues) #110

Description

@aseemk

Hey there,

Great work again. =) Just wanted to say it'd be sweet if the slice typewriter could support codegen'ing a PriorityQueue implementation too, via the Heap interface:

https://golang.org/pkg/container/heap/ (see PriorityQueue example)

Although if it's helpful, what I'm really looking to do is something like a "top N by <func>". An ideal implementation would use a heap/priority queue with capacity N, so discard anything ranked lower than N as I iterate over the slice and add things to this heap/priority queue.

Thanks for the consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions