Beta Work

I brought the Haskell book and the fight against the beta.

I understand the concept, but don’t know how to use it when I have a lambda in front of me. For instance:

(λ a b c . c b a) z z (λ w v . w)

How to reduce it?

+4
source share
1 answer

Primarily:

(λ a b c . c b a) z z (λ w v . w)

abbreviated for:

(λ a . (λ b . (λ c . c b a) ) ) z z (λ w . (λ v . w) )

Well, if you apply beta reduction on:

a b c . c b a) z z (λ w v . w)

(bold is added for the "active" variable, so to speak, and italics to replace it)

you are replacing with oparand , so now the result: az

(λ b c . c b z) z (λ w v . w)

So, we replaced awith zin the area of ​​the lambda expression , then we will perform an additional reduction:

b c . c b z) z (λ w v . w)

at

(λ c . c z z) (λ w v . w)

- , :

c . c z z) (λ w v . w)

:

((λ w v . w) z z)

, . - :

w v . w) z z

(λ v . z) z

, , , , - ( - ):

v . z) z

(z)

z

- - , : Haskell - - , - .

+9

Source: https://habr.com/ru/post/1667659/


All Articles