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 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.

  Design a small dictionary using the binary search tree

Design a small dictionary using the Binary Search Tree data structure. Each entry may include a word and its definitions. You should create the tree structure/dictionary using data input from a text file. After the dictionary is created, the user ..

  Program to calculate amount person would earn over a period

Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day.

  Create a form application

Create a form that has a text area that will hold Mission Title and Adjusted Total Box Office Profit data.

  Create logic for program-continously prompts for numeric

Create the logic for a program that continously prompts the user for two numeric values that represent the sides of a rectangle.

  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.

  Proc mean data=ex1height

Proc mean data=EX1height;throws what sort of error message

  Write function to merge contents of two sorted arrays

Write a function which will merge contents of two sorted (ascending order) arrays of type FLOAT values, use efficient bubble sort to sort two arrays first and then use merger function.

  Debug a simple visual basic program

The GUI program will have a button that creates a new window with the word Hello. Enhance the display by making the word change color, move, or change to another language (such as Hola).

  Write a program that will use the four sorting algorithm

Write a program that will use the four sorts (Selection sort, Heap Sort, Quicksort and Merge Sort). Each of the four sorts should be TIMED on three different lists of integers.

  Create a webpage that will accept students grades

Create a webpage that will accept students' grades and produce statistic results -

  Write program to caculate value of user-s stock

Write a program which caculates value of user's holding of a particular stock. Program asks for number of shares held, whole ¬dollar portion of price for one share, also the fraction portion.

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