[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: named-let

From: Stefan Monnier
Subject: Re: named-let
Date: Sat, 09 Jan 2021 13:43:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Is there hope for general contification? So that things like
> (defun my-even? (x)
>   (cl-labels ((even? (x) (or (= x 0) (odd? (1- x))))
>               (odd?  (x) (or (= x 1) (even? (1- x)))))
>     (even? x)))
> are translated to a bunch of gotos and no lambdas.

I have no plans to go there in the foreseeable future, but that
shouldn't stop anyone else.

I think an intermediate step would be to do it for code like

    (defun my-even? (x)
      (cl-labels ((even? (x)
                    (let ((odd? (lambda (x) (or (= x 1) (even? (1- x))))))
                      (or (= x 0) (odd? (1- x))))))
        (even? x)))

but even that requires a fair bit more work than what I've just done,
I think.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]