Question

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

Homework Answers

Answer #1

please please thumbs up!!

hope it will help uh out!!!

Code::
(IN LISP LANGUAGE)

-------------------------------------------

(defun f2 (ls)
(cond ((null ls) nil)
((atom (car ls)) t)
((= 0 0) (f2 (cdr ls)))))
(write (f2 '((a b) (b c))))

----------------------------------------

output::

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
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)
Write a LISP function REMOVELAST which removes the last element of a given list. For example:...
Write a LISP function REMOVELAST which removes the last element of a given list. For example: (REMOVELAST ‘(A (A B) C)) Returns the list (A (A B)) and (REMOVELAST ‘(A B (C D))) Returns the list (A B)
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)).
(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...
You must write each of the following scheme functions. You must use only basic scheme functions...
You must write each of the following scheme functions. You must use only basic scheme functions do not use third-party libraries to support any of your work. Do not use any function with side effects. Write a function (running-sum L) that takes a list of numbers L and generates a list of the runnining sums. See the following examples for clarification. (running-sum '(1 2 3)) ---> (1 3 6) (running-sum '()) ---> () (running-sum '(3 0 -2 3)) ---> (3...
In this example you are allowed to use from the C standard library only functions for...
In this example you are allowed to use from the C standard library only functions for input and output (e.g. printf(), scanf()) Complete the following functions using C programming language: a) Complete the int Q7a(intQ7_input) function takes a seven-digit positive integer as input and returns it reversed. For example, if the integer is 9806593, the program should print 3956089. You are not permitted to use any function of C standard library other than scanf()and printf().You are not permitted to use...
How can you use recursion in lisp (clisp) to process infix. Example (Thisisinfix '(1 + 2...
How can you use recursion in lisp (clisp) to process infix. Example (Thisisinfix '(1 + 2 * ( 1 + 2)) = 7 (Thisisinfix '((1 + 2) * ( 1 + 2))) = 9 I need the general idea of how this works, not the full functional code. This also needs to be done not using any kind of variables such as let, or any sets, only recursion, however you can define other functions using defun if that helps. I...
using dr.racket programing language If we write a function that tests whether a list contains only...
using dr.racket programing language If we write a function that tests whether a list contains only strings, odd numbers, or even numbers, you will notice that the code that iterates through the list stays the same, with the only change being the predicate function that checks for the desired list element. If we were to write a new function for each of the tests listed above, it would be more error-prone and an example of bad abstraction. We could write...
Write a function called odd_rms that returns orms, which is the square root of the mean...
Write a function called odd_rms that returns orms, which is the square root of the mean of the squares of the first nn positive odd integers, where nn is a positive integer and is the only input argument. For example, if nn is 3, your function needs to compute and return the square root of the average of the numbers 1, 9, and 25. You may use built-in functions including, for example, sum and sqrt, except for the built-in function...
Write a function called odd_rms that returns orms, which is the square root of the mean...
Write a function called odd_rms that returns orms, which is the square root of the mean of the squares of the first nn positive odd integers, where nn is a positive integer and is the only input argument. For example, if nn is 3, your function needs to compute and return the square root of the average of the numbers 1, 9, and 25. You may use built-in functions including, for example, sum and sqrt, except for the built-in function...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT