The lisp function length counts

Assignment Help Basic Computer Science
Reference no: EM13164582

Write a function DOT-PRODUCT that takes two lists, each list has three numbers (elements), and produces the dot product of the vectors that they represent. For example,

-> (DOT-PRODUCT '(1.2 2.0 -0.2) '(0.0 2.3 5.0))

            -> 3.6

Write a function COUNT-NUMBER that counts the number of numbers that occur in a list. It should work like this:

-> (COUNT-NUMBER '(A 2.3 B 5 4.53 C F))

            -> 3

Write a function NEW-LIST that takes a number as its argument and constructs a list of that length containing all Ts. For example,

-> (new-lit 5)

-> (T T T T T)

The Lisp function LENGTH counts the number of elements in the top level of a list. Write a function ALL-LENGTH of one argument that counts the number of atoms that occur in a list at all levels.  Thus, the following lists will have the following ALL-LENGTHs.

(A B C)                                   => 3

            ((A (B C) D (E F))      => 6

            (NIL NIL (NIL NIL) NIL )   => 5

Reference no: EM13164582

Questions Cloud

Using java, design and implement an api euclidean graph : Using Java, design and implement an API EuclideanGraph for graphs whose vertices are points in the plane that include coordinates.
The class constructor should accept an array : Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores. If any test score in the array is negative or greater than 10..
Opens an output file with the external name : Design an algorithm that does the following: opens an output file with the external name number_list.dat, uses a loop to write the numbers 1 through 100 to the file and then closes the file.
Devise a linear-time algorithm to count the parallel edges : Parallel edge detection: Devise a linear-time algorithm to count the parallel edges in a graph. Write the algorithm in pseudo-code.
The lisp function length counts : The Lisp function LENGTH counts the number of elements in the top level of a list. Write a function ALL-LENGTH of one argument that counts the number of atoms that occur in a list at all levels.  Thus, the following lists will have the following A..
In logicworks : In Logicworks, make a new design for an automobile third brake light. It will have 8 clock pulses (so use 3 D Flip Flops) and will sequence an LED stip of 15 red LED's as shown after each clock pulse. On the 7th clock pulse, the clock will become ..
What explicit statement is required in a set of ifrs : What explicit statement is required in a set of IFRS first-time adoption financial statements and explain whether and ABC, Inc. should present all of their statements of financial position using the new standard
Outline the design of a wireless network : Outline the design of a wireless network to support user mobility over a wide area. Include in your answer a discussion of addressing, routing and the used of fixed versus ad hoc network access nodes or base stations.
How are they recorded in last year accounts : Johnis a company director withundrawn wages-director feesfrom last year $108K and how are they recorded in last year accounts?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine maximum size of register file in instruction-set

You are designing simple 32-bit instruction-set architecture which requires to support 45 opcodes, three source operands and one destination operand. Determine the maximum size of register file that this architecture can use?

  Up-to-the-minute information effective for medical industry

Up-to-the-minute information to clinicians in visually rich format to improve quality of patient care" do you believe this is the effective for medical industry to view this kind of information? Why or why not?

  Describe method to keep the data local caches in sync across

describe method to keep the data local caches in sync across multiple processors (i.e. cache coherence). discuss implementations issues

  Solve decanting problem using euclidean algorithm

Use Euclidean algorithm to solve decanting problem for decanters of sizes 1317 and 1075. Or we can say, determine integers x and y.

  Computing selection inputs for multiplexer system

Determine selection inputs are required if you used MUX A and MUX B system?

  Identify and explore challenges and opportunities

LO2 Identify and explore contemporary challenges and opportunities in information systems and to formulate an opinion or judgement and offer possible solutions.

  What is effect of control hazards on cpi for pipeline

What is the effect of control hazards on the CPI for this pipeline? Consider the two cases of "predict branch not taken" and "predict branch taken".

  Differentiate centralised and distributed data processing

Explain the differences between centralised and distributed data processing. Describe the pros and cons of each approach.

  How many block of main memory is needed-direct mapped cache

Suppose a computer using direct mapped cache has 2^32 words of main memory and a cache of 1024 blocks, where each cache block contains 32 words. How many block of main memory are there?

  Explaining negative reactions to pop-up and pop-behind

Many people have strong negative reactions to pop-up, pop-behind, interstitial, and rich media ads. Assume you are the director of an advertising agency that specializes in creating and placing these ads.

  People and organization responsible for bumping problems

Answer from the perspective of the airlines and from the perspective of the customers. What people, organization, and technology factors are responsible for excessive bumping problems?"

  Public boolean chackanagram

write the anagramList() chackanagram. checkAnagram returns true if its two Word parameters have original words that are nagrams. If not, checkAnagram returns false. use the ethod header below to write checkanagram. Assume that all Word methods work a..

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