jow- / ucode

JavaScript-like language with optional templating
ISC License
90 stars 30 forks source link

Equivalent of slice() #106

Closed huafu closed 2 years ago

huafu commented 2 years ago
  1. I see there is a splice() function, first why does its return value isn't, as in JS, an array of the deleted item(s)?
  2. I can't find any slice() function, is there any equivalent or should I just use filter based on index?

Thanks in advance, if I can be of any help lemme know, tho that's a while I haven't coded in C :smile:

jow- commented 2 years ago
  1. Good question. I felt that returning the last removed item might be more useful since dealing with list return values can be cumbersome due to the lack of destructured assignment support, but I guess we could change it
  2. The slice() function looks like a sane addition, I'll look into it