Rangarajan Posted April 28, 2016 Posted April 28, 2016 The function filter-first lets us select the first N items from a list (sublists too). The current behaviour is to raise an error when N is greater than the length of the list. For example, it is an error to say: (filter-first 4 '(a b c)) This definitely acceptable behaviour, but I am wondering if it is OK to ask for more than what the list has, in which case it will return only what it can (i.e., based on length of list). In other words, if I say: (filter-first 4 '(a b c)) it will return (a b c) without error. What do you feel? This applies to filter-last also. -Rangarajan Quote
opmo Posted April 28, 2016 Posted April 28, 2016 If N is greater than the length of the list we should get an error and we do :-) The N is what we are looking for. Quote
opmo Posted April 28, 2016 Posted April 28, 2016 We could add a keyword and return only what it can. If this would be useful for your work I can make the change. Quote
Rangarajan Posted April 28, 2016 Author Posted April 28, 2016 Thanks, but unless it is useful to others as well, I would not suggest it. Besides, it is easy to get the behaviour I want by wrapping up some condition on filter-first. -Rangarajan Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.