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...
-
Assume that you are a trust officer for Wall Street Bank. You are attempting to select a pharmaceutical manufacturers stock for a clients portfolio. You have secured the following data: Required:...
-
The 3-Mg rear-wheel-drive skid loader has a center of mass at G. Determine the largest number of crates that can be pushed by the loader if each crate has a mass of 500 kg. The coefficient of static...
-
If Exercise 8.3 had asked about a book in free fall rather than one on the floor, what would the free-body diagram look like? Data from Exercise 8.3 Draw a free-body diagram for a book lying...
-
Sales of quilt covers at Bud Banis's department store in Carbondale over the past year are shown below. Management prepared a forecast using a combination of exponential smoothing and its collective...
-
The atomic number of element M, N, R, and T are 1, 8, 12 and 14 respectively. The element which can form ions by either losing or gaining electron(s) is M 11. A. B. N C R D. T 12. The atomic number...
-
Record the following petty cash transactions of Lexite Laminated Surfaces in general journal form (explanations are not required): Apr. 1 Established a petty cash fund with a $200 balance. 30 The...
-
Locate a current article about the topic power and write a review of the article providing a brief, but detailed, summary of the situation and how the participants related to each other what could...
-
Explain the type bounds of the following method of the Collections class. Why doesnt T extends Comparable or T extends Comparable suffice? public static
-
What is the big-Oh efficiency of replacing all negative values in an array list of Integer objects with zeroes? Of removing all negative values?
-
A general tree (in which each node can have arbitrarily many children) can be implemented as a binary tree in this way: For each node with n children, use a chain of n binary nodes. Each left...
-
Explain what the following code prints. Draw a picture of the linked list after each step. LinkedList staff = new LinkedList (); staff.addFirst ("Harry"); staff.addFirst("Diana");...
-
Provide expressions that compute the following information about a Stream. a. How many elements start with the letter a? b. How many elements of length greater than ten start with the letter a? c....
-
HOT TOPIC ASSIGNMENT - SPORTS EVENT MARKETING GROUP 2 1. Definition of sports event marketing. Description 2. 1 case in Canada 3. One global advertising industry case 4. Impact on advertisers 5....
-
How much more interest will be earned if $5000 is invested for 6 years at 7% compounded continuously, instead of at 7% compounded quarterly?
-
How do managers refine a costing system?
-
When does product undercosting or overcosting occur?
-
Family Supermarkets (FS) has decided to increase the size of its Memphis store. It wants information about the profitability of individual product lines: soft drinks, fresh produce, and packaged...
Study smarter with the SolutionInn App