Nп/п : 46 из 93
 От   : none) (albert                       2:5075/128        26 авг 23 14:49:58
 К    : Kaz Kylheku                                           26 авг 23 15:51:03
 Тема : Re: MAL : closures and recursion
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
f12b514d
@REPLY: <20230819073816.564@kylheku.com> a0c46600
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<20230819073816.564@kylheku.com>
@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
In article <20230819073816.564@kylheku.com>,
Kaz Kylheku  <864-117-4973@kylheku.com> wrote:

>It seems to me you might be doing this:
>
>1. if the evaluation of the function runs into a free variable,
>   an "exception" occurs.
>
>2. The exception is "handled" by searching for the variable in
>   the calling function`s environment.
>
>That amounts to dynamic scope, not lexical scope.
>
>  (let ((a 3))
>    (define fun ()
>      a))
>
>  (let ((a 4))
>    (fun))  -> 4
>
>Here, fun has not actually captured any environment.  When (fun) is
>invoked, a is not found. This triggers an "exception" which is handled
>by finding the (a 4) binding in the environment that is valid at the
>time of the call.
>
I tested it, and my implementation fails the dynamic scope test.
But what is supposed to happen if `a is global (pervasive environment)
here?

(define a 12)
(define fun () a)
(define a 13)
(fun)

If the answer should be 12 , it seems to me that to accommodate this a
possibly infinite number of snapshots of the global environment should
exist.
Maybe I have a too much algol mindset. A recursive `i in a Fibonacci recursion
refer to different instances, mentally labeled as fib<12>.fib<11>...fib<1>.i.

I have README`s in different directories. I don`t identify those, but I could.
There is a list of filenames, and as soon as I change directory the i-node of
the README  in this directory is filled in in the list.
Is this the way the name `a is handled?

>Mastodon: @Kazinator@mstdn.ca

Groetjes Albert
-- 
Don`t praise the day before the evening. One swallow doesn`t make spring.
You must not say "hey" before you have crossed the bridge. Don`t sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning.            - the Wise from Antrim -
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: KPN B.V. (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх