Nп/п : 40 из 93
 От   : none) (albert                       2:5075/128        22 авг 23 10:08:32
 К    : none) (albert                                         22 авг 23 11:10:02
 Тема : Re: MAL : closures and recursion
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
0200ea67
@REPLY:
7eb40bb2
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:

@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
In article ,
none) (albert  wrote:
>https://github.com/kanaka/mal/
>
>I`m trying to Make Another Lisp using ciforth lina/wina/xina.
>
>I run in a bit of trouble in the interaction between closures and recursion.
>
>( ( (fn* (a) (fn* (fn* (b) (+ a b))) 5) 7)   ... I
>In lisp we have
>(fn* (fn* (b) (+ a b))) 5)
>
>(def! sumdown (fn* (N) (if (> N 0) (+ N (sumdown  (- N 1))) 0)))  ...I

The above now passes the test of MAL.
This is what I do.
Assuming MAL is intended to be lexical, first look up symbols
in the parameter mapping,
then in the environment stored in the
closure, then in the environment where the call is made.
All environments can recursively refer to outer environments,
not the parameter mapping.

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    
                                                                                
В этой области больше нет сообщений.

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