1619 lines · 61.3 KB · Text
RawDownload
Moscow ML version 2.00 (June 2000)Enter `quit();' to quit.[opening file "test.sml"][opening file "test1.sml"]> val it = 1 : int> val it = 5 : int> val it = 100 : int> val fact = fn : int -> int> val it = 24 : int> val 'a append2 = fn : 'a list * 'a list -> 'a list> val it = [1, 2, 3, 4, 5, 6] : int list> val 'a append = fn : 'a list -> 'a list -> 'a list> val it = [1, 2, 3, 4, 5, 6] : int list> val 'a reverse = fn : 'a list -> 'a list> val it = [4, 3, 2, 1] : int list> val it = [false, true] : bool list> val 'a @ = fn : 'a list * 'a list -> 'a list> infixr 5 @> val it = [1, 2, 3, 4, 5, 6] : int list[closing file "test1.sml"]> val it = () : unit[opening file "test2.sml"]> val fact = fn : int -> int> val it = 24 : int> val 'a append2 = fn : 'a list * 'a list -> 'a list> val it = [1, 2, 3, 4, 5, 6] : int list> val 'a append = fn : 'a list -> 'a list -> 'a list> val it = [1, 2, 3, 4, 5, 6] : int list> val 'a reverse = fn : 'a list -> 'a list> val it = [4, 3, 2, 1] : int list> val it = [false, true] : bool list> val 'a @ = fn : 'a list * 'a list -> 'a list> infixr 5 @> val it = [1, 2, 3, 4, 5, 6] : int list[closing file "test2.sml"]> val it = () : unit[opening file "test3.sml"]> New type names: =Tree  datatype 'a Tree =  ('a Tree,   {con 'a Br : 'a * 'a Tree * 'a Tree -> 'a Tree, con 'a Lf : 'a Tree})  con 'a Br = fn : 'a * 'a Tree * 'a Tree -> 'a Tree  con 'a Lf = Lf : 'a Tree> val t1 = Br(2, Br(1, Lf, Lf), Br(3, Lf, Lf)) : int Tree> val ('a, 'b) foldTree = fn : ('a -> 'b -> 'b -> 'b) -> 'b -> 'a Tree -> 'b> val 'a revBranch = fn : 'a -> 'a Tree -> 'a Tree -> 'a Tree> val refl_t1 = Br(2, Br(3, Lf, Lf), Br(1, Lf, Lf)) : int Tree[closing file "test3.sml"]> val it = () : unit[opening file "test4.sml"]> val ('a, 'b) map = fn : ('a -> 'b) -> 'a list -> 'b list> val it = [2, 3, 4] : int list> infix 5 ++> val 'a ++ = fn : 'a list * 'a list -> 'a list> val it = [1, 2, 3, 4, 5, 6] : int list> val 'a reverse = fn : 'a list -> 'a list> val it = [4, 3, 2, 1] : int list> val it = [false, true] : bool list> infix 3 o> val ('a, 'b, 'c) o = fn : ('a -> 'b) * ('c -> 'a) -> 'c -> 'b> val it = [1, 2, 3] : int list> val zl = [(1, true), (2, false), (3, true)] : (int * bool) list> val ('a, 'b) fst = fn : 'a * 'b -> 'a> val ('a, 'b) snd = fn : 'a * 'b -> 'b> val it = [1, 2, 3] : int list> val ('a, 'b) split = fn : ('a * 'b) list -> 'a list * 'b list> val it = ([1, 2, 3], [true, false, true]) : int list * bool list> val ''a member = fn : ''a -> ''a list -> bool> val it = true : bool> val it = false : bool[closing file "test4.sml"]> val it = () : unit[opening file "test5.sml"]> val it = [7] : int list> val 'a Id = fn : 'a -> 'a> val 'a Id' = fn : 'a -> 'a> val 'a reverse = fn : 'a list -> 'a list> val it = [3, 2, 1] : int list> val it = [false, true] : bool list> val f = fn : int ref -> int ref * int> val it = (ref 666, 99) : int ref * int> val it = 8 : int[closing file "test5.sml"]> val it = () : unit[opening file "test6.sml"]> exn E = E : exn> val 'a f = fn : unit -> 'a> val it = "OK" : string> val elist = [E, Size] : exn list> exn E' = E' : exn> val it = "OK" : string> val it = "OK" : string> exn G = fn : int -> exn> val it = "OK" : string[closing file "test6.sml"]> val it = () : unit[opening file "test7.sml"]> New type names: Stack  type 'a Stack = 'a Stack  type 'a StackTop = 'a * 'a Stack  exn EmptyStack = EmptyStack : exn  val 'a empty = <Stack> : 'a Stack  val 'a top = fn : 'a Stack -> 'a  val 'a push = fn : 'a -> 'a Stack -> 'a Stack  val 'a pop = fn : 'a Stack -> 'a Stack> val st1 = <Stack> : int Stack> val top1 = 3 : int> val rest1 = <Stack> : int Stack[closing file "test7.sml"]> val it = () : unit[opening file "test8.sml"]> New type names: =arex  datatype 'a arex =  ('a arex,   {con 'a ADD : ('a arex * 'a arex) -> 'a arex,    con 'a MINUS : 'a arex -> 'a arex,    con 'a SUB : ('a arex * 'a arex) -> 'a arex,    con 'a TIP : 'a -> 'a arex})  type 'a binary = 'a arex * 'a arex  type 'a unary = 'a arex  con 'a ADD = fn : ('a arex * 'a arex) -> 'a arex  con 'a MINUS = fn : 'a arex -> 'a arex  con 'a SUB = fn : ('a arex * 'a arex) -> 'a arex  con 'a TIP = fn : 'a -> 'a arex> val a1 = MINUS(ADD(TIP 1, SUB(TIP 2, TIP 5))) : int arex[closing file "test8.sml"]> val it = () : unit[opening file "test9.sml"]> type person = {age : int, name : string}> val p1 = {age = 99, name = "Peter"} : {age : int, name : string}> val name1 = "Peter" : string  val age1 = 99 : int> val ('a, 'b) nameOfPerson = fn : {age : 'a, name : 'b} -> 'b> val name1 = "Peter" : string> val name = "Peter" : string  val age = 99 : int> val name = "Peter" : string> val name = "Peter" : string  val name1 = "Peter" : string> val f = fn : {age : int, name : string} -> string> val name1 = "Peter" : string> val age1 = 99 : int> val f = fn : {lab : int} -> int> val ('a, ''b) it = fn :  'a -> ({l1 : ''b, l2 : int} -> {l1 : ''b, l3 : string} -> bool) * bool(fn, true)> val it = () : unit> val ('a, 'b, ''c, 'd, 'e, ''f) it = fn :  'a ->  ({l1 : 'b, l2 : ''c} -> 'b) * ({l1 : 'd, l2 : 'e} -> 'd * 'e) *  ({l1 : ''f, l2 : ''c} -> bool * ''f * (''f * ''c))(fn, fn, fn)> val it = () : unit[closing file "test9.sml"]> val it = () : unit[opening file "testa.sml"]> val even = fn : int -> bool  val odd = fn : int -> bool> val it = true : bool> val it = false : bool> New type names: =X  datatype 'a X = ('a X,{con 'a X : string -> 'a X})  con 'a X = fn : string -> 'a X> val 'a stripX = fn : 'a X -> string> val 'a it = fn : 'a -> string> val it = "OK" : string> val 'a stripX666 = fn : 'a X -> 'a X> val ('a, 'b) it = fn : 'a -> 'b X> val it = X "000" : int X> val ('a, 'b) it = fn : 'a -> 'b X> val it = X "OK" : int X> New type names: =XXX  datatype XXX = (XXX,{con A : int * int -> XXX, con B : int * int -> XXX})  con A = fn : int * int -> XXX  con B = fn : int * int -> XXX> val a12 = A(1, 2) : XXX  val b12 = B(1, 2) : XXX> val strip = fn : XXX -> int * int> val it = false : bool> val it = true : bool[closing file "testa.sml"]> val it = () : unit[opening file "testb.sml"]File "testb.sml", line 3, characters 9-12:! (let val nil = [1,2] and _ =!          ^^^! Warning: pattern matching is not exhaustive > val it = "OK" : stringFile "testb.sml", line 7, characters 2-17:! ((fn 0 => "WRONG") 1)!   ^^^^^^^^^^^^^^^! Warning: pattern matching is not exhaustive > val it = "OK" : string> val it = [{cause = Fail  "OK", function = "OK", name = "OK"}] :  {cause : exn, function : string, name : string} list> val it =    ({cause = Fail  "OK", function = "OK", name = "OK"},     {cause = Fail  "OK", function = "OK", name = "OK"}) :  {cause : exn, function : string, name : string} *  {cause : exn, function : string, name : string}> val it =    {aaa = {cause = Fail  "OK", function = "OK", name = "OK"},     bbb = {cause = Fail  "OK", function = "OK", name = "OK"}} :  {aaa : {cause : exn, function : string, name : string},   bbb : {cause : exn, function : string, name : string}}> val pr = fn : string -> string> val ('a, 'b, 'c, 'd, 'e, 'f, 'g) x7 = fn :  'a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g -> 'a * 'b * 'c * 'd * 'e * 'f * 'g246> val it = ("1", "2", "3", "4", "5", "6", "7") :  string * string * string * string * string * string * string> New type names: =AB  datatype ('a, 'b) AB =  (('a, 'b) AB,   {con ('a, 'b) CONSab : {a : 'a, b : 'b} -> ('a, 'b) AB,    con ('a, 'b) NILab : ('a, 'b) AB})  con ('a, 'b) CONSab = fn : {a : 'a, b : 'b} -> ('a, 'b) AB  con ('a, 'b) NILab = NILab : ('a, 'b) ABab> val it = CONSab{a = "a", b = "b"} : (string, string) ABba> val it = CONSab{a = "a", b = "b"} : (string, string) AB> val 'a f = fn : 'a -> 'a> val f = fn : int -> int> val it = "OK" : string[closing file "testb.sml"]> val it = () : unit[opening file "testc.sml"]> New type names: =xxx  datatype xxx =  (xxx,{con P : xxx, con Q : {key : (xxx ref * xxx ref) list} -> xxx})  con P = P : xxx  con Q = fn : {key : (xxx ref * xxx ref) list} -> xxx> val z = ref P : xxx ref> val it = () : unit> val it =    ref(Q{key =            [(ref(Q{key =                      [(ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]})),                       (ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}))]}),              ref(Q{key =                      [(ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]})),                       (ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}))]})),             (ref(Q{key =                      [(ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]})),                       (ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}))]}),              ref(Q{key =                      [(ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]})),                       (ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}),                        ref(Q{key =                                [(ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]})),                                 (ref(Q{key = [(#, #), (#, #)]}),                                  ref(Q{key = [(#, #), (#, #)]}))]}))]}))]}) :  xxx ref[closing file "testc.sml"]> val it = () : unit[opening file "testd.sml"]> val maxint = 1073741823 : int> val minint = ~1073741824 : int> infix 0 seq  val ('a, 'b) seq = fn : 'a * 'b -> 'b> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val sum = fn : int * int -> int> val diff = fn : int * int -> int> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val prod = fn : int * int -> int> val it = "OK" : string> val checkDivMod = fn : int -> int -> string23 10   > val it = "OK" : string~23 10   > val it = "OK" : string23 ~10   > val it = "OK" : string~23 ~10   > val it = "OK" : string100 10   > val it = "OK" : string~100 10   > val it = "OK" : string100 ~10   > val it = "OK" : string~100 ~10   > val it = "OK" : string100 1   > val it = "OK" : string100 ~1   > val it = "OK" : string0 1   > val it = "OK" : string0 ~1   > val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val maxri = 1073741823.0 : real> val minri = ~1073741824.0 : real> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string[closing file "testd.sml"]> val it = () : unit[opening file "teste.sml"]> val MAXDOUBLE = 8.98846567431E307 : real> val MINDOUBLE = 1E~307 : real> val pi = 3.14159265359 : real> val eps = 1E~14 : real> infix 0 seq  val ('a, 'b) seq = fn : 'a * 'b -> 'b> val 'a check1 = fn : ('a -> real) * 'a * real -> string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val ('a, 'b) check2 = fn : ('a * 'b -> real) * 'a * 'b * real -> string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val it = "OK" : string> val f = fn : real -> real[closing file "teste.sml"]> val it = () : unit[opening file "testprs.sml"]> New type names: =token  datatype token =  (token,{con Key : string -> token, con Name : string -> token})  con Key = fn : string -> token  con Name = fn : string -> token> exn SynError = fn : string -> exn> val $ = fn : string -> token list -> string * token list> val id = fn : token list -> string * token list> infix 3 >>> val ('a, 'b, 'c, 'd) >> = fn : ('a -> 'b * 'c) * ('b -> 'd) -> 'a -> 'd * 'c> infix 0 ||> val ('a, 'b) || = fn : ('a -> 'b) * ('a -> 'b) -> 'a -> 'b> infix 5 ~~> val ('a, 'b, 'c, 'd, 'e) ~~ = fn :  ('a -> 'b * 'c) * ('c -> 'd * 'e) -> 'a -> ('b * 'd) * 'e> val ('a, 'b) empty = fn : 'a -> 'b list * 'a> val ('a, 'b) many = fn : ('a -> 'b * 'a) -> 'a -> 'b list * 'a> val ('a, 'b) snd = fn : 'a * 'b -> 'b> val ('a, 'b, 'c, 'd) many_sep = fn :  ('a -> 'b * 'c) -> ('c -> 'd * 'a) -> 'a -> 'b list * 'c> val ('a, 'b, 'c) parser = fn : ('a -> 'b * 'c list) -> 'a -> 'b> New type names: =typ  datatype typ =  (typ,{con Con : string * typ list -> typ, con Var : string -> typ})  con Con = fn : string * typ list -> typ  con Var = fn : string -> typ> val parseTypeExp = fn : token list -> typ> val t1 = [Name "a", Key "->", Name "b", Key "->", Name "c"] : token list> val t2 = [Key "(", Name "a", Key "->", Name "b", Key ")", Key "->", Name "c"]     : token list> val it = Con("->", [Var "a", Con("->", [Var "b", Var "c"])]) : typ> val it = Con("->", [Con("->", [Var "a", Var "b"]), Var "c"]) : typ[closing file "testprs.sml"]> val it = () : unit[opening file "ovlsucc.sml"]> type word8 = word8> val iii1 = fn : int -> int -> int> val iii2 = fn : int -> int -> int> val iii3 = fn : int -> int -> int> val iii4 = fn : int -> int -> int> val iii5 = fn : int -> int -> int> val iii6 = fn : int -> int -> bool> val iib7 = fn : int -> int -> bool> val iib8 = fn : int -> int -> bool> val iib9 = fn : int -> int -> bool> val ii10 = fn : int -> int> val ii11 = fn : int -> int> val www1 = fn : word -> word -> word> val www2 = fn : word -> word -> word> val www3 = fn : word -> word -> word> val www4 = fn : word -> word -> word> val www5 = fn : word -> word -> word> val www6 = fn : word -> word -> bool> val wwb7 = fn : word -> word -> bool> val wwb8 = fn : word -> word -> bool> val wwb9 = fn : word -> word -> bool> val www1 = fn : word8 -> word8 -> word8> val www2 = fn : word8 -> word8 -> word8> val www3 = fn : word8 -> word8 -> word8> val www4 = fn : word8 -> word8 -> word8> val www5 = fn : word8 -> word8 -> word8> val www6 = fn : word8 -> word8 -> bool> val wwb7 = fn : word8 -> word8 -> bool> val wwb8 = fn : word8 -> word8 -> bool> val wwb9 = fn : word8 -> word8 -> bool> val rrr1 = fn : real -> real -> real> val rrr2 = fn : real -> real -> real> val rrr3 = fn : real -> real -> real> val rrb4 = fn : real -> real -> bool> val rrb5 = fn : real -> real -> bool> val rrb6 = fn : real -> real -> bool> val rrb7 = fn : real -> real -> bool> val rr8 = fn : real -> real> val rr9 = fn : real -> real> val ssb1 = fn : string -> string -> bool> val ssb2 = fn : string -> string -> bool> val ssb3 = fn : string -> string -> bool> val ssb4 = fn : string -> string -> bool> val ccb1 = fn : char -> char -> bool> val ccb2 = fn : char -> char -> bool> val ccb3 = fn : char -> char -> bool> val ccb4 = fn : char -> char -> bool> val succ1 = fn : word8 -> word8 list> val succ2 = fn : word -> word list> val less = fn : int * int -> bool  val minii = fn : int * int -> int> val is12 = fn : int -> string> val ws10 = fn : word -> string> val ws10 = fn : word8 -> string> val rs10 = fn : real -> string> val ss5 = fn : string -> string> val cs5 = fn : char -> string> val eei1 = true : bool> val eew1 = true : bool> val eec1 = true : bool> val eeg1 = true : boolUser: 1.000  System: 0.010  GC: 0.000  Real: 1.015

Lines 1–500 of 1619.