You spin me around and around

F# supports the idea of a recursive value binding, allowing one to define various recursive data structures.

> type Foo = { next : Foo };;
> let rec x = { next = x };;
val x : Foo

Of course, we then have problems using the cyclic structure that we’ve just constructed. For example, the following expression loops:

> x = x.next;;

There’s a good paper explaining why this facility is useful.

I came across this while looking at an interesting paper that discusses the duality between the notion of garbage for events and for standard objects in a managed runtime. The paper uses this to design a modified garbage collection algorithm, which is then used to drive the design of a set of combinators and primitives for a reactive library which doesn’t leak garbage.

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s