racket-collections
racket-collections copied to clipboard
Generic collections API for Racket
I had a hard time figuring out how to create a struct that implements gen:indexable My attempt: `(struct ash (h) #:methods gen:indexable [(define (ref collection index) (hash-ref (ash-h collection) index))...
Hope that's alright. Couldn't decide which names would be best for the dummy functions required for ref and set-ref in the define/generic forms. Hopefully there won't be alternate versions of...
Hi there. I noticed updating functions (hash-update...) aren't included in the generic interface for indexables. Seems like it's an easy addition (though I could be wrong) by just adding them...
This will work: ```racket #lang racket (require data/collection) (struct wrapped-collection (value) #:methods gen:countable [(define (length c) 42)]) (length (wrapped-collection 'foo)) ; 42 ``` But remove the `c` from the definition...
Perhaps intended, but I found it surprising, given that the rest of the API seems to adhere to `racket/base` conventions for homonymic functions
I'm attempting to make some lenses that view `maybe`s of indexables, but there's no way to test if a key is in an indexable. I was expecting some sort of...
The lazy behavior of the generic `map`, `filter`, etc. functions is very useful, but sometimes lazyness isn't something I want. For example, tests, docs examples, and REPL experimentation. It'd be...