Category : Files from Magazines
Archive   : MAR93.ZIP
Filename : PROXY.ASC

 
Output of file : PROXY.ASC contained in archive : MAR93.ZIP
_PROXY: A SCHEME-BASED PROTOTYPING LANGUAGE_
by Burt Leavenworth

[LISTING ONE]

class queue(;rep) {
queue() {rep=[];}
enqueue(x) {rep=rep conc [x];}
dequeue(;x) {x=hd rep;
rep=tl rep;
return x;}
empty() {return rep==[];}};



LISTING TWO.

class pqueue(;rep) {
pqueue() {rep=[];}
private: insrt(x,y) {if(y == []) {rep = [x]; return rep;} else
if(x < hd y) {rep = [x] conc y;return rep;} else
{rep = [hd y] conc insrt(x,tl y);
return rep;}}
public: insert(x) {rep = insrt(x,rep); return rep;}
remove(;x) { if(rep == []) return "queue empty";
x = hd rep; rep = tl rep; return x;} };


[LISTING THREE]

add_mod(m,ms) {xu[m]=ms;};

del_mod(m) {xu= {x->xu[x] diff {m}:x <- (dom xu diff {m})};};

uses(m) {return xu[m];};

used_by(m) {return {ms:ms<-dom xu;m in xu[ms]};};

rec_mod() {return {m:m<-dom xu;reaches(m,m)};};

reaches(m1,m2) {return ((m2 in xu[m1])||(exists m in xu[m1];reaches(m,m2)));};


[LISTING FOUR]

add_mod("mod2",{"mod4","mod5","mod2"});
add_mod("mod3",{"mod5"});
add_mod("mod4",{"mod1","mod2"});
add_mod("mod5",{});
add_mod("mod1",{"mod2","mod3"});

xu = {"mod2"->{"mod4","mod5","mod2"},"mod3"->{"mod5"},
"mod4"->{"mod1","mod2"},"mod5"->{},"mod1"->{"mod2","mod3"}}

uses("mod1") returns {"mod2","mod3"}
used_by("mod2") returns {"mod2","mod4","mod1"}
rec_mod() returns {"mod2","mod4","mod1"}

del_mod("mod3");

xu = {"mod2"->{"mod4","mod5","mod2"},"mod4"->{"mod1","mod2"},
"mod5"->{},"mod1"->{"mod2"}}



Example 1. A general form for constructing sets.

{ f(x): x<- expr ; pred(x) }


Example 2. General method for constructing sets.

{ x: x<- {1,2,3,4,5}}; returns {1,2,3,4,5}

{ x: x <- {1,2,3,4,5};x>2}; returns {3,4,5}

{ x*x: x <- {1,2,3,4,5}}; returns {1,4,9,16,25}

It is possible to have two generators in which case an example is:

{ x+y: x <- {1,2}, y <- {3,4}} returns {4,5,6}


Only three elements are returned because two additions (1+4) and (2+3)
yield duplicate values.


Example 3: Syntax for using maps.

m = {1->2,3->4,5->6};


Example 4: (a) Domain restriction and subtraction; (b) using the
overwrite operator

(a)

{1->2,3->2,5->6} dr {3,5}; returns {3->2,5->6}
{1->2,3->2,5->6} ds {3,5}; returns {1->2}


(b)

{1->2,3->4} overwr {3->5,4->6}; returns {1->2,3->5,4->6}


Example 5a. General form for constructing a sequence; b)
constructing the sequence [4,5].

a)

[ f(x): x<- expr ; pred(x) ]

b)

[len x: x<-["abc","defg","hijkl"];len x > 3]; returns [4,5]



Example 6: (a) Syntax for the struct declaration; (b) Assigning
values to fileds in a struct

(a)

struct item {partno, code, quantity;};

(b)

i1.quantity=22; assigns 22 as the new value of the quantity field.



  3 Responses to “Category : Files from Magazines
Archive   : MAR93.ZIP
Filename : PROXY.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/