Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In common lisp, You may use the following functions: do do* go prog, return, setq every notany notevery some * + - / = /=

In common lisp,

image text in transcribed

You may use the following functions:

do do* go

prog, return, setq

every notany notevery some

* + - / = /= >= 1+ 1- abs and append apply atom caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr car cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr cond cons consp defun elt endp eq eql equal eval evenp first fourth funcall if integerp lambda last length let let* list list* listp load max member min minusp not nth null numberp oddp or plusp quote rest reverse second stringp symbolp third zerop

Write the predicates: isLpairs-recursive (q) is Lpairs-iterative (q) isLpairs-every (4) Each of these indicates whether q is a list of pairs. Examples: (isLpairs-recursive '(1 2) (a b)) returns (isLpairs-recursive '( 2) (a b c) returns nil Write islpairs-recursive recursively, write islf airs-iterative iteratively using either-go. or do', and write isLpairs-every using every (see text or see Part 5). Your code for isLpairs- recursive and isLpairs-iterative must return nil as soon as it encounters a non-pair within q: i.e, it is not to process the remaining list elements. (Your code for isLpairs-every will already do that since that is how every behaves.) Write the predicates: isLpairs-recursive (q) is Lpairs-iterative (q) isLpairs-every (4) Each of these indicates whether q is a list of pairs. Examples: (isLpairs-recursive '(1 2) (a b)) returns (isLpairs-recursive '( 2) (a b c) returns nil Write islpairs-recursive recursively, write islf airs-iterative iteratively using either-go. or do', and write isLpairs-every using every (see text or see Part 5). Your code for isLpairs- recursive and isLpairs-iterative must return nil as soon as it encounters a non-pair within q: i.e, it is not to process the remaining list elements. (Your code for isLpairs-every will already do that since that is how every behaves.)

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

What is the meaning and definition of E-Business?

Answered: 1 week ago