Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the types of the following expressions (OCaml). Assume that addition (+) operates on integers(int)). map(x.1 +x) [1; 2; 3] [(x.x+ 1); (x.x+ 2)] map(f.f1)

Write the types of the following expressions (OCaml). Assume that addition (+) operates on integers(int)).

map(x.1 +x) [1; 2; 3]

[(x.x+ 1); (x.x+ 2)]

map(f.f1) [(x.x+ 1); (x.x+ 2)]

map(f.y.f(y+ 1)) [(x.x+ 1); (x.x+ 2)]

fold-left(x y.ifythen1 +xelsex) 0 [true;false;true]

(f x.f x) (x.x+ 1) 2

fold-right(f x.f x) 0 [(x.x+ 1); (x.x+ 2)]

(f g.x.f(g x)) (x.x+ 2) (x.x)

fold-right(f g.x.f(g x)) (x.x) [(x.x+ 1); (x.x+ 2)]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions