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.
(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)
Answer is here LISP expressions are also referred to as symbolic sexpressions The valid objects in s... 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 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 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 ....
-
Runnals National Bank has experienced the following trends over the past five years (all figures in millions of dollars): Input Area: 1 2 3 4 5 Net Income (after tax) 2.65 2.75 3.25 3.65 4.00 Total...
-
Refer to the information for Barnard Company above. The cost of goods sold per unit is Last year, Barnard Company incurred the following costs: Direct materials ............. $ 50,000 Direct labor...
-
If the wooden block exerts a force of F = 600 N on the toggle clamp, determine the force P applied to thehandle. 85 mm 140 mm 140 mm- 50 mm 50 mm 20 mm- 'P
-
Is the coefficient of restitution \(e\) different in two inertial reference frames, which are moving at constant velocity relative to each other? (See Eq. 5.18 if you have forgotten the definition of...
-
In 2010, Jennifer (Jen) Liu and Larry Mestas founded Jen and Larrys Frozen Yogurt Company, which was based on the idea of applying the microbrew or microbatch strategy to the production and sale of...
-
6. For an SHM oscillator, the amplitude is 5 cm and its time period is 4 seconds. The minimum time taken by the particle to pass between points which are at distances 4 cm and 3 cm from the centre of...
-
Clean Duds Laundromat has an industrial water softener that enhances the water quality used in its washing machines. The water softener is approaching the end of its useful life and must be either...
-
Given the following utility function and marginal rate of substitution: A consumer facing the following prices chooses to consume U = 100X0.750.50 MRS = 0.75Y 0.50X P, = $5, P,-$2 20 units of good X...
-
Write a Java program that uses a library database of books and patron data, as described in Exercise R24.2. Patrons should be able to check out and return books. Supply commands to print the books...
-
In the previously cited example (problem 3), suggest the appropriate sampling method in terms of the following: (a) Probability vs. nonprobability (b) Single unit vs. cluster unit (c) Stratified vs....
-
Give a SQL query that computes the total cost of all line items in invoice number 11731. Invoice Invoice_ Number INTEGER 11731 11732 11733 Customer_ Number INTEGER 3175 3176 3175 Payment DECIMAL (10,...
-
Write a program that reads all words from a file and, using a Stream , prints how many of them are the word the.
-
Transparency is a growing factor in health care. You have been hired to consult with a group of orthopedists who have just developed their first website. The practice is located in a medium-sized...
-
What master data records are used in a purchase order? There are three correct answers. A Product B Supplier C Shipping Conditions D Purchasing Info Record E Purchasing Group
-
Selected condensed data taken from a recent statement of financial position of Morino Ltd. are as follows. MORINO LTD. Statement of Financial Position (partial) Other current assets...
-
Why do you and your business need to be able to communicate well?
-
What are the basic criteria for effective messages?
-
What are the questions for analyzing a business communication situation?
Study smarter with the SolutionInn App