alice
library
manual.

Alice Project

The INTEGER signature


________ Synopsis ____________________________________________________

    signature INTEGER
    structure Int : INTEGER where type int = int
    structure FixedInt : INTEGER = Int
    structure LargeInt : INTEGER = IntInf
    structure Position : INTEGER = Int
  

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

See also: IntInf, WORD, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature INTEGER =
    sig
	eqtype int
	type t = int

	val minInt :     int option
	val maxInt :     int option
	val precision :  Int.int option

	val toInt :      int -> Int.int
	val fromInt :    Int.int -> int
	val toLarge :    int -> LargeInt.int
	val fromLarge :  LargeInt.int -> int

	val ~ :          int -> int
	val op + :       int * int -> int
	val op - :       int * int -> int
	val op * :       int * int -> int
	val op div :     int * int -> int
	val op mod :     int * int -> int
	val op quot :    int * int -> int
	val op rem :     int * int -> int

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

	val abs :        int -> int
	val min :        int * int -> int
	val max :        int * int -> int
	val sign :       int -> Int.int
	val sameSign :   int * int -> bool

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

________ Description _________________________________________________

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

type t = int

A local synonym for type int.

equal (i1, i2)

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

hash i

A hash function for integers. Returns i itself.

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   [+~-]?[0-1_]*[0-1][0-1_]*
	StringCvt.OCT   [+~-]?[0-7_]*[0-7][0-7_]*
	StringCvt.DEC   [+~-]?[0-9_]*[0-9][0-9_]*
	StringCvt.HEX   [+~-]?(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