Question: Functional Programming 2. Functional Programming [Total: 25 marks] 2(a) Consider the following expression in the C language. All variables have the float data type Rewrite
Functional Programming
![Functional Programming 2. Functional Programming [Total: 25 marks] 2(a) Consider the following](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3c63a496c4_02566f3c639cd518.jpg)
2. Functional Programming [Total: 25 marks] 2(a) Consider the following expression in the C language. All variables have the float data type Rewrite this expression as a list-based expression in the Scheme language. 17 marks] 2(b) [10 marks] You are given the following function in the C language: int Fun (int a, int b) ( int result o; for (int k-ai k bi k+) result = result + k*k; return result; Rewrite the above C function as a recursive function in the Scheme language. 2(c) [8 marks] Explain two differences between a function in a procedural language (e.g., C) and a function in a functional language (e.g., Scheme) 2. Functional Programming [Total: 25 marks] 2(a) Consider the following expression in the C language. All variables have the float data type Rewrite this expression as a list-based expression in the Scheme language. 17 marks] 2(b) [10 marks] You are given the following function in the C language: int Fun (int a, int b) ( int result o; for (int k-ai k bi k+) result = result + k*k; return result; Rewrite the above C function as a recursive function in the Scheme language. 2(c) [8 marks] Explain two differences between a function in a procedural language (e.g., C) and a function in a functional language (e.g., Scheme)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
