Write a function called filter-seq that takes a sequence s (a string) and an alphabet a (a
Fantastic news! We've Found the answer you've been seeking!
Question:
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 alphabet a. The unit test below includes test cases that your solution for this exercise must pass.
test:
#+beginsrc lisp (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"))) #+endsrc lisp
Expert Answer:
Answer rating: 100% (QA)
filter in python The filter method filters the given sequence with the ... View the full answer
Posted Date:
Students also viewed these programming questions
-
Write a function called hms_to_secs() that takes three int values for hours, minutes, and secondsas arguments, and returns the equivalent time in seconds (type long). Function prototypes is given...
-
Write a function called ParseSentence that takes as an input parameter a null-terminated string S. Where S would contain an English sentence. Assume that the delimiters are space, comma, semicolon...
-
Write a function called reverseSecondHalf that takes a sound as input, then reverses just the second half of the sound and returns the result. For example, if the sound said MarkBark, the returned...
-
A company has the following data: net sales, $405,000; cost of goods sold, $220,000; selling expenses, $90,000; general and administrative expenses, $60,000; interest expense, $4,000; and interest...
-
What is overapplied overhead? When Cost of Goods Sold is adjusted for overapplied overhead, will the cost increase or decrease? Why?
-
Madison Manufacturing is considering a new machine that costs $250,000 and would reduce pre-tax manufacturing costs by $90,000 annually. Madison would use the 3-year MACRS method to depreciate the...
-
The CEO of IAP is concerned with the quality of its products and the amount of resources currently spent on customer returns. The CEO would like to analyze the costs incurred in conjunction with the...
-
An industrial oven used to cure sand cores for a factory manufacturing engine blocks for small cars is able to maintain fairly constant temperatures. The temperature range of the oven follows a...
-
The story is rich dad poor dad chapter 3 1) What is rule #1? 2) What is an asset? Give 3 examples. 3) What is the difference between an asset and a liability? 4) According to "Rich Dad", when can a...
-
Randy Smith was very proud of his new position as inventory control manager for theJohnson Trinket Company. His primary responsibility had been fairly clearly defined: Maintain an inventory level in...
-
A particle with a mass of 2.9 10-20 kg is oscillating with simple harmonic motion with a period of 3.5 10-5 s and a maximum speed of 1.4 x 10 m/s. Calculate (a) the angular frequency and (b) the...
-
How does the Treasury use the money market to meet its financing needs? That is, does it issue Treasury bills to meet longer-term financing needs or seasonal variations in its cash flow?
-
In any given year, the corporate sector retires more shares (in value terms) than it issues in new stock. Still, the value of the stock market increases over time. What can account for this increase...
-
How does monetary policy affect bond yields? How might forward guidance result in a more predictable impact on bond rates? What kinds of spending might be affected by such changes in bond rates?
-
Using the FRED database, plot the yield on an investmentgrade corporate bond. Next plot the yield on a junk bond. Do they move together? Next plot the risk premium on the junk bond. Can you identify...
-
When shortterm interest rates are very low, what is the slope of the yield curve? When shortterm rates are high? Why do these patterns exist?
-
On 1 January 2023 Zafuan Bhd issued 300,000 RM1 6% redeemablepreference shares. The shares were issued at a discount of 5% andthe effective interest rate is 7%. Dividends are paid annually inarrear 2...
-
Nitrogen monoxide reacts with hydrogen as follows: 2NO(g)+ H2(g) N2O(g) + H2O(g) The rate law is [H2]/ t = k[NO]2[H2], where k is 1.10 107 L2/(mol2s) at 826oC. A vessel contains NO and H2 at...
-
Based on Exhibit 1, what is the foreign exchange gain resulting from Transaction 3 on the December 31, 2016 fi nancial statements? A . NVK1.70 per ton B . NVK90.75 per ton C . NVK248.54 per ton
-
Which transaction would generate foreign currency transaction exposure for Ambleu? A . Transaction 1 B . Transaction 2 C . Transaction 3
-
Yus determination regarding Transaction 2 should be based on the currency of the: A . loan. B . bank. C . borrower.
Study smarter with the SolutionInn App