The most general form of let/let* Marc Nieper-Wißkirchen (15 Nov 2022 12:30 UTC)
Re: The most general form of let/let* Lassi Kortela (15 Nov 2022 20:11 UTC)
Re: The most general form of let/let* Lassi Kortela (15 Nov 2022 20:23 UTC)
Re: The most general form of let/let* Marc Nieper-Wißkirchen (15 Nov 2022 20:28 UTC)
Re: The most general form of let/let* John Cowan (15 Nov 2022 20:38 UTC)
Re: The most general form of let/let* Marc Nieper-Wißkirchen (15 Nov 2022 20:48 UTC)
Re: The most general form of let/let* Daphne Preston-Kendal (15 Nov 2022 20:35 UTC)
Re: The most general form of let/let* Marc Nieper-Wißkirchen (15 Nov 2022 20:43 UTC)
Re: The most general form of let/let* Lassi Kortela (16 Nov 2022 08:19 UTC)
Re: The most general form of let/let* Jeremy Steward (17 Nov 2022 01:53 UTC)
Re: The most general form of let/let* Marc Nieper-Wißkirchen (17 Nov 2022 07:49 UTC)
Re: The most general form of let/let* Jeremy Steward (17 Nov 2022 02:11 UTC)
Re: The most general form of let/let* Marc Nieper-Wißkirchen (17 Nov 2022 07:55 UTC)
Re: The most general form of let/let* Lassi Kortela (17 Nov 2022 08:01 UTC)

Re: The most general form of let/let* Marc Nieper-Wißkirchen 15 Nov 2022 20:28 UTC

The form I originally proposed is a generalization of let/let* where
the compiler figures out the dependencies.  If the graph is not
acyclic, it would be an error.

Of course, one could add letrec pieces for strongly connected
components of the dependency graph.  One has to check that this
wouldn't muddle the scoping rules for such a construct.

Am Di., 15. Nov. 2022 um 21:23 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
> BTW, how is self-recursion expressed? These don't work in Scheme:
>
> (let ((! (lambda (n) (if (<= n 1) 1 (* n (! (- n 1)))))))
>    (! 10))
>
> (let* ((! (lambda (n) (if (<= n 1) 1 (* n (! (- n 1)))))))
>    (! 10))
>
> We need this:
>
> (letrec ((! (lambda (n) (if (<= n 1) 1 (* n (! (- n 1)))))))
>    (! 10))
>
> Would you need this:
>
> (let-values (((!) (using ! (lambda (n) (if (<= n 1) 1 (* n (! (- n 1))))))))
>    (! 10))