## Define procedure to input integers and returns the average, C/C++ Programming

Assignment Help:

The procedure +, * and list take arbitrary numbers of arguments. One way to define such a procedure is to use define with dotted-tail notation. In a procedure definition, a parameter list that has a dot before the last parameter name indicates that, when the procedure is called, the initial parameters (if any) will have as values the initial arguments, as usual, but the final parameter's value will be a list of any remaining arguments. For instance, give the definition:

(define (f x y . z) )

the procedure f can be called with two or more arguments. If we evaluate

(f 1 2 3 4 5 6)

then in the body of f, x will be 1, y will be 2, and z will be the list (3 4 5 6).

Given the definition:

(define (g . w) )

the procedure g can be called with 0 or more arguments. If we evaluate

(g 1 2 3 4 5 6)

then in the body of g, w will be the list ( 1 2 3 4 5 6).

(a) Use this notation to write a procedure average that takes one or more integers and returns the average. For example:

(average 1 2 3 4 5 6 7) => 4
(average 2) => 2

(b) Write a procedure called pipeline that accepts a variable number of arguments that are procedures and returns the composition of those procedures. This is called pipeline processing. You may assume that all procedures in the pipeline accept a single argument. For example:
(define square-cubed (pipeline square square square))
; is equivalent to:
(define square-cubed (lambda (x) (square (square (square x)))))
(square-cubed 2) => 256

(c) Using your definition for pipeline from (b), write procedures for cdar, cddar and cdadr.

#### Arrays, #questi An array of n numbers is given, where n is an even number. ...

#questi An array of n numbers is given, where n is an even number. The maximum as well as minimum of these given numbers need to be determined. Which of the following is true about

#### Areaundercurve.c, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw   Solution:

#### Program, Write a ‘C’ program to accept any 3 digit integer number from the ...

Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

#### What is constructor or ctor?, What is constructor or ctor?

What is constructor or ctor?

#### Palindrome, Problem : Change to palindrome A palindrome is a string that r...

Problem : Change to palindrome A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your ta

#### Pointer, how to use a pointer variable?

how to use a pointer variable?

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

#### C program for find even & odd no.s in the array , C Program for FIND EVEN &...

C Program for FIND EVEN & ODD NO.S IN THE ARRAY #include stdio.h> #include string.h> #include conio.h> void main() {           int i=0,j=0, l_e,l_o;

#### Define the return statement in computer programming, Define The Return Stat...

Define The Return Statement in Computer Programming? The return statement is used for two purposes once the return statement is executed the program control will be immediately  