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 schemeRacket tnx Please solve as faster as you can. TASK 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 sexpressions, 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.
define foo x y x y
define square xleft x mathrmxright
define bar xfoo x
define zagzag
define bignumber x cond x 'bigelse 'small
define myif cond? val thenexpr elseexprif cond val thenexpr elseexpr
square
eval list bar
apply foo
foo
eval quote bar
apply bar sheet
eval cons 'bar
map square
apply foo
sheet a
myif eqzag
if eqzag
eval 'bar
foo
eval bar
eval cadr bar bar
map square
Claims
square Functions in pure functional programming are always evaluated by first evaluating the function, a her arguments as needed.
square With eager evaluation, the function is always evaluated first, and its arguments as necessary.
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.
Everything in Racket, including functions, macros, and lists, can be represented as an sexpression.
square The expression in line evaluates to
square After evaluating line the identifier square stores the value
square Line defines the pure function square.
L Line is wrong because the list must have elements of one type.
square Line returns the list
square The expression quote a has the same value as line
squaremathrmcdr returns the second element of the list, ie
square mathrmA list is generally an empty list or a structure of two elements whose second element is a list.
a macroexpand returns an expanded version of a macro before it is evaluated.
square The expression base is a call to the function base with zero arguments.
square Lines and have the same value.
square Lines and have the same value.
square Lines and have the same value.
square Lines and have the same value.
square Lines and have the same value.
square Lines and have same value.
square Line contains an error.
Line contains an error.
square The function bignumber in line returns the symbol 'big if x is greater than
square Line will crash.
square Line will crash.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
