Question

Please explain what this code is doing step by step and how to get the answer...

Please explain what this code is doing step by step and how to get the answer of a= 6 , b = 11

const inc = x => x+1;
const dub = x => x+x;

const U =2;
const V =5;
const LR = (x,f) => f(x);
const RL = (f,x) => f(x);
const a = RL(dub, LR(U, inc));
const b = LR(RL(dub,V), inc);

a = 6

b= 11

Homework Answers

Answer #1

Each step is numbered and commented for better understanding.

1. const inc = x => x+1; //inc is a function that inputs x and outputs x+1
2. const dub = x => x+x;. //dub is a function which inputs x and outputs the double value of x

3. const U =2; . // A const variable U with value assigned 2
4. const V =5; . //A constant variable V with value assigned 5
5. const LR = (x,f) => f(x); . //Function with X and a function as inputs and outputs the function with input as x
6. const RL = (f,x) => f(x);. //Function which will output according to the input X and the input function
7. const a = RL(dub, LR(U, inc)); //the step by step procedure can be implemented for this step as, RL(dub,LR(2,inc)) which results in RL(dub,3) which returns a=6.
8. const b = LR(RL(dub,V), inc); // likewise above, LR(10,inc) will yield b=11

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1. Let u(x) and v(x) be functions such that u(1)=2,u′(1)=3,v(1)=6,v′(1)=−1 If f(x)=u(x)v(x), what is f′(1). Explain...
1. Let u(x) and v(x) be functions such that u(1)=2,u′(1)=3,v(1)=6,v′(1)=−1 If f(x)=u(x)v(x), what is f′(1). Explain how you arrive at your answer. 2. If f(x) is a function such that f(5)=9 and f′(5)=−4, what is the equation of the tangent line to the graph of y=f(x) at the point x=5? Explain how you arrive at your answer. 3. Find the equation of the tangent line to the function g(x)=xx−2 at the point (3,3). Explain how you arrive at your answer....
Show all the step and don't be lazy. You will get thumbs down. Otherwise...Thumb down Please...
Show all the step and don't be lazy. You will get thumbs down. Otherwise...Thumb down Please clear writing and explain step by step this should be a simple question Consider the function f : [0,1]→R defined by (f(x) =0 if x = 0) and (f(x)=1 if 0 < x≤1) (i)Compute L(f) andU(f). (ii) Is f Riemann integrable on [0,1]?
I have the correct answer but I want to know how to solve it step by...
I have the correct answer but I want to know how to solve it step by step, please help. Thanks ID X Y A 2 6 B 5 4 C 8 5 D 6 2 E 9 4 1) What is the obtained F-ratio? (correct answer: 0.474) 2) What can you conclude with ANOVA? (correct answer: Fail to reject the null, p> 0.01; Type II error is possible) 3) What is the standard deviation of Y for the sample? (correct...
Can anyone please explain how to find the range of the below? Not just the answer...
Can anyone please explain how to find the range of the below? Not just the answer as that is already posted online but I do not understand how to even get started???? (h) Let A = {1, 2, 3}. f: A × A → Z×Z, where f(x,y) = (y, x).
Please clear writing and explain step by step this should be a simple question Explain your...
Please clear writing and explain step by step this should be a simple question Explain your knowledge and use proper math notation and explain Consider the function f : [0,1]→R defined by (f(x) =0 if x = 0) and (f(x)=1 if 0 < x≤1) (i)Compute L(f) andU(f). (ii) Is f Riemann integrable on [0,1]?
step by step process on how to get the 1st and 2nd derivatives of f(x)= (2x)...
step by step process on how to get the 1st and 2nd derivatives of f(x)= (2x) / (4-x^2)
Please answer each step to get to the final answer without using excel. Thank you! Suppose...
Please answer each step to get to the final answer without using excel. Thank you! Suppose that an investor with a 10-year investment horizon is considering purchasing a 20-year 8% coupon bond selling for $900. The par value of the bond is $1000. The original YTM on the bond is 10%, but the investor expects that he can reinvest the coupon payments at an annual interest rate of 7% and that at the end of the investment horizon this 10-year...
Find the inverse of each element of U(10). U(10)={1,3,7,9} Please explain step by step how to...
Find the inverse of each element of U(10). U(10)={1,3,7,9} Please explain step by step how to obtain the inverse of each element in U(10).
**PLEASE ANSWER ALL SUB-QUESTIONS AND EXPLAIN STEP BY STEP. PLEASE INCLUDE FORMULAE IN CORRECT FORMAT NOT...
**PLEASE ANSWER ALL SUB-QUESTIONS AND EXPLAIN STEP BY STEP. PLEASE INCLUDE FORMULAE IN CORRECT FORMAT NOT COMPUTED VERSIONS, PLEASE INCLUDE NOMENCLATURE FOR ALL FORMULAE USED.THANK YOU!*** Discuss the following in detail: (1) During equimolar counterdiffusion in liquids are the diffusivity coefficients equal? (2) Explain your answer above in (1)
please explain the answer step by step $10,000 is invested with two schemes for 6 years:...
please explain the answer step by step $10,000 is invested with two schemes for 6 years: 1. into a saving account of nominal annual interest rate of 12% compounded monthly. 2. you use this 10,000 to purchase a 6 payment level annuity due at rate 10% and invest this payment into a saving account right after receiving them which pay annual effective interest of 6%. which schema is more profitable ?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT