Friday, 15 May 2015

lambda calculus - Access outer variable inside a block and Y-combinator -


I hope all of you will be okay I will set fixed-point Y-connector in the harbor I'm implementing and I'm having some trouble with it. Well, the Y-connector can be defined as lambda-calculus :

Y = (λh.λF.F (λ x. (( H (h))) (f)) (x)) (λh.λF.F (λ x. ((H) (f)) (x)))

< P> I am trying to implement the memoanization with the Wi-connetator by display queries. I am currently implementing:

  Function Wiemam (BF, unchecked) Local xAnswer if! LCache; LCache: = {}; Andif return {| Arg | IIF (ACHES [ARG]; / * then * / ACHCH]; / * Otherwise * / ACHACH [ARG]: =; EWAL (EWAL (BWF, {NN. EWAL (EWAL (YMM, BF, ACHT) Actually, I can not use the statement in the blocks, but I can use the expression and it works just fine. . I am avoiding an infinite recurrence and the range is going from 0 to infinity.  

By this time, it's just compiled properly, but when I'm trying to use a variable of an external block, harbor kicks me in the face!

To check the implementation of the Wi-Connectator, I try to apply a general inequality of the Fibonacci sequence, but when I return a block that receives a parameter G And returns a block which returns a parameter N , live BKM is unavailable for me and the compiler says that "external codeblock variable is out of reach" .

main functional bFib: = YMem ({| G | | | | | N | | IIF (n == 0, 1, IIF (n = 1 1, 1, Eval (g) N-1) + EVAL (G, N - 2)));}}})

This will also allow me to make blocks. My question is how can an external variable be used inside a block in the harbor

In Harbor, Clipper and XBase-based programming languages ​​can refer to variables of the block, never blocks. Blocks are not closed We can make those local stones and use them in internal blocks:

  Function TestOper Scope Local AAAA Local Bad: = {| A. ACCA: = A, {| B ACCA + B}} Eval (bAdd, 10), 20)  

No comments:

Post a Comment