Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Write a LISP function FACT that takes a list containing one numeric atom (N) and computes N factorial. For example: (FACT (5) Returns the

image text in transcribed
. Write a LISP function FACT that takes a list containing one numeric atom (N) and computes N factorial. For example: (FACT (5) Returns the value 120 2. Write a LISP function COUNTLETS which takes a list and returns the number of top-level alphabetic atoms in the list. For example (COUNTLETS (I (A 2) B 3 C 4 (D 5))) Returns the value 2, the letters A and D are not at the top level 3. Write LISP functions REMLESS and REMGREATER REMLESS takes a numeric atom and a list and returns a list consisting of the original list with all numbers less than the given number removed. REMGREATER takes a numeric atom and a list and returns a list consisting of the original list with all numbers greater than the given number removed. For example: (REMLESS 4 '(3 5824 19)) Returns the list (5 8 4 9) and (REMGREATER 4 '(3 5 8 241 9)) Return the list (3 2 41) 4. Write a LISP function INSERTPOS which takes an atom, a position number and a list and returns the list with the atom inserted into the correct position. For example: (INSERTPOS D0 '(A (A B) C)) Returns the list (D A (A B) C) and (INSERTPOS 'D 2 '(A (A B) C) Returns the list (A (AB) DC) 5. Write a LISP function COUNTALLLETS which takes a list and counts the number of alphabetic atoms in the list, no matter how deeply nested they are. For example: (COUNTALLX '(1 A2(3 B4 (5 C 6)))) Returns the value 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lords Of Finance The Bankers Who Broke The World

Authors: Liaquat Ahamed

1st Edition

0143116800, 978-0143116806