EntilZha / PyFunctional

Python library for creating data pipelines with chain functional programming
http://pyfunctional.pedro.ai
MIT License
2.41k stars 132 forks source link

Unexpected behaviour on chain with .drop_right #156

Closed ajtkulov closed 3 years ago

ajtkulov commented 3 years ago

Ok

seq(1,2,3,4,5).filter(_ < 4) [1,2,3]

Ok

seq(1,2,3,4,5).filter(_ < 4).drop(1) [2,3]

Fail

seq(1,2,3,4,5).filter(_ < 4).drop_right(1) [1,2,3,4]

Fail

seq(5,4,3,2,5,23,5,6,3,2,1,5,3).sorted().drop_right(2) [5, 4, 3, 2, 5, 23, 5, 6, 3, 2, 1]

Seems that .drop_right() ignores previous chain calls.

EntilZha commented 3 years ago

Thanks for bug report, I was able to reproduce and I think fixed it in https://github.com/EntilZha/PyFunctional/pull/157.

If the solution fixes the issue, I'll merge the fix, thanks!

EntilZha commented 3 years ago

Gonna close as fixed, feel free to re-open if not, can do a release sometime soon if its breaking code somewhere (otherwise busy until the 26th)