alex-hhh / data-frame

A data frame implementation for Racket
https://alex-hhh.github.io/2018/08/racket-data-frame-package.html
Other
37 stars 10 forks source link

Some more getters #9

Closed ralsei closed 3 years ago

ralsei commented 3 years ago

This adds a few utility functions, and therefore closes #8.

Changes to existing functions:

New functions:

Nit-picks:

All functions have tests, but do feel free to let me know if they're insufficient.

alex-hhh commented 3 years ago

Another consideration you might want to give to df-index-range is whether it should return two values or a cons cell. If you find that most of the uses of df-index-range are like so:

(match-define (cons start end) (df-index-range ...))

You might want to make df-index-range return two values instead, as this would be more efficient.

alex-hhh commented 3 years ago

Hi @ralsei , can you pull from the ah/lower-bound branch as this implements the lower-bound and upper-bound functions, plus an equal-range function which you can use in the series-index-range function? These functions have better semantics than bsearch, but require the use of strict ordering for the sort function (e.g. use < instead of <=)

https://github.com/alex-hhh/data-frame/tree/ah/lower-bound

ralsei commented 3 years ago

So the issue with the changes in the ah/lower-bound branch is that sorting with <= no longer produces expected behavior, but using check-valid-sort with < and duplicate items in a series fails. This is why I added an equal? check -- but I don't know if this is what is wanted.

Still going to incorporate the requested changes.

ralsei commented 3 years ago

I think I have resolved all requested changes. Feel free to tell me if it doesn't.