Question

Problem 4 Scheme. What do the following functions do? (define (blue p l) (= (length l)...

Problem 4 Scheme.
What do the following functions do?
(define (blue p l) (= (length l) (length (filter p l)))) (define (renmap f x ys) (map (lambda (y) (f x y)) ys))
(define (binmap f xs ys) (map (lambda (x) (renmap f x ys)) xs))

Homework Answers

Answer #1

Answer-

  • Basically, Filter returns the elements e for the l where p e is the #t.
  • Pink returns #t if p returns #t for some element in l. Other than, #f.
  • Blue returns #t if p returns #t for all elements in l. Other than, #f.
  • Say ys = {y1, y2, . . . , yn}, renmap returns a list of {z1, z2, . . . , zn} where zi = f x yi.
  • Similarly, Say xs = {x1, x2, . . . , xn} and ys = {y1, y2, . . . , yn}, binmap returns a list of {z1, z2, . . . , zn} where -    zi = { (f xi y1),(f xi y2), . . . ,(f xi yn) }

Note- Please do upvote, if any problem then comment in box sure I will help.

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
This is a programming question of Ocaml language (* 5. Consider the following higher-order function reduce...
This is a programming question of Ocaml language (* 5. Consider the following higher-order function reduce *) let rec reduce (f:'a -> 'b -> 'b) (u:'b) (xs:'a list) : 'b = match xs with | [] -> u | hd::tl -> f hd (reduce f u tl);; (* Consider the following functions defined using reduce *) let sum xs = reduce (fun x y -> x+y) 0 xs let prod xs = reduce (fun x y -> x*y) 1 xs...
in the scheme programming language implement a game of rock paper scissors between a user and...
in the scheme programming language implement a game of rock paper scissors between a user and the computer. Only the following scheme subsets should be used: Special symbols (not case sensitive in our version (R5RS), but is in R6RS): a. Boolean: #t (else) and #f b. Characters: #\a, #\b ... #\Z c. Strings: in double quotes 3. Basic functions: a. quote b. car c. cdr d. c _ _ _ _ r, where each _ is either “a” or “d”...
A rod (length L, total charge +Q) with charge density lambda = a(y+b), where a and...
A rod (length L, total charge +Q) with charge density lambda = a(y+b), where a and b are constants, is positioned along the y-axis such that the upper end is at the origin. (a) Determine the electric field (magnitude and direction) at point P, on the y-axis, distance b from the upper end of the rod (b) Set up, but do not integrate, an integral that would allow you to determine the electric potential at point P. (c) Extra credit:...
Differentiate the following functions. Do not simplify k(x) = ln(cot(x)) L `(x) = 4 csc-1(x2) m(x)...
Differentiate the following functions. Do not simplify k(x) = ln(cot(x)) L `(x) = 4 csc-1(x2) m(x) = sin(x) / cosh(x) n(x) = 2 tanh-1(x4 + 1)
Answer the following brief question: (1) Given a set X the power set P(X) is ......
Answer the following brief question: (1) Given a set X the power set P(X) is ... (2) Let X, Y be two infinite sets. Suppose there exists an injective map f : X → Y but no surjective map X → Y . What can one say about the cardinalities card(X) and card(Y ) ? (3) How many subsets of cardinality 7 are there in a set of cardinality 10 ? (4) How many functions are there from X =...
4) For each of the following functions, establish on which subset of its domain it is...
4) For each of the following functions, establish on which subset of its domain it is C1. (You do not need to provide formal proofs in your answers: an explanation or brief graphical argument is sufficient.) Compute partial derivatives for these subsets. (a) f(x) = ⌈x⌉ (recall ⌈x⌉ is the lowest integer above or equal to x). (b) f(x, y) = min{x, y}. (c) f(x, y) = xαyβ where α, β ∈ (0,1).
Consider the following five utility functions. G(x,y) = x2 + 3 y2 H(x,y) =ln(x) + ln(2y)...
Consider the following five utility functions. G(x,y) = x2 + 3 y2 H(x,y) =ln(x) + ln(2y) L(x,y) = x1/2 + y1/2 U(x,y) =x y W(x,y) = (4x+2y)2 Z(x,y) = min(3x ,y) In the case of which function or functions can the Method of Lagrange be used to find the complete solution to the consumer's utility maximization problem? a. H b. U c. G d. Z e. L f. W g. None.
Differentiate the following functions with respect to x using any applicable rules of differentiation. (a) P(x)...
Differentiate the following functions with respect to x using any applicable rules of differentiation. (a) P(x) = 300x − 50000 (b) Γ(x) = ryz ∗ tey                   _______                    logva (c) h(x) = 5x2 + x½              ___________                      x (d) y = Cekt (e) j(x) = xex (f) p(x) = (2x2 + x) 3
1. Create a script named AnonIntegrals.m. Within it, define each of the following functions as anonymous...
1. Create a script named AnonIntegrals.m. Within it, define each of the following functions as anonymous functions and use the integral command to compute its definite integral over the domain given. Display the integral calculation to the command window. (a) p(x) = 4x 2 − 1, x ∈ [0, 1] (b) q(x) = sin(x), x ∈ [0, π] (c) r(x) = cos(x), x ∈ [−π/2, π/2] (d) s(x) = log(x), x ∈ [0, 1] (e) t(x) = 1 x ,...
Python questions 1) Mark true or false according to the following functions below. a) f(x) =...
Python questions 1) Mark true or false according to the following functions below. a) f(x) = a1 + a2x + a3x^2 is linear in x b) f(x) = a1 + a2x + a3x^2 is linear in the ai for i = 1, 2, 3 c)  f(x, y) = x log(y) is linear in x d)  f(x, y) = x log(y) is linear in y 2) What order does the interpolating polynomial through 6 points have? 3) For this problem, you have measured...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT