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

Assignment Help:

(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.

 


Related Discussions:- Using substitution model write corresponding constructor

Write a program to calculate the total resistance, Write a program to calcu...

Write a program to calculate the total resistance of a series or parallel circuit. The maximum number of resistors is two.   We need to decide whether the user wants the to

Arrays and pointers, i have an array of structs, and am trying to make a po...

i have an array of structs, and am trying to make a pointer that can point to a certain struct within the array

C program to construct a structure , c program to construct a structure: ...

c program to construct a structure: struct sensus                 {                                 char name[30];                                 long int population;

Wap to print sum=1!+2!+3!+4!+....n!, WAP TO PRINT SUM=1!+2!+3!+4!+....N! ...

WAP TO PRINT SUM=1!+2!+3!+4!+....N! #include stdio.h> #include conio.h>   void main() {                    int n,i;                    float sum=0,fac

Explain the type conversion in expressions in c language, Explain The Type ...

Explain The Type Conversion in Expressions in c language? When variables and constants of different types are used in an expression they are all converted to same type. The com

C program to find area of rectangle, Aim: To implement a program to find a...

Aim: To implement a program to find area of rectangle, surface area of box and volume of box using virtual functions. Code:                       class rect {

Logic families and lsi devices, We have used logic symbols in the past, but...

We have used logic symbols in the past, but not really though about the actual real devices. Semiconductor companies have taken the logic symbols are manufactured them into logic f

Function that have parameter and makes an integer mask, Write a function th...

Write a function that has an int parameter n, makes an integer mask having the bit 1 at the nth place from the rightmost bit, and returns the mask. For example, when n = 5 is passe

Define the double data type of c language, Define the Double Data Type of c...

Define the Double Data Type of c Language? The double is used to define BIG floating point numbers and it reserves twice the storage for the number. When the accuracy provided

Write Your Message!

Captcha
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