Question

Write a LISP function that accepts two lists as it's only arguments. The function should return...

Write a LISP function that accepts two lists as it's only arguments. The function should return a new list with the arguments as it's elements.

So, if you pass the function (a b c) and (1 2 3), the function should return ((a b c) (1 2 3)).

Homework Answers

Answer #1

The Lisp Function that is used is List

List Function takes any number of arguments and returns a new list with the arguments as its elements

Lisp Code is :

(write (list '(a b c) '(1 2 3)))

Explanation:

Here In List function we passed two arguments i.e. ( a b c) and ( 1 2 3) and now when it return a new list then we are printing ot using write method .

Hence Code Screen Shot and Output is

This is how you can make a function which accept two list and give a single list as a output

Thank you

if you like the answer upvote it , if any doubt drop a comment in a comment box

Know the answer?
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
Similar Questions
C++ problem: Write a function that: accepts three integers as it's only arguments computes the average...
C++ problem: Write a function that: accepts three integers as it's only arguments computes the average of the arguments returns the average without loss of precision does not use global variables does not interact with the user in any way
Define a function getSeconds() that accepts one argument: a list of lists. getSeconds() should return the...
Define a function getSeconds() that accepts one argument: a list of lists. getSeconds() should return the second item in every sublist that has at least two items. If the sublist has fewer than two items, it should be ignored. For example: getSeconds([[1,2], ['a', 'b', 'c'], ['x'], [10, 20]]) should be [2, 'b', 20]
(1)Create a LISP function FLATTEN, a function that returns all the elements of an arbitrarily nested...
(1)Create a LISP function FLATTEN, a function that returns all the elements of an arbitrarily nested list in a single-level list. (FLATTEN ’((A B (R)) A C (A D ((A (B)) R) A))) should return (A B R A C A D A B R A). (2) Create a Lisp function EXP-EVAL, a function that evaluates an arithmetic expression. You may assume that the binary operators used for an arithmetic expression are: +, -, *, and /, and each of...
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in...
javascript 1.Write a function delay that accepts two arguments, a callback and the wait time in milliseconds. Delay should return a function that, when invoked waits for the specified amount of time before executing. HINT - research setTimeout(); 2.Create a function saveOutput that accepts a function (that will accept one argument), and a string (that will act as a password). saveOutput will then return a function that behaves exactly like the passed-in function, except for when the password string is...
You can only use built in Lisp functions and you cannot use setq function. Write a...
You can only use built in Lisp functions and you cannot use setq function. Write a function in Lisp called f7 that returns the element at a given location of a list. The locations start at 0. Example: (f7 ‘(c (a b) (d c) (x y)) 2) returns (d c)
C++ problem: Write a function that: accepts two integer variable arguments by reference swaps the contents...
C++ problem: Write a function that: accepts two integer variable arguments by reference swaps the contents of the two variables does not return anything does not interact with the user in anyway
Write a function that accepts an int array and the array’s size as arguments. The function...
Write a function that accepts an int array and the array’s size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0. The function should return a pointer to the new array. Demonstrate the function by using it in a main program that reads an integer N...
In lisp How can you print the dot product of two lists but return another list...
In lisp How can you print the dot product of two lists but return another list if they are not equal in length? not an error message but an actual list of words e.g return '(Not the same length) I keep getting a message not a number, no matter what I try.
You can only use built in Lisp functions and you cannot use setq function. Write a...
You can only use built in Lisp functions and you cannot use setq function. Write a function f2 that decides whether a list has an atom inside. Example: (f2 ‘((a b)(c d))) returns nil, (f2 ‘(a (b c))) returns t
Write a C++ function which accepts two array of integers (like arr1 and arr2) of the...
Write a C++ function which accepts two array of integers (like arr1 and arr2) of the same size (100), then create a new array (like arr3) with the same size (100) and assign the sum of corresponding elements in arr1 and arr2 to the new array (arr3) and return back arr3 from the function. You don't need to write the main function. For example sum of corresponding elements in arr1 and arr2 to be assigned to arr3 should be like:...