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
Prepare an iPad application Clash of Clans like game I would like to prepare a free city building app with the in app purchase possibility. An example game could be Clash of Cla

Insertion sort - C program: Write a program in c to define a insertion sort. void main()  {   clrscr();   int a[100],ch,n;   cout   cin>>n;   for (int i=0

Here is a program that uses an inline function to compute and return the absolute value of its input argument. # include inline int abs(int x) {                  ret

Cross Platform Clinet app for a vpn Project Description: We want a cross platform client app for VPN. The app must have the subsequent options below: 1. Must be an open

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 #include float start_point,

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 between two points can b

C program to reverse the elements of array: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];

why c is middle level language?


In this problem, you will write a program that implements two algorithms for performing exact inference given a Bayesian network, namely, enumeration and variable elimination. Your