On Sat, Jan 5, 2013 at 10:02 PM, Matt Rice <[email protected]> wrote:
> of implementing a queue in this style (attached).
FWIW when I wrote the queue i came up with a mock syntax,
I couldn't find it, so rewrote it then found it, *shrug* anyhow that
is the sort of thing that i was thinking of..
// use of -> to represent a transition between invariants of the same object,
// <- to represent an assignment to a different object.
struct list('a) {
@empty { }
@lone, next, prev, nextprev {value: 'a;}
@nextprev {
@next{next: list('a);}
@prev{prev: list('a);}
}
}
struct frozenlist: list('a) {
@next {list@next;}
head: list@lone
|| list@lone -> list@next
|| list@next <- list@next
|| list@next <- @next;
}
struct mutablefrozenlist: frozenlist {
list.value: 'a <- 'a;
}
struct doublyList: list('a) {
head: list@lone
|| list@lone -> list@next
|| list@next <- list@next;
// headRest is an alias of head/tail->prev respectively
// they ensure that head/tail only need a next and a prev
// or a lone.
headRest: list@empty
|| list@empty <- list@next
|| list@next -> list@nextprev
|| list@nextprev <- list@next;
tailRest: list@empty
|| list@empty <- list@nextprev
|| list@nextprev -> list@prev
|| list@prev <- list@nextprev;
tail: list@lone
|| list@lone -> list@prev
|| list@prev <- list@prev;
}
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev