src/HOL/Matrix/FloatSparseMatrixBuilder.ML
changeset 41491 a2ad5b824051
parent 37788 261c61fabc98
child 46531 eff798e48efc
equal deleted inserted replaced
41490:0f1e411a1448 41491:a2ad5b824051
   142             else case Int.fromString (String.extract(s, 1, NONE)) of
   142             else case Int.fromString (String.extract(s, 1, NONE)) of
   143                      SOME i => i | NONE => raise (No_name s)
   143                      SOME i => i | NONE => raise (No_name s)
   144 
   144 
   145         fun nameof i =
   145         fun nameof i =
   146             let
   146             let
   147                 val s = "x"^(Int.toString i)
   147                 val s = "x" ^ string_of_int i
   148                 val _ = Unsynchronized.change ytable (Inttab.update (i, s))
   148                 val _ = Unsynchronized.change ytable (Inttab.update (i, s))
   149             in
   149             in
   150                 s
   150                 s
   151             end
   151             end
   152 
   152 
   199         fun indexof s =
   199         fun indexof s =
   200             if String.size s = 0 then raise (No_name s)
   200             if String.size s = 0 then raise (No_name s)
   201             else case Int.fromString (String.extract(s, 1, NONE)) of
   201             else case Int.fromString (String.extract(s, 1, NONE)) of
   202                      SOME i => i | NONE => raise (No_name s)
   202                      SOME i => i | NONE => raise (No_name s)
   203 
   203 
   204         fun nameof i = "y"^(Int.toString i)
   204         fun nameof i = "y" ^ string_of_int i
   205 
   205 
   206         fun split_numstr s =
   206         fun split_numstr s =
   207             if String.isPrefix "-" s then (false,String.extract(s, 1, NONE))
   207             if String.isPrefix "-" s then (false,String.extract(s, 1, NONE))
   208             else if String.isPrefix "+" s then (true, String.extract(s, 1, NONE))
   208             else if String.isPrefix "+" s then (true, String.extract(s, 1, NONE))
   209             else (true, s)
   209             else (true, s)