archives

seeking article on representing cyclic graphs using purely functional data structures

Some time ago I have seen an article reference on LtU that discussed representing cyclic graphs using purely functional data structures. The graph structure was something like flow graph or state machine.

The article discussed switch from implementation based on mutable variables to purely functional version, and the thesis of article was that the authors lived more happily with purely functional version afterwards.

I was unable to locate article using search (too many unrelated results), if somewhat remember the article or at least its title, please give me a reference.

I'm from china and I'm working on a new programming language "Zero"

First appologize for my poor English.:)So,I just write more codes.

I'v found a new way of reusing codes:

Question:
there are three properties: Prop1,Prop2,Prop3.they all have a member named "Value".

Prop1.Value:=1; //Prop1 is defined as integer type.
Prop2.Value:=2.345; //Prop2 is defined as float type.
Prop3.Value:=’abc’; //Prop3 is defined as string type.

How to write a function return all these propX's value?
We can write like this:

function GetPropertyValueofProp1: Integer;
begin
Result:=Prop1.Value;
end.

function GetPropertyValueofProp2: double;
begin
Result=Prop2.Value;
end.

function GetPropertyValueofProp3: string;
begin
Result=Prop3.Value;
end.

these three functions are very similar,can we write one function to deal with it?

In my new programming language "Zero",it is OK!
We can write a function like this:

function GetPropertyValue(Ψprop): Ψtype;
begin
result:= Ψprop.Value;
end

So strange!Can it work?How to use it?Can the compiler of the language deal with it?

Zero language has an IDE named "Amoeba".Through the syntax of the function analysis, Amoeba knows:
1 Ψprop contains a member named "Value".
2 Ψtype is a type.
3 The type of Ψprop.Value is same as Ψtype.

so,when we write the function in IDE:

var m1: Integer;
m1:=GetPropertyValue (____);

There is a blank we should fill.Amoeba's Code assist will give the message:
[ Prop1 ]

It means there is only one selection we can fill.Why?

Because m1 is integer type,and each side of ":=" has the same type,"Amoeba" knows it.

if the code is like this:

var m1;
m1:=GetPropertyValue (____);

Amoeba's Code assist will give the message:
[Prop1,Prop2,Prop3]

Why?because Amoeba don't know m1's type.So there are 3 selections.
The most intresting thing is,when we fill the blank with "Prop2",
What will happen?

Now m1 has a "float" type!

Let's explain the new way of reusing codes,the rule is:

If we found similar codes,write it directly,if something is
undetermined,represent it with Ψ.The Amoeba IDE always knows what do you want.I know STL can do something similar,but Amoeba is more powerful and friendly for users.