List to Chunks of size N

2020-03-04 Thread C K Kashyap
Hi all, I've written a function to break a list into chunks of size N - (de Chunks (Lst N) (make (while Lst (link (head N Lst)) (cut N 'Lst) ) ) ) Does this look reasonable? Or am I missing something builtin? Regards, Kashyap

Re: List to Chunks of size N

2020-03-04 Thread Alexander Burger
Hi Kashyap, > I've written a function to break a list into chunks of size N - > > (de Chunks (Lst N) >(make > (while Lst > (link (head N Lst)) > (cut N 'Lst) ) ) ) This works, but 'head' and 'cut' both traverse the list, so the work is duplicated. Just 'cut' suffices.