Question: 4. (a) Consider the following function in OCaml. let rec something (x, y) 10-> [] (c) Iy when y > x-> something (y,x) 1
4. (a) Consider the following function in OCaml. let rec something (x, y) 10-> [] (c) Iy when y > x-> something (y,x) 1 x something (x - y, y) What is the type of something? Explain how this type is inferred from the given code. (b) Consider the following method in Java. List other (int x, int y) { } List a = new LinkedList (); while (true) { if (y == 0) { return a; } = match y with } else if (y > x) { int z = x; X = yi y = Z; } else { } a.add (x); X = X y; - Explain, with specific reference to the above code, how something demonstrates that OCaml is a declarative programming language, and how other demonstrates that Java is not. Explain which of OCaml's declarative features make something more succinct than other. Describe a characteristic of all functional 5 of 6 by something. languages that languages that is not demonstrated
Step by Step Solution
There are 3 Steps involved in it
It seems that there are some typographical errors and incomplete parts in the provided OCaml code and the Java snippet Ill try to provide explanations ... View full answer
Get step-by-step solutions from verified subject matter experts
