alice
library
manual.

Alice Project

The IntInf structure


________ Synopsis ____________________________________________________

    signature INT_INF
    structure IntInf : INT_INF
  

An extended version of the Standard ML Basis' IntInf structure.

See also: INTEGER, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature INT_INF =
    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 divMod :        int * int -> int * int
        val quotRem :       int * int -> int * int
        val pow :           int * Int.int -> int
        val log2 :          int -> Int.int
        val orb :           int * int -> int
        val xorb :          int * int -> int
        val andb :          int * int -> int
        val notb :          int -> int
        val << :            int * Word.word -> int
        val ~>> :           int * Word.word -> 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' IntInf structure.

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