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...
-
This question consists of 13 items pertaining to possible deficiencies in an accountants review report. Select the best answer for each item. Indicate your answers in the space provided. Jordan &...
-
Describe the operating characteristics of a single-server queue with random arrivals at an average rate of 100 an hour and random service times at an average rate of 120 an hour.
-
Some businesses (for example, supermarket chains) operate on a low operating profit margin. Does this mean that the return on capital employed from the business will also be low?
-
During your audit of Wilcoxon Sports, Inc., a retail chain of stores, you learn that a programmer made an unauthorized change to the sales application program even though no work on that application...
-
The following Stockholders' Equity section of the balance sheet prepared as of the end of the current year contains errors. Stockholders Equity Paid-in capital: Preferred 2% stock, $80 par (125,000...
-
A refinery blends four petroleum components into three grades of gasolineregular, premium, and diesel. The maximum quantities available of each component and the cost per barrel are as follows: To...
-
Read this article about international law and how it is being reshaped. What are some of the challenges that international law will face in the years to come? Access the article through this link:...
-
A hydraulic system exerts a pressure of 50 psi on a cylinder. If the desired output force is 250 lbs, what diameter is required for the cylinder? (Round your answer to the nearest 1/8.)
-
What are the implications of transformational leadership on employee motivation, organizational culture, and performance outcomes ?
-
What are the implications of unresolved conflict within teams for organizational outcomes, and what advanced conflict resolution techniques can be employed to restore harmony and productivity ?
-
Why is this post relevant to your understanding of marketing concepts this week? "It's all about experience, trust, and convenience. Give them items to touch, feel, and explore. Simple return...
-
Calculate EPS if a company, with 1 million shares with a market price of $4 each and zero debt, decides to buy back 25% of its outstanding shares by borrowing at 10% p.a. Assume current earnings are...
-
eBook H Problem Walk-Through Projected Spontaneous Liabilities Smiley Corporation's current sales and partial balance sheet are shown below. Sales Balance Sheet: Liabilities Accounts payable Notes...
-
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...
-
What is the purpose of the Eighth Directive of the European Union? What do you think some of these challenges hindering its total implementation might be?
-
The U.S. system leans toward a heavy education requirement mixed with practice, and the British system leans more toward a heavy experience requirement bordering on apprenticeship. Which system is...
-
If you were a certified accountant in your home country and wanted to practice as an auditor in another country, you would most likely not be allowed to practice. Why do these barriers to entry...
Study smarter with the SolutionInn App