ALGORITHMIC INFORMATION THEORY - CHAPTER 3 potx

23 109 0
ALGORITHMIC INFORMATION THEORY - CHAPTER 3 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... /=f "- -( V+-se) /=f", ,(V+-se) /=f"= =(V+-se)(V+ se) /=f"* *(V+-se)(V+ se) /=f"/ /(V+-se)(V+ se)(V+ -se) (V+ f,(N+-f-se)) display new environment ] (V+se)) evaluate function f ] V: (&(se)(/(.s)(/(.e)s(/(=s(+e))(+(-e))(Vs (-( -e)))))( ('(&(f)(/(=f')(+(-s))(/(=f.)(.(V(+(-s))e))(/(=f+)( +(V(+(-s))e))(/(=f-) (-( V(+(-s))e))(/(=f,)(,(V(+(-s ))e))(/(=f=)(=(V(+(-s))e)(V(+ (-( -s)))e))(/(=f*)(*( V(+(-s))e)(V(+ (-( -s)))e))(/(=f/)(/(V(+(-s))e)(V(+(... additional S-expressions before this value 3. 3 Examples Here are ve elementary examples of expressions and their values The M-expression *a*b*c() denotes the S-expression (*a(*b(*c()))) whose value is the S-expression (abc) The M-expression + -' (abcde) denotes the S-expression (+ (-( - (-( '(abcde)))))) whose value is the S-expression d The M-expression *"+*"=* "-( ) denotes the S-expression (*+(*=( *-( )))) 90 CHAPTER. .. V(+(-s))e)(V(+ (-( -s)))e))(/(=f/)(/(V(+(-s))e)(V(+( -( -s)))e)(V(+ (-( -( -s))))e))(V(+ (-( -f)))(,(N(+(-f)) (-s)e)))))))))))))(V(+s)e)))) (Nxae) = new environment created from list of variables x, list of unevaluated arguments a, and previous environment e ] & (Nxae) /.xe *+x*(V+ae)(N-x-ae) N: (&(xae)(/(.x)e(*(+x)(*(V(+a)e)(N(-x)(-a)e))))) CHAPTER 3 A VERSION OF PURE LISP 94 Test function (Fx) = first atom in the S-expression x... e))(/(=(+s)('(CDR)))(('(&(x)(/(.x)('(NIL))x))) (-( V (+(-s))e)))(/(=(+s)('(OUT)))(,(V(+(-s))e))(/(=(+s) ('(EQ)))(/(=(V(+(-s))e)(V(+ (-( -s)))e))('(T))('(NIL )))(/(=(+s)('(CONS)))(('(&(x)(('(&(y)(/(=y('(NIL)) )(*x())(*xy))))(V(+ (-( -s)))e))))(V(+(-s))e))(/(=(+ s)('(COND)))(/(=('(NIL))(V(+(+(-s)))e))(V(*(+s) (-( -s)))e)(V(+ (-( +(-s))))e))(('(&(f)(V(+ (-( -f)))(,(N( +(-f))(-s)e)))))(/(.(+(+s)))(V(+s)e)(+s))))))))))) )) (Nxae) = new environment... function definition ] : (Bxa) /.xe *+x*+a(B-x-a) B is "Bind" ] (V+ f,(B+-fa)d) display new environment ] V: (&(sed)(/(.s)(('(&(A)(Ae)))('(&(e)(/(.e)s(/(=s(+e) )(+(-e))(A (-( -e))))))))(('(&(f)(/(=$f)f(/(=f')(+(s))(/(=f/)(('(&(p)(/(=$p)p(/(=0p)(V(+ (-( -( -s))))ed )(V(+ (-( -s)))ed)))))(V(+(-s))ed))(('(&(W)(('(&(a)( /(=$a)a(('(&(x)(('(&(y)(/(=f.)(.x)(/(=f+)(+x)(/(=f -) (-x)(/(=f,)(,x)(/(=f=)(=xy)(/(=f*)(*xy)(/(.d)$((... (Vy()x)))))('(&(ij)(/(.i)1(/(.j)0(L(-i)(-j)))))))( ('(&(B)(V(+ (-( -f)))(,(B(+(-f))a))d)))('(&(xa)(/(.x )e(*(+x)(*(+a)(B(-x)(-a))))))))))))(-d)))))))))))( +(-a)))))(+a)))))(W(-s)))))('(&(l)(/(.l)l(('(&(x)( /(=$x)x(('(&(y)(/(=$y)y(*xy))))(W(-l))))))(V(+l)ed )))))))))))(V(+s)ed)))) 100 CHAPTER 3 A VERSION OF PURE LISP Test function (Cxy) = concatenate list x and list y ] Define environment for concatenation ] & E '( C &(xy) /.xy *+x(C-xy)... : x (V+-se) : y (V+ se) /=y'(NIL) *x() *xy /=+s'(COND) /='(NIL)(V++-se) (V*+s se) (V +-+ -se) : f /.++s(V+se)+s f is ((LAMBDA)((X)(Y))(BODY)) ] (V+ f,(N+-f-se)) display new environment ] V: (&(se)(/(.(+s))(/(=s(+e))(+(-e))(Vs (-( -e))))(/(=(+ s)('(QUOTE)))(+(-s))(/(=(+s)('(ATOM)))(/(.(+(V(+(s))e)))('(T))('(NIL)))(/(=(+s)('(CAR)))(+(V(+(-s)) e))(/(=(+s)('(CDR)))(('(&(x)(/(.x)('(NIL))x))) (-( V (+(-s))e)))(/(=(+s)('(OUT)))(,(V(+(-s))e))(/(=(+s)... concludes Chapter 3 What lies ahead in Chapter 4? In the next chapter we re-write the LISP program of Section 3. 6 as a register machine program, and then compile it into an exponential diophantine equation The one-page LISP function de nition in Section 3. 6 becomes a 30 8-instruction register machine LISP interpreter, and then a 30 8 + 19 + 448 + 16281 = 17056-variable equation with a left-hand side... seconds 3. 5 LISP in LISP II LISP Interpreter Run Normal LISP semantics defined in "Sub-Atomic" LISP ]]] (Vse) = value of S-expression s in environment e If a new environment is created it is displayed ] & (Vse) /.+s /=s+e+-e (Vs e) /=+s'(QUOTE) +-s 3. 5 LISP IN LISP II 95 /=+s'(ATOM) /.+(V+-se)'(T)'(NIL) /=+s'(CAR) +(V+-se) /=+s'(CDR) : x -( V+-se) /.x'(NIL)x /=+s'(OUT) ,(V+-se) /=+s'(EQ) /=(V+-se)(V+... an S-expression has 8 bits per character with the characters in reverse order (see Figures 2.4 and 3. 1) 3 3.4 LISP IN LISP I 93 3.4 LISP in LISP I LISP Interpreter Run LISP semantics defined in LISP ]]] (Vse) = value of S-expression s in environment e If a new environment is created it is displayed ] & (Vse) /.s /.es /=s+e+-e (Vs e) ('&(f) f is the function ] /=f"' +-s /=f" .(V+-se) /=f"+ +(V+-se) .

Ngày đăng: 13/08/2014, 02:20

Tài liệu cùng người dùng

Tài liệu liên quan