Nice! ... Thanks Alex,
Regards,
Kashyap

On Wed, Mar 4, 2020 at 10:17 PM Alexander Burger <a...@software-lab.de>
wrote:

> 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.
>
> The naming 'Chunks' is not ideal, as uppercase initial characters indicate
> locally bound symbols (variablesrn. So I would write it this way:
>
>    (de chunks (Lst N)
>       (make
>          (while Lst
>             (link (cut N 'Lst)) ) ) )
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to