(*

MY first QUEUE file

MY first queue file Check out HTML and comments - can HTML commandis be embedded withing ML comments - almost certainly As long as the HTML commands are embedding in ML comments, they work, with no problems, and they do not interfere with the ML!

The only concession to HTML is that for the Mosaic browser, the file has to have a .html extension, but this causes no problems with the ML system.

The code for the Abstype follows (extracted from a student file)

*)
abstype 'a Queue = Q of 'a list
 with	val EmptyQueue = Q [];
	fun Front (Q []) = error "Front on Empty"
	  | Front (Q(i::_)) = i;
	fun Leave (Q []) = error "Leave on Empty"
	  | Leave (Q(_::q)) = Q(q);
	fun Enter (i,Q(q)) = Q(q@(i::[]));
	fun QueueIsEmpty (Q(q)) = (q=[]);
end;

(* 
To link to the code for the stacks Astype, press here

To link to the test output for this file press here

NOTES

  1. This is a demo file - the links above DO NOT WORK.
  2. It is also possible to do hypertext links within a single file - they can be used to cross refer code to abstract types defined within the same file, or for other purposes. This feature will be more useful for large program texts.
  3. The same approach should also work for MODULA 2 and Pascal programs which use the same comment convention - C programs should work using /* and */ as delimiters instead.
  4. This file is BOTH HTML and ML compatible - it WILL compile under the ml system - I have checked!

    Dave Martland, 15/11/93

*)