Question: please solve this. it is functional programming in scheme / Racket . tnx . Please solve as faster as you can. TASK 1 . Questions

please solve this. it is functional programming in scheme/Racket. tnx. Please solve as faster as you can. TASK 1. Questions
Context
Warning - this task is two pages long!
Racket Scheme, as a dialect of Lisp, is characterized by the use of symbolic expressions to represent both structured data and code. This task focuses on understanding and manipulating s-expressions, evaluating expressions in Racket, and using functional constructs such as lists and macros.
Statements that ask about the results of expressions assume that all previous lines that are correct have been executed correctly, and that any lines that are not correct have been skipped.
1.(define (foo \( x y \))(\(+x(*2 y))\)
2.(define (square \( x)\left({}^{*} x \mathrm{x}\right)\))
3.(define (bar x\()\)(foo 1 x\()\))
4.(define (zag)(zag))
5.(define (big-number \( x \))(cond [(x .>.5) 'big][else 'small]))
6.(define (my-if cond? val then-expr else-expr)(if [cond? val] then-expr else-expr))
7.(square -5)
8.(eval (list bar 1))
9.(apply foo 12)
10.(foo 12)
11.(eval (quote (bar 1))
12.(apply bar (sheet 1))
13.(eval (cons 'bar 1))
14.(map square '())
15.(apply foo '(12))
16.(sheet 12'a)
17.(my-if (eq?11)1(zag))
18.(if (eq?11)1(zag))
19.(eval 'bar 1)
20.(foo '(12))
21.(eval '(bar 1))
22.(eval (cadr '((bar 1)(bar 2))))
23.(map square '(123))
Claims
1.\(\square \) Functions in pure functional programming are always evaluated by first evaluating the function, a her arguments as needed.
2.\(\square \) With eager evaluation, the function is always evaluated first, and its arguments as necessary.
3. In programming languages that are not purely functional, functions are evaluated so that the values of the arguments
calculated and assigned to the frame within which the function is evaluated.
4. Everything in Racket, including functions, macros, and lists, can be represented as an s-expression.
5.\(\square \) The expression in line 7 evaluates to 25.
6.\(\square \) After evaluating line 7, the identifier square stores the value 25.
7.\(\square \) Line 2 defines the pure function square.
8. L Line 16 is wrong because the list must have elements of one type.
9.\(\square \) Line 23 returns the list '(149).
10.\(\square \) The expression (quote 12 a ) has the same value as line 16.
11.\(\square(\mathrm{cdr}\)'\((123))\) returns the second element of the list, i.e.2.
12.\(\square \mathrm{A}\) list is generally an empty list or a structure of two elements whose second element is a list.
13. a macroexpand returns an expanded version of a macro before it is evaluated.
14.\(\square \) The expression (base) is a call to the function base with zero arguments.
15.\(\square \) Lines 9 and 15 have the same value.
16.\(\square \) Lines 10 and 9 have the same value.
17.\(\square \) Lines 20 and 15 have the same value.
18.\(\square \) Lines 9 and 20 have the same value.
19.\(\square \) Lines 12 and 21 have the same value.
20.\(\square \) Lines 12,8 and 11 have same value.
21.\(\square \) Line 19 contains an error.
22.- Line 8 contains an error.
23.\(\square \) The function big-number in line 5 returns the symbol 'big if x is greater than 5.
24.\(\square \) Line 17 will crash.
25.\(\square \) Line 18 will crash.|
please solve this. it is functional programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!