Institute of Computer Science
  1. Courses
  2. 2025/26 fall
  3. Functional Programming (LTAT.03.019)
ET
Log in

Functional Programming 2025/26 fall

  • Üldinfo
    • Õppekorraldus
  • Kursus
    • KKK
    • Installimine
    • Kodutöö 1
    • Kodutöö 2
    • Kodutöö 3
    • Kodutöö 4
    • Kodutöö 5
    • Kodutöö 6
    • Kodutöö 7
    • Suur kodutöö 1
    • Kodutöö 8
    • Kodutöö 9
    • Kodutöö 10
    • Kodutöö 11
    • Kodutöö 12
    • Suur kodutöö 2
    • Kodutöö 13*
  • FP Õpik
  • Moodle
  • Zulip (sisselogides näed linki)

Kodutöö 4

1. {$\lambda$}-termid

Kas tegemist on {$\lambda$}-termiga? Kui jah, kirjuta ümber ühe parameetriga lambdadega ja pane kõik sulud

  1. {$ \lambda{} a\ (b.\ b\ a) \lambda{} z. z$}
  2. {$ f \lambda{} x\ y.\ g\ x\ y\ z$}
  3. {$ f \lambda{} z.\ z\ \lambda{} x\ y.\ g\ x\ y$}
  4. {$ \lambda{}\lambda{}2\ 1$}
  5. {$ \lambda{} a\ b.\ b\ a\ \lambda{} z.\ z$}

2. Muutujate klassifitseerimine

Märgi iga muutuja kohta, kas see on vaba või millise parameetriga see seotud on.

  1. {$ \lambda{}f.\ (\lambda{}g.\ g\ x)\ (\lambda{}x.\ f\ x)$}
  2. {$ (\lambda{}x.\ (\lambda{}g.\ g\ x))\ x$}
  3. {$ \lambda{}g.\ (\lambda{}f.\ f\ x)\ (\lambda{}x.\ g\ x)$}
  4. {$ z\ (\lambda{}h\ x.\ (\lambda{}f.\ h\ f)\ x)$}
  5. {$ \lambda{}h\ x.\ \text{cond}\ h\ (\text{add}\ 1\ x)\ k$}

3. Substitutsioon

Leia substitutsiooni tulemus!

  1. (λf. f y(λx.x))[y→λx y. f x]
  2. (λx. f (x x))(λx. f (x x))[f→λx y. y]
  3. (λx g y.x g y)[g→x g y]
  4. ((λx y. y) y)[y→λx. y]

4. Reduktsioon

Redutseeri väärtuseks (s.t. nii palju kui saab) a) normaaljärjekorras ja b) aplikatiivjärjekorras.

  1. (λx. add x) (add 1 2) (mul 2 2)
  2. (λf. f f) ((λx. b) (λx. x))
  3. (λf. (λg. f) f) ((λx. b) (λx. x))
  4. ((λy. (λx. y)) 1 ((λx. x x) (λx. x x)))
  5. ((λx. x)(λx. (λy. x w) r) (λx. y))
  6. (λx. cond (iszero x) (add x) (mul x)) 1 (add 1 2)
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment