Friday, June 28, 2013

KBP - Chapter 15

Review Question

3. Atoms and lists.

6. A list which membership of a given atom in a given list that does not include sublists.

7. REPL stand for read-evaluate-print loop.

8. Three parameters to IF are: a predicate expression, a then expression, and an else expression.

27. Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstr

29. Curried function let new functions can be constructed from them by partial evaluation.uction.

35. A language is nonstrict if it does not have the strict requirement.

___________________________________________________

Problem Set

2.  Give the general form of function declaration in ML.

Function declarations in ML appear in the general form
fun function_name( formal parameters ) = expression;

8. How is the functional operator pipeline ( |> ) used in F#?

The pipeline operator is a binary operator that sends the value of its left operand, which

is an expression, to the last parameter of the function call, which is the right operand. It is

used to chain together function calls while flowing the data being processed to each call.

9. What does the following Scheme function do?

(define (y s lis)

(cond

((null? lis) ‘() )

((equal? s (car lis)) lis)

(else (y s (cdr lis)))

))

y returns the given list with leading elements removed up to but not including the first

occurrence of the first given parameter.

No comments:

Post a Comment