Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a recursive function FIRSTLAST that takes a list as a parameter. It will return a list made up of the first and last item

Create a recursive function FIRSTLAST that takes a list as a parameter. It will return a list made up of the first and last item in the original list. Do error checking on the input (e.g. checking that it is a list of at least two items).

[26]> (firstlast '(a b c)) (a c) [28]> (firstlast "foo") Error in FIRSTLAST function. Parameter must be a list, but was "foo". NIL [30]> (firstlast '(((a) b c) 1 2 (3 5) 7 9)) ((a) b c) 9)

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

List the components of the strategic management process. page 72

Answered: 1 week ago