*** empty log message ***
authorwneuper
Mon, 09 Feb 2004 19:46:31 +0100
changeset 132369aeac78de50
parent 1322 3ead6dc17bbd
child 1324 45b5e55a2669
*** empty log message ***
src/sml/library.sml
     1.1 --- a/src/sml/library.sml	Mon Feb 09 19:46:31 2004 +0100
     1.2 +++ b/src/sml/library.sml	Mon Feb 09 19:46:31 2004 +0100
     1.3 @@ -113,6 +113,11 @@
     1.4  	| strip bdVar (c  ::cs) = strip (bdVar @[c]) cs
     1.5    in strip [] (rev(explode str)) end;
     1.6      
     1.7 +fun id_of (Var ((id,ix),_)) = if ix=0 then id else id^(string_of_int ix)
     1.8 +  | id_of (Free (id    ,_)) = id
     1.9 +  | id_of (Const(id    ,_)) = id
    1.10 +  | id_of _                 = ""; (* never such an identifier *)
    1.11 +
    1.12  fun ids_of t =
    1.13    let fun con ss (Const (s,_)) = s::ss
    1.14  	| con ss (Free (s,_)) = s::ss
    1.15 @@ -161,4 +166,12 @@
    1.16  (*> take_be 3 5 [1,2,3,4,5,6,7];
    1.17  val it = [3,4,5] : int list 
    1.18  > take_be 3 3  [1,2,3,4,5,6,7];
    1.19 -val it = [3] : int list*)
    1.20 \ No newline at end of file
    1.21 +val it = [3] : int list*)
    1.22 +
    1.23 +(*get the string for stac from rule*)
    1.24 +fun assoc_calc ([], key) = raise error ("assoc_calc: '"^ key ^"' not found")
    1.25 +  | assoc_calc ((calc, (keyi, xi)) :: pairs, key) =
    1.26 +      if key = keyi then calc else assoc_calc (pairs, key);
    1.27 +fun assoc1 ([], key) = raise error ("assoc1 (for met.calc=): '"^ key ^"' not found")
    1.28 +  | assoc1 ((all as (keyi, _)) :: pairs, key) =
    1.29 +      if key = keyi then all else assoc1 (pairs, key);