Question

Create a Scheme function for the following:

2. combine which has 3 arguments that are all lists. The result should be equivalent to the concatenation of the first list,

Thank you!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As HOMEWORKLIB expert answering guidelines, Experts are supposed to answer only a certain number of questions/sub-parts in a post. Please raise the remaining as a new question as HOMEWORKLIB guidelines.
******************************************************************************************

(define (combine x y z)
(append x (reverse y) z))
(display (combine '(1 2) '(3 4 5) '(6 7)))

Add a comment
Know the answer?
Add Answer to:
Create a Scheme function for the following: Thank you! 2. combine which has 3 arguments that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • how would i create the function apply in scheme? A my-apply function that does the same...

    how would i create the function apply in scheme? A my-apply function that does the same thing as it Higher-order Functions A function is called a higher-order function (also called a functional form) if it takes a function as an argument or returns a newly constructed function as a result Scheme has several built-in higher-order functions, for example apply takes a function and a list and applies the function with the elements of the list as arguments input (apply (3...

  • In Scheme language Create a second function "vecfn" that allows one to pass the function to...

    In Scheme language Create a second function "vecfn" that allows one to pass the function to perform on the input lists as the first argument. Below are the test cases that should work when you type them in. (display (vecfn - '(1 2 3) '(4 5 6))) (newline) (display (vecfn + '(4) (list (sqrt -1)))) (newline) (display (vecfn / '(1 2 3) '(1 4 5))) (newline) Finally, add a "vecfun" to the syntax of Scheme. Submit a single text file.

  • ANSWER USING PYTHON Write a recursive function that takes 2 sorted lists as arguments and returns...

    ANSWER USING PYTHON Write a recursive function that takes 2 sorted lists as arguments and returns a single, merged sorted list as a result. For example, if the two input lists are [0, 2, 4, 6, 8] and [1, 3, 5, 7, 9], the returned result should be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]. Remember that you can add lists in Python using the + operator ([0] + [1,2,3] = [0,1,2,3]) and can take slices of...

  • plz in Scheme b. [2 marks] Create a function (alternate listi list2) that creates a list...

    plz in Scheme b. [2 marks] Create a function (alternate listi list2) that creates a list by alternating elements from the two given input lists. E.g.: (alternate '(0 000) '(1 1 1 1 1 1)) + (010101 c. [2 marks] Create a procedure (count x L) that returns the number of instances of the value x in the list L. E.g.: (count 3 '(1 4 3 6 2 3 3 1 4 3 5 7)) + 4 (count 'b'(4 b...

  • IN PYTHON: Write a function that takes, as arguments, two lists, one of which is a...

    IN PYTHON: Write a function that takes, as arguments, two lists, one of which is a character list and the other is the corresponding frequencies, and sorts the characters in ascending order of frequencies. The function should return a list consististing of two lists: the first list is the list of characters and the second is the list of corresponding frequencies, consistent with the rearranged characters. Name this function sortCharacters(characterList, frequencyList). For example, >>>sortCharacters(["a", "b", "c", "d"], [5, 8, 3,...

  • c++ programming please. thx. Define a function template named "merge" to merge two lists of items...

    c++ programming please. thx. Define a function template named "merge" to merge two lists of items into one list including all the items of the first list followed by the items of the second list. Even though, the data type of the items of the lists is a generic type, both input lists include items of the same type. To merge the two lists, the function first dynamically allocates enough memory to accommodate the items of both lists. The allocated...

  • 1. What is the result of calling the append method on a list? 2. What must...

    1. What is the result of calling the append method on a list? 2. What must be defined prior to using a method like append? 3. Explain why two lines caused an IndexError. 4. What is the result of calling the remove method on a list? 5. Give one example of a list method that requires an argument and one that does not. 6. Describe the syntax similarities and differences between using a list method like append and Python built-in...

  • I need help with this problem this is what I put and these are the errors...

    I need help with this problem this is what I put and these are the errors I got Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of listi followed by the last element of list2, followed by the second to last element of listi, followed by the second to last element of list2, and so on (in other words the new list should consist of alternating elements...

  • ***PYTHON 3*** We are going to practice building some simple lists. Create a function called create_list....

    ***PYTHON 3*** We are going to practice building some simple lists. Create a function called create_list. It takes 2 parameters, start and end both are integers. This function should return a list that contains all the numbers from start, to end inclusive. So you'll need a loop to count and just append that number into your list and return it. (5 pts ) lst = create_list(5, 10) lst would be [5, 6, 7, 8, 9, 10] It should be able...

  • USING SCHEME PROGRAMMING LANGUAGE define a function addSubList that processes a list of lists of numbers...

    USING SCHEME PROGRAMMING LANGUAGE define a function addSubList that processes a list of lists of numbers and adds up all sub-lists. The output of your function is a flat list of numbers. (You can assume that your function only receives valid input). Example: (define Q '(1 2 (3 4) 1 5 (7 8))) ;;;;;;;;;;;;;;;;;;;;; ; (addSubList Q) ; => '(1 2 7 1 5 15) ;;;;;;;;;;;;;;;;;;;

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT