alice
library
manual.

Alice Project

The WORD signature


________ Synopsis ____________________________________________________

    signature WORD
    structure Word : WORD where type word = word
    structure Word8 : WORD
    structure Word31 : WORD
    structure Word32 : WORD
    structure LargeWord : WORD = Word32
  

An extended version of the Standard ML Basis' WORD signature.

See also: INTEGER, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature WORD =
    sig
	eqtype word
	type t = word

	val wordSize :      int

	val toLarge :       word -> LargeWord.word
	val toLargeX :      word -> LargeWord.word
	val fromLarge :     LargeWord.word -> word
	val toLargeInt :    word -> LargeInt.int
	val toLargeIntX :   word -> LargeInt.int
	val fromLargeInt :  LargeInt.int -> word
	val toInt :         word -> int
	val toIntX :        word -> int
	val fromInt :       int -> word

	val notb :          word -> word
	val orb :           word * word -> word
	val xorb :          word * word -> word
	val andb :          word * word -> word
	val << :            word * Word.word -> word
	val >> :            word * Word.word -> word
	val ~>> :           word * Word.word -> word

	val ~ :             word -> word
	val + :             word * word -> word
	val - :             word * word -> word
	val * :             word * word -> word
	val div :           word * word -> word
	val mod :           word * word -> word

	val op > :          word * word -> bool
	val op < :          word * word -> bool
	val op >= :         word * word -> bool
	val op <= :         word * word -> bool
	val equal :         word * word -> bool
	val compare :       word * word -> order
	val hash :          word -> int

	val min :           word * word -> word
	val max :           word * word -> word

	val fmt :           StringCvt.radix -> word -> string
	val toString :      word -> string
	val scan :          StringCvt.radix -> (char,'a) StringCvt.reader -> (word,'a) StringCvt.reader
	val fromString :    string -> word option
    end
  

________ Description _________________________________________________

Items not described here are as in the Standard ML Basis' WORD signature.

type t = word

A local synonym for type word.

equal (i1, i2)

An explicit equality function on integers. Equivalent to op=.

hash i

A hash function for words.

fromString s
scan getc strm

Like specified in the Standard ML Basis, except that underscores are allowed to separate digits. The scan function thus accepts the following formats:

        StringCvt.BIN   (0w)?[0-1_]*[0-1][0-1_]*
	StringCvt.OCT   (0w)?[0-7_]*[0-7][0-7_]*
	StringCvt.DEC   (0w)?[0-9_]*[0-9][0-9_]*
	StringCvt.HEX   (0wx|0wX|0x|0X)?[0-9a-fA-F_]*[0-9a-fA-F][0-9a-fA-F_]*

The expression fromString s is equivalent to StringCvt.scanString (scan DEC) s.



last modified 2007/Mar/30 17:10