Using substitution model write corresponding constructor, C/C++ Programming

(a) Pairs may be represented using a lambda. Using only lambdas, create a procedure (triple x y z) that constructs a triplet. You may NOT use car, cons or cdr in the triplet procedures. Using this formulation for a triplet, write procedures first, second and third that return the first, second and third elements of the triplet respectively.
For example:

(define a (triple 1 2 3))
(first a) => 1
(second a) => 2
(third a) => 3

(b) Using the substitution model, show how (first a) returns the value 1.

(c) Develop another alternative representation of triples. Write the corresponding constructor, first, second and third procedures, along with set-first!, set-second! and set-third!. You may not use car, cdr or cons in this second implementation.

 

Posted Date: 3/25/2013 1:06:56 AM | Location : United States







Related Discussions:- Using substitution model write corresponding constructor, Assignment Help, Ask Question on Using substitution model write corresponding constructor, Get Answer, Expert's Help, Using substitution model write corresponding constructor Discussions

Write discussion on Using substitution model write corresponding constructor
Your posts are moderated
Related Questions
b) The static keyword let a variable to maintain its value among distinct function calls. If the value of a static variable alters while the variable has been accessed, variable


Ask question #write statement that assign random integer to the varaible n in the (100

find area under the curve y=f(x) between x=a &y=b integrate y=f(x)

Assume that a Binary Search Tree is constructed by repeatedly inserting exact values in to the tree. Argue that the number of nodes examined in searching for a value in the tree is

Write a program called Converter that does three types of metric conversions. Your program should prompt the user for the selection conversion, prompt for input data, and display t

hi i want wite a C++ program that get one logical phrase (included {x,y,z,w,1,0}) and simplify it! but i ''m confused! thanxs for anubody help me...

Nested Classes Many a times, it becomes essential to have a class contain properties of two other classes. One way is to explain a class within another - that is a class with m

Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will p