Write a lisp program that takes a sequence s (a string) and an alphabet a (a string),
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a lisp program that takes a sequence s (a string) and an alphabet a (a string), and generates a result sequence (a string) by including only the characters of s that occur in the alphabet a. The unit test below includes test cases that your solution must pass.
(deftest test-filter-seq () (check (equal (filter-seq "sdafgacs" "abcf") "afac") (equal (filter-seq "" "abcf") "") (equal (filter-seq "sdafgacs" "") "") (equal (filter-seq "sdafgacs" "abcfs") "safacs")))
Expert Answer:
Answer rating: 100% (QA)
LISP expressions are called symbolic expressions orsexpressions The sexpressions are composed of thr... View the full answer
Posted Date:
Students also viewed these programming questions
-
Write a function called filter-seq that takes a sequence s (a string) and an alphabet a (a string), and generates a result sequence (a string) by including only the characters of s that occur in the...
-
Write a program that (a) generates a vector with 20 random integer elements with integers between -10 and 10, (b) replaces all the negative integers with random integers between -10 and 10, (c)...
-
An oscillator that generates a sinusoidal wave on a string completes 20 vibrations in 50 s. The wave peak is observed to travel a distance of 2.8 m along the string in 50 s. What is the wavelength?
-
As manager of a local pizza parlor, you want to develop a balanced scorecard so you can more effectively monitor the restaurants performance. Required a. Propose at least two goals for each...
-
On December 31, 2009, Idaho Mining, Inc., issued $50 million of 10-year, 6% debentures at par. 1. Compute the proceeds from issuing the debentures . 2. By using the balance sheet equation format,...
-
Two swimmers, Alan and Beth, start together at the same point on the bank of a wide stream that flows with a speed v. Both move at the same speed c(c > v), relative to the water. Alan swims...
-
Create a statement of cash flow for the Arrow Company for the years ended December 31, 2014 and December 31, 2015 from the balance sheets and income statement created in problem P1.32 from Chapter 1....
-
Profitability of order, opportunity cost, and capacity Hudson Hydronics, Inc., is a corporation based in Troy, New York, that sells high-quality hydronic control devices. It manufactures two...
-
You are planning to take a spring break trip to Cancun your senior year. The trip is exactly two years away, but you want to be prepared and have enough money when the time comes. Explain how you...
-
Create a program that will scrape the sayings from: https://quotes.toscrape.com/page/2/ Set up your program to allow the user to input a page number (1-10) which will return the quotes from that...
-
1) What is TCP Splitting? 2) What is the background?
-
An electromagnet of mass \(1500 \mathrm{~kg}\) is at rest while holding an automobile of mass \(900 \mathrm{~kg}\) in a junkyard. The electric current is turned off, and the automobile is dropped....
-
Explain why it is difficult to estimate precisely the partial effect of \(X_{1}\), holding \(X_{2}\) constant, if \(X_{1}\) and \(X_{2}\) are highly correlated.
-
How does \(\bar{R}^{2}\) differ from \(R^{2}\) ? Why is \(\bar{R}^{2}\) useful in a regression model with multiple regressors?
-
Copper is deposited at a cathode from solution with a bulk concentration of \(0.5 \mathrm{M}\) at the rate of \(3.0 \mathrm{~g} / \mathrm{m}^{2} \cdot \mathrm{s}\). Find the surface concentration of...
-
When there is a concentration gradient in the system, show that the potential gradient is composed of two terms, (i) an Ohm's-law contribution and (ii) a diffusional contribution. State the equation...
-
40 randomly selected students were asked how many siblings were in their family. Let X represent the number of pairs of siblings in the student's family. The results are as follows: # of Siblings...
-
A statistical study shows that the fraction of television sets of a certain brand that are still in service after x years is given by f (x) = e-0.15x. (a) What fraction of the sets are still in...
-
The Financial Times reported that Delphi, Inc., a manufacturer of automotive parts, would take a \($100\) million write-down of its inventory to reflect reduced demand for some of its products. The...
-
The following information was disclosed in the 2015 annual report of The Arcadia Company. Fill in the missing values. Beginning inventory. Purchase of inventory.. Inventory available for sale. Ending...
-
It has been argued that to be classified as a professional one must offer services to the public rather than simply be an employee of an organization. As such, most employees of an organization,...
Study smarter with the SolutionInn App