Develop a new predict function

Assignment Help Programming Languages
Reference no: EM131296983


a) Using built in predict function NUMBERP, develop a new predict function so-called "elemnts_are_numbers" that checks all the elements of a list are numbers.

See these examples:
> (elemnts_are_numbers '( 1 8 9 6) )
> (elemnts_are_numbers ‘( a 8 9 b ) )

b) Test your function on your computer by some (at least 3 examples) of different values for its input list and show results of your examples for this function.


In this exercise assume: "first= car" and "rest = cdr" and L is a given list containing only numbers

a) Analyze this code and explain what myfunction5 is doing? (defun myfunction4 (n L)
((null L) nil)
((zerop n) (first L))
(t (myfunction4 (- n 1) (rest L)))))
b) Test this function on your computer by some (at least 3 examples) examples of different values for its parameters (n L) and show your results of your examples for this function.


a) Assume L is list of only integer numbers (Including zeros, or positive, or negative numbers, or could be an empty list), write a function that finds and returns the leftmost even number from this (if any, otherwise return NIL).

Example: for L= (-7, 17, 8, 9, -16, 19, 0, 27, 28, 13) , you should return: 28

b) Test your function on your computer by some (at least 3) examples of different values for its input parameter (L) and show your code and results of your examples for this function.


a) Compare these two functions (sum-list 1 and sum-list2), what these function do?

b) which one is more efficient or more readable? and why?
(defun sum-listl (L)
(if (null L) 0
(+ (first L)
(sum-list (rest L)))))
(defun sum-list2 (L)
(apply #'+ L))

Reference no: EM131296983

Previous Q& A

  Analyze any two types of qualitative research methods

Analyze and describe any two types of qualitative research methods. Explain the advantages and disadvantages of qualitative as well as quantitative research.

  Small business that develops gaming software

A few years ago, a friend of yours started a small business that develops gaming software. The company is doing well, and is valued at $1.5 million based on multiples for comparable public companies, after adjustments for their lack of marketabili..

  Is your firm involved in franchising

A health club differs from manufacturing firms in that it produces a service rather than products.- Why might Sue need other partners if she had established a manufacturing firm instead of a health club?

  Approached by friend who is starting minor league baseball

You have been approached by a friend who is starting a minor league baseball team in your city. He is seeking ten investors to put up $50,000 each. Expected net cash inflows over each of the next ten years are $350,000.

  Discuss about the e-activity

Conclude if your selected leadership theory holds true if it is applied to the Department of Defense, the United Way, or the Department of Taxation. Provide a rationale and examples to support your response.

  Failure mode effects analysis or fmea

The system, process, and design Failure Mode Effects Analysis or FMEA is a Lean Six Sigma tool used to identify any potential failures and to develop corrective actions for the potential failures.

  What is the real options approach to evaluating risk

An important factor in strategy formulation is looking how much risk a strategy might hold for the organization. What is the Real Options Approach to evaluating Risk? How does that differ from NPV (Net Present Value)?

  Components of the flsa overtime requirements

Discuss the key components of the FLSA overtime requirements, focusing specifically on considering the legal distinction between exempt and nonexempt employees.

  What is neutralization theory

What is neutralization theory? Name 5 of these and illustrate how they work. Define and contrast primary and secondary deviance. Provide an example for each

  What do you think of the given type of plan

Identified what that goal looks like and has figured out approximately how long it will take to achieve that goal and how much money they can make. What do you think of this type of plan?



12/1/2016 5:32:07 AM

For answering the next questions: install Common LISP interpreter on your computer, and save the code of these functions in a "*.lisp" file (giving them proper names) using a text editor and run your lisp file on your computer (for example load "question5.lisp"). For each question, also print the source code of your file "*.lisp" inside your report and its corresponding results.

Write a Review


Similar Q& A

  Modify the inventory program by adding a button to the gui

modify the inventory program by adding a button to the gui that allows the user to move to the first item the previous

  Calculate the current commission that the dealer receives

CSDP241 Spring, 2016 - Produce a sequential update program using techniques similar to the program given posted at the end of this homework.

  Write program to calculate miles per gallon for automobile

Write down the program which calculates miles per gallon for automobile. The program must ask for beginning milage reading on odometer at first.

  Program to perform a search of an employee list

Write a /bash/bin program to perform a search of an employee list.

  Create security code program-display digit-ascii character

You have been hired to create the security code program. Program must permit user to enter message, one character at a time.

  How do we convert string values from keyboard to numeric

Let's discuss how to use the Java I/O classes such as the system and the scanner classes to do console IO and the JOptionPane class to do dialog based IO. How do we convert string values from keyboard to numeric values

  Program to accept inputs from user beginning temperature

Physicists tell us that lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit. Accept inputs from user: a beginning temperature, ending temperature, and increment value (all Fahrenheit).

  Design and run a program that takes a numerical score

Design and run a program that takes a numerical score and outputs a letter grade. Precise numeral scores and letter grades are listed show.

  What runtimeexception if any will the following program

q1. what runtimeexception if any will the following program throw?class exception1 public static void mainstring

  Write console application that displays the sizes

Create a file that contains your favorite movie quote.  Use a text editor such as Notepad and save the file as Quote.txt.  Copy the file contents and paste them into a word-processing program such as Word.

  Write code for the missing sections

Use the following code outline as a starting point for your final project. You will need to correct any errors you find and write code for the missing sections.

  Implement a program to learn vocabulary of foreign languages

We want to implement a program which will help students learn the vocabulary of foreign languages. The first step, which has been assigned to you, is to build a data structure representing a list of English words and their translation in a foreign..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd