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

  Item number in the inventory

Write a console program that will ask the user for an item number in the inventory and display the name of that item. Stay in a loop so that the user may enter the item number multiple times. Use the letter E to exit the application. Show an error me..

  Explain the concept of supply chain management

Explain the concept of supply chain management. Although R/Way offers services rather than products, could that concept apply to the design of R/Way's new system? If so, how?

  Possibility-using fiber optic cable instead of twisted pair

Discuss the possibility of using fiber optic cable instead of either twisted pair cable or staying with the existing coax wiring structure.

  Tools or tactics for risks for computing infrastructure

As part of project to assess security risks for computing infrastructure, you have found that other managers often have different idea. List any tools or tactics that could be used.

  Provide permission to get financial amounts

System to have employees register and provide permission to get financial amounts from dental insurance and retirement companies.

  Find speedup gain of using simd computer over sisd computer

If both SISD and SIMD machines run at same clock speed, determine the speedup gain of using the SIMD computer over the SISD computer?

  Calculate performance of cache and the average cpi

Assume the instruction cache miss rate is 0.5% and the data cache miss rate is 1%. Calculate the performance of the cache (CPU execution time) and the average CPI.

  Explain boolean formula is minimal

Boolean formula is minimal if there is no shorter Boolean formula which is equivalent to . Let MIN-FORMULA = { | is a minimal formula }. (a) Show that MIN-FORMULA (b) PSPACE.

  Write organizational factors for benefits of new information

Write three organizational factors which can prevent a firm in completely realizing benefits of new information system, and give examples for each.

  Computing exact speed of a t1 line

Below what speed are there different leased line standards in different parts of the world? What is the exact speed of a T1 line?

  Sbh problem to reconstruct dna sequence from its l-mer

The SBH problem is to reconstruct a DNA sequence from its l-mer composition. Suppose that instead of a single target DNA fragment, we have two target DNA fragments

  Write statement which outputs num-cost to standard output

Write single statement which outputs num and cost to standard output. Print both values (num first, then cost), separated by a space on a single line.

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