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 a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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