# CSCI 6962 DCI Exercise 4

Pairing Primitives

pr(x,y): returns a pair containing x and y.

ispr(x): returns 't' if x is a pair; 'f' otherwise

1st(pr(x,y))=x: 1st returns the first value of the pair

2nd(pr(x,y))=y: 2nd returns the second value.

Actor Cells

Bcell=rec(λb.λc.λm.

if (get?(m),

seq(become(b(c)), send(cust(m),c)),

if (set?(m),

become(b(contents(m))),

become(b(c)))))

Using the cell:

letactor{a:=Bcell(0)}e where

e=seq(send(a,mkset(3)), send(a,mkset(5)), send(a,mkget(c)))

A reference cell in π-calculus Example using reference cell: will receive the value v over the channel d assuming no other processes interacting with the reference cell.

Here is today's exercise:

1. Use λ-calculus and pairing primitives to define the following functions (appear in the "Actor Cells")

• get?(m)
• cust(m)
• set?(m)
• contents(m)
• mkset(c)
• mkget(c)

2. What is the difference between REF(r,w,i) and Bcell? (Hint: the target to be notified)

Modify the actor cell so that it behalves as the  π-calculus cell. And also modify the π-calculus cell so that it behalves as the actor cell.