Develop a new predict function

Assignment Help Programming Languages
Reference no: EM131296983

Question#1:

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) )
T
> (elemnts_are_numbers ‘( a 8 9 b ) )
NIL

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.

Question#2:

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)
(cond
((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.

Question#3:

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.

Question#4:

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

Questions Cloud

Analyze potential barriers to feasibility of implementing : What are the unique or parallels between the implementation of this solution and the literature? Analyze potential barriers to the feasibility of implementing the proposed solution.
What did having a key informant add to your understanding : What understanding was gained from participation compared to just observing?What did having a key informant add to your understanding?What was learned from participant observation at this event that a questionnaire or interview about it might miss?
What is an advantage for sue of starting her own health club : How will CHC be taxed, given that Sue plans to be the sole owner?- What is an advantage for Sue of starting her own health club instead of operating a franchise health club?
Union and nonunion entities : Aware of the union and nonunion entities within Elora Jean & Co., you have observed that the production supervisors are unclear on the facility's union grievance procedures, and the nonproduction supervisors are unclear on how to handle employee c..
Develop a new predict function : Develop a new predict function so-called "elemnts_are_numbers" that checks all the elements of a list are numbers - Compare these two functions (sum-list 1 and sum-list2), what these function do?
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.

Reviews

len1296983

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

 

Programming Languages Questions & Answers

  Write program which exploit string library functions

Write a program which exploit the string library functions to do the following: prompt the user to enter his name (of four parts), count the number of characters in his name (excluding the white spaces).

  Identify some array used in organization

Identify some array used in your organization or an organization for which you know, the business applications; and share the information.

  Write program to allow user to enter marks of students

Write a program that allows user to key in marks of students. The number of students is determined by the user at the start of the program.

  Write a prolog relation that returns a list

Write another relation (anything you want) that does something not performed above. Explain what your relation does.

  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.

  Create a math tutoring program

You are being contracted to create a math tutoring program for a local elementary school.  This tutoring software should ask children which operation they would like to work on

  Write a program that display amount of discount on item

Write a program that asks the user to enter number of packages purchased. Program must then display amount of the discount (if any) and total amount of the purchase after the discount.

  Create script which checks day of the week

Create a script which checks day of the week, and takes one of two actions (step 2 or 3) depending on the day. If day is Monday through Friday, print (send to stdout) name of the day.

  Design application in visual basic.net 2005

Attached is a application created in Visual Basic.Net 2005

  Write the program which simulates shopping

Write the program which simulates shopping. Program must have a loop which continues as long as user wants to shop. Each time through loop read in name, price, and quantity of the item.

  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.

  How theory designates team member roles and responsibilities

Explain how participation, leadership, and motivational skills would be demonstrated according to this theory.

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