Re: Handling deep list recursion

Heime <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <HRIIlMRyc6oPZ9Z8xNXQ5zNWWJhxZvt4Akcy7b83nGCO6vrJ0vknxgxqtnxixpqAiaQNXGzn735balBGynEsiMxoMGwqEdJaQJKqqt6gBlc=@protonmail.com>
On Tuesday, April 14th, 2026 at 11:12 AM, [email protected] <[email protected]> wrote:

> Heime <[email protected]> writes:
> 
> > I want to handle the recursion situation when list is too big.
> > What would be the best plan when it is too long?  Catch the error
> > if it happens and continue with nonlocal exit than continues with
> > cl-every?  Of compute the length beforehand?
> >
> 
> 1. If someone does not provide a recursive solution to your
> question, then you might consider writing an iterative
> solution using ‘dolist’ or ‘while’ or ‘do’.

I could use the `while' approach, because there is no binding 
overhead.
 
>    (info "(elisp) Iteration")
> 
> 2. Besides ‘cl-every’, you could write a solution using
> ‘cl-find-if’ or ‘cl-find-if-not’ or ‘cl-notany’.

cl-notany looks the most appropriate because it exits immediately 
on first non-consp cell, matching the recursive early-return logic.
 
> --
> The lyf so short, the craft so long to lerne.
> - Geoffrey Chaucer, The Parliament of Birds.
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.