src/Pure/library.ML
changeset 23251 471b576aad25
parent 23220 9e04da929160
child 23424 d0580634f128
equal deleted inserted replaced
23250:9886802cbbd6 23251:471b576aad25
   122   val prefixes: 'a list -> 'a list list
   122   val prefixes: 'a list -> 'a list list
   123   val suffixes1: 'a list -> 'a list list
   123   val suffixes1: 'a list -> 'a list list
   124   val suffixes: 'a list -> 'a list list
   124   val suffixes: 'a list -> 'a list list
   125 
   125 
   126   (*integers*)
   126   (*integers*)
   127   val gcd: IntInf.int * IntInf.int -> IntInf.int
       
   128   val lcm: IntInf.int * IntInf.int -> IntInf.int
       
   129   val inc: int ref -> int
   127   val inc: int ref -> int
   130   val dec: int ref -> int
   128   val dec: int ref -> int
   131   val upto: int * int -> int list
   129   val upto: int * int -> int list
   132   val downto: int * int -> int list
   130   val downto: int * int -> int list
   133   val radixpand: int * int -> int list
   131   val radixpand: int * int -> int list
   637 
   635 
   638 
   636 
   639 
   637 
   640 (** integers **)
   638 (** integers **)
   641 
   639 
   642 fun gcd (x, y) =
       
   643   let fun gxd x y : IntInf.int =
       
   644     if y = IntInf.fromInt 0 then x else gxd y (x mod y)
       
   645   in if x < y then gxd y x else gxd x y end;
       
   646 
       
   647 fun lcm (x, y) = (x * y) div gcd (x, y);
       
   648 
       
   649 fun inc i = (i := ! i + 1; ! i);
   640 fun inc i = (i := ! i + 1; ! i);
   650 fun dec i = (i := ! i - 1; ! i);
   641 fun dec i = (i := ! i - 1; ! i);
   651 
   642 
   652 
   643 
   653 (* lists of integers *)
   644 (* lists of integers *)