# [proposal] limit(n, ...)

5 messages
Open this post in threaded view
|

## [proposal] limit(n, ...)

 it'd be nice to have a limit() function companion to select() where select skips the first n and limit skips everything after n.e.g. limit(1) --> nothing, limit(1, 1, 2, 3) --> 1, etc
Open this post in threaded view
|

## Re: [proposal] limit(n, ...)

 On Thu, Oct 10, 2019 at 2:54 PM Soni L. wrote:it'd be nice to have a limit() function companion to select() where select skips the first n and limit skips everything after n.e.g. limit(1) --> nothing, limit(1, 1, 2, 3) --> 1, etc1) Please note that you can get the last N elements by invoking select(-N, ...)You probably can change the order of parameters in your functions to switch from "get first N" approach to "get last N".2) Why asking for introducing new function instead of overloading old one?For example:select("range", 2, 3, "a", "b", "c", "d")  -->  "b", "c"3) Extracting a subtuple from a tuple would be practically useless without ability to concatenate tuples.
Open this post in threaded view
|

## Re: [proposal] limit(n, ...)

 On Thu, Oct 10, 2019, 09:50 Egor Skriptunoff <[hidden email]> wrote:On Thu, Oct 10, 2019 at 2:54 PM Soni L. wrote:it'd be nice to have a limit() function companion to select() where select skips the first n and limit skips everything after n.e.g. limit(1) --> nothing, limit(1, 1, 2, 3) --> 1, etc1) Please note that you can get the last N elements by invoking select(-N, ...)You probably can change the order of parameters in your functions to switch from "get first N" approach to "get last N".Yes I can use a coroutine to reverse the order, use select, then use another coroutine to reverse the order again.2) Why asking for introducing new function instead of overloading old one?For example:select("range", 2, 3, "a", "b", "c", "d")  -->  "b", "c"Uhh no3) Extracting a subtuple from a tuple would be practically useless without ability to concatenate tuples.We don't have tuples.