go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

Support customizable comparator #111

Closed typeless closed 4 years ago

typeless commented 4 years ago

Note that I am not very satisfied with the API design and propagated changes of the PR, especially about the way of how to specify a new comparator. But it does provide what I need for my immediate use-case.

typeless commented 4 years ago

Regarding the problem of why I design the comparator this way, I expected that the comparators just have to be converted to function pointers (from string constants). But it turned out that the behavior of the In operator can not be generalized with the rest of the comparators. As a result, all I can think of is to have a flag (the mode field) to specialize the behavior of Compare for In. Otherwise, I would have to use an ugly reflection hack to determine the difference.

chrstphlbr commented 4 years ago

This is very similar to my, unfortunately still open, PR #99.

kniren commented 4 years ago

Agreed, I'm closing this issue in favour of #99. In any case, thank you very much for your time!