Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nth slicing function doesn't work as intended #55

Open
den-kozlov opened this issue Dec 19, 2020 · 2 comments · May be fixed by #56
Open

nth slicing function doesn't work as intended #55

den-kozlov opened this issue Dec 19, 2020 · 2 comments · May be fixed by #56
Labels

Comments

@den-kozlov
Copy link

Documentation says that nth should return n-th element from iterator, which is not true for some cases.
Example:

tarantool> require "fun"()

tarantool> nth(1, drop_while(function(t) return t ~= "5" end, "123456789")) -- expecting '5'
---
- '1'
...

tarantool> nth(1, drop_while(function(t) return t ~= 5 end, {1,2,3,4,5,6,7,8,9})) --expecting 5
---
- 1
...

tarantool> nth(1, drop_while(function(t) return t ~= 5 end, range(9))) -- now it's correct
---
- 5
...

@d1rebear
Copy link

d1rebear commented Dec 19, 2020

Pull request (didn't update tests - sorry): #56.

@kyukhin kyukhin added the bug label Sep 9, 2021
@kyukhin kyukhin added this to the wishlist milestone Sep 9, 2021
@RunsFor
Copy link

RunsFor commented Sep 10, 2021

Also smashed into this:

tarantool> require('fun').iter({1,2,3,false,5,6,7}):drop_while(function(i) return i end):take(1):totable()[1]
---
- false
...

tarantool> require('fun').iter({1,2,3,false,5,6,7}):drop_while(function(i) return i end):nth(1)
---
- 1
...

@kyukhin kyukhin modified the milestone: wishlist Oct 15, 2021
@igormunkin igormunkin removed this from the wishlist milestone Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants