neuper@37906: (* states for calculation in global refs neuper@37906: use"../states.sml"; neuper@37906: use"states.sml"; neuper@37906: *) neuper@37906: neuper@37906: (* neuper@37906: type hide = (pblID * neuper@37906: string list * (*hide: tacs + neuper@37906: "ALL", .. result immediately neuper@37906: "MODELPBL", .. modeling hidden neuper@37906: "SPEC", .. specifying hidden neuper@37906: "MODELMET", .. (additional itms !) neuper@37906: "APPLY", .. solving hidden neuper@37906: detail: rls neuper@37906: "Rewrite_*" (as strings) must _not_ be .. neuper@37906: .. contained in this list, rls _only_ !*) neuper@37906: bool) (*inherit to children in pbl-herarchy*) neuper@37906: list; neuper@37906: neuper@37906: (*. points a pbl/metID to a sub-hierarchy of key ?.*) neuper@37906: fun is_child_of child key = neuper@37906: let fun is_ch [] [] = true (*is child of itself*) neuper@37906: | is_ch (c::_) [] = true neuper@37906: | is_ch [] (k::_) = false neuper@37906: | is_ch (c::cs) (k::ks) = neuper@37906: if c = k then is_ch cs ks else false neuper@37906: in is_ch (rev child) (rev key) end; neuper@37906: (* neuper@37986: is_child_of ["root'","univar","equation"] ["univar","equation"]; neuper@37906: val it = true : bool neuper@37986: is_child_of ["root'","univar","equation"] ["system","equation"]; neuper@37906: val it = false : bool neuper@37906: is_child_of ["equation"] ["system","equation"]; neuper@37906: val it = false : bool neuper@37986: is_child_of ["root'","univar","equation"] ["linear","univar","equation"]; neuper@37906: val it = false : bool neuper@37906: *) neuper@37906: neuper@37906: (*.what tactics have to be hidden (in model/specify these may be several).*) neuper@37906: datatype hid = neuper@37906: Show (**) neuper@37906: | Hundef (**) neuper@37906: | Htac (*a tactic has to be hidden*) neuper@37906: | Hmodel (*the model of the (sub)problem has to be hidden*) neuper@37906: | Hspecify (*the specification of the (sub)problem has to be hidden*) neuper@37906: | Happly; (*solving the (sub)problem has to be hidden*) neuper@37906: neuper@37906: (*. search all pbls if there is some tactic or model/spec/calc to hide .*) neuper@37906: fun is_hid pblID arg [] = Show neuper@37906: | is_hid pblID arg ((pblID', strs, inherit)::pts) = neuper@37906: let fun is_mem arg = neuper@37906: if arg mem strs then Htac neuper@37906: else if arg mem ["Add_Given","Add_Find","Add_Relation"] neuper@37906: andalso "MODEL" mem strs then Hmodel neuper@37906: else if arg mem ["Specify_Theory","Specify_Problem", neuper@37906: "Specify_Method"] neuper@37906: andalso "SPEC" mem strs then Hspecify neuper@37906: else if "APPLY" mem strs then Htac neuper@37906: else Hundef neuper@37906: in if inherit then neuper@37906: if is_child_of (pblID:pblID) pblID' neuper@37906: then case is_mem arg of Hundef => is_hid pblID arg (pts:hide) neuper@37906: | hid => hid neuper@37906: else is_hid pblID arg pts neuper@37906: else if pblID = pblID' neuper@37906: then case is_mem arg of Hundef => is_hid pblID arg (pts:hide) neuper@37906: | hid => hid neuper@37906: else is_hid pblID arg pts neuper@37906: end; neuper@37906: (*val hide = [([],["Refine_Tacitly"],true), neuper@37906: (["univar","equation"],["Apply_Method","Model_Problem","SPEC"], neuper@37906: false)] neuper@37906: :hide; neuper@37906: is_hid [] "Rewrite" hide; neuper@37906: val it = Show neuper@37906: is_hid ["any","problem"] "Refine_Tacitly" hide; neuper@37906: val it = Htac neuper@37986: is_hid ["root'","univar","equation"] "Apply_Method" hide; neuper@37906: val it = Show neuper@37906: is_hid ["univar","equation"] "Apply_Method" hide; neuper@37906: val it = Htac neuper@37906: is_hid ["univar","equation"] "Specify_Problem" hide; neuper@37906: val it = Hspecify neuper@37906: *) neuper@37906: neuper@37906: fun is_hide pblID (tac as (Subproblem (_,pI))) (det:detail) = neuper@37906: is_hid pblID "SELF" det neuper@37906: | is_hide pblID (tac as (Rewrite (thmID,_))) det = neuper@37906: is_hid pblID thmID det neuper@37906: | is_hide pblID (tac as (Rewrite_Inst (_,(thmID,_)))) det = neuper@37906: is_hid pblID thmID det neuper@37906: | is_hide pblID (tac as (Rewrite_Set rls)) det = neuper@37906: is_hid pblID rls det neuper@37906: | is_hide pblID (tac as (Rewrite_Set_Inst (_,rls))) det = neuper@37906: is_hid pblID rls det neuper@37906: | is_hide pblID tac det = is_hid pblID (tac2IDstr tac) det; neuper@37906: (*val hide = [([],["Refine_Tacitly"],true), neuper@37906: (["univar","equation"],["Apply_Method","Model_Problem", neuper@37906: "SPEC","SELF"], neuper@37906: false)] neuper@37906: :hide; neuper@37906: is_hide [] (Rewrite ("","")) hide; neuper@37906: val it = Show neuper@37906: is_hide ["any","problem"] (Refine_Tacitly []) hide; neuper@37906: val it = Htac neuper@37986: is_hide ["root'","univar","equation"] (Apply_Method []) hide; neuper@37906: val it = Show neuper@37906: is_hide ["univar","equation"] (Apply_Method []) hide; neuper@37906: val it = Htac neuper@37906: is_hide ["univar","equation"] (Specify_Problem []) hide; neuper@37906: val it = Hspecify neuper@37906: is_hide ["univar","equation"] (Subproblem (e_domID,["univar","equation"]))hide; neuper@37906: val it = Htac neuper@37906: is_hide ["equation"] (Subproblem (e_domID,["univar","equation"]))hide; neuper@37906: val it = Show neuper@37906: *) neuper@37906: neuper@37906: neuper@37906: (*. search all pbls in detail if there is some rls' to be detailed .*) neuper@37906: fun is_det pblID arg [] = false neuper@37906: | is_det pblID arg ((pblID', rlss, inherit)::pts) = neuper@37906: if inherit then neuper@37906: if is_child_of (pblID:pblID) pblID' neuper@37906: then if arg mem rlss then true neuper@37906: else is_det pblID arg (pts:detail) neuper@37906: else is_det pblID arg pts neuper@37906: else if pblID = pblID' neuper@37906: then if arg mem rlss then true neuper@37906: else is_det pblID arg (pts:detail) neuper@37906: else is_det pblID arg pts; neuper@37906: neuper@37906: (*fun is_detail pblID (tac as (Subproblem (_,pI))) (det:detail) = neuper@37906: is_det pblID "SELF" det*) neuper@37906: fun is_detail pblID (tac as (Rewrite_Set rls)) det = neuper@37906: is_det pblID rls det neuper@37906: | is_detail pblID (tac as (Rewrite_Set_Inst (_,rls))) det = neuper@37906: is_det pblID rls det neuper@37906: | is_detail _ _ _ = false; neuper@37906: ----------------------------------------*) neuper@37906: wneuper@59254: (* holds calculations; these are read/updated from the java-frontend at each interaction*) wneuper@59254: val states = Synchronized.var "isac_states" ([] : wneuper@59254: (calcID * (* the id unique for a calculation *) wneuper@59265: (Chead.calcstate * (* the interpreter state *) wneuper@59254: (iterID * (* 1 sets the 'active formula': a calc. can have several visitors*) wneuper@59276: Ctree.pos' (* for iterator of a user *) wneuper@59254: (* TODO iterID * pos' should go to java-frontend *) wneuper@59254: ) list)) list); s1210629013@55445: s1210629013@55445: fun reset_states () = Synchronized.change states (fn _ => []); neuper@37906: (* neuper@37906: states:= [(3,(e_calcstate, [(1,e_pos'), neuper@37906: (3,e_pos')])), neuper@37906: (4,(e_calcstate, [(1,e_pos'), neuper@37906: (2,e_pos')]))]; neuper@37906: *) neuper@37906: neuper@37906: (** create new instances of users and ptrees neuper@37906: new keys are the lowest possible in the association list **) neuper@37906: neuper@37906: (* add users *) neuper@37906: fun new_key u n = case assoc (u, n) of neuper@37926: NONE => n neuper@37926: | SOME _ => new_key u (n+1); neuper@37906: (*///10.10 neuper@37906: fun get_calcID (u:(calcID * (calcstate * (iterID * pos') list)) list) = neuper@37906: (new_key u 1):calcID;*) neuper@37906: (* neuper@37906: val new_iterID = get_calcID (!states); neuper@37906: val it = 1 : int neuper@37906: states:= (!states) @ [(new_iterID, [])]; neuper@37906: !states; neuper@37906: val it = [(3,[(#,#),(#,#)]),(4,[(#,#),(#,#)]),(1,[])] neuper@37906: *) neuper@37906: neuper@37906: (*///7.10.03/// add states to a users active states neuper@37906: fun get_calcID (uI:iterID) (p:(iterID * (calcID * state) list) list) = neuper@37906: case assoc (p, uI) of neuper@38031: NONE => error ("get_calcID: no iterID " ^ neuper@37906: (string_of_int uI)) neuper@37926: | SOME ps => (new_key ps 1):calcID; neuper@37906: > get_calcID 1 (!states); neuper@37906: val it = 1 : calcID neuper@37906: *) neuper@37906: (* add users to a calcstate *) neuper@37906: fun get_iterID (cI:calcID) wneuper@59276: (p:(calcID * (Chead.calcstate * (iterID * Ctree.pos') list)) list) = neuper@37906: case assoc (p, cI) of neuper@38031: NONE => error ("get_iterID: no iterID " ^ (string_of_int cI)) neuper@37926: | SOME (_, us) => (new_key us 1):iterID; neuper@37906: (* get_iterID 3 (!states); neuper@37906: val it = 2 : iterID*) neuper@37906: neuper@37906: neuper@37906: (** retrieve, update, delete a state by iterID, calcID **) neuper@37906: neuper@37906: (*//////7.10. neuper@37906: fun get_cal (uI:iterID) (pI:calcID) (p:(iterID * (calcID * state) list) list) = neuper@37906: (the (assoc2 (p,(uI, pI)))) neuper@38031: handle _ => error ("get_state " ^ (string_of_int uI) ^ neuper@37906: " " ^ (string_of_int pI) ^ " not existent"); neuper@37906: > get_cal 3 1 (!states); neuper@37906: val it = (((EmptyPtree,(#,#)),[]),([],[])) : state neuper@37906: *) neuper@37906: neuper@37906: (*///7.10. neuper@37906: fun get_state (uI:iterID) (pI:calcID) = get_cal uI pI (!states); neuper@37906: fun get_calc (uI:iterID) (pI:calcID) = (snd o (get_cal uI pI)) (!states); neuper@37906: *) neuper@37906: fun get_calc (cI:calcID) = s1210629013@55445: case assoc (Synchronized.value states, cI) of neuper@38031: NONE => error ("get_calc "^(string_of_int cI)^" not existent") neuper@37926: | SOME (c, _) => c; neuper@37906: fun get_pos (cI:calcID) (uI:iterID) = s1210629013@55445: case assoc (Synchronized.value states, cI) of neuper@38031: NONE => error ("get_pos: calc " ^ (string_of_int cI) neuper@37906: ^ " not existent") neuper@37926: | SOME (_, us) => neuper@37906: (case assoc (us, uI) of neuper@38031: NONE => error ("get_pos: user " ^ (string_of_int uI) neuper@37906: ^ " not existent") neuper@37926: | SOME p => p); neuper@37906: neuper@37906: neuper@37906: fun del_assoc ([],_) = [] neuper@37906: | del_assoc a = neuper@37906: let fun del ([], key) ps = ps neuper@37906: | del ((keyi, xi) :: pairs, key) ps = neuper@37906: if key = keyi then ps @ pairs neuper@37906: else del (pairs, key) (ps @ [(keyi, xi)]) neuper@37906: in del a [] end; neuper@37906: (* neuper@37906: > val ps = [(1,"1"),(2,"2"),(3,"3"),(4,"4")]; neuper@37906: > del_assoc (ps,3); neuper@37906: val it = [(1,"1"),(2,"2"),(4,"4")] : (int * string) list neuper@37906: *) neuper@37906: neuper@37906: (* delete doesn't report non existing elements *) neuper@37906: (*/////7.10. neuper@37906: fun del_assoc2 (uI:iterID) (pI:calcID) ps = neuper@37906: let val new_ps = del_assoc (the (assoc (ps, uI)), pI) neuper@37906: in overwrite (ps, (uI, new_ps)) end;*) neuper@37906: (* neuper@37906: > states:= del_assoc2 4 41 (!states); neuper@37906: > !states; neuper@37906: val it = [(3,[(#,#),(#,#),(#,#)]),(4,[(#,#)]),(1,[(#,#)])] : states neuper@37906: neuper@37906: > del_user 3; neuper@37906: > !states; neuper@37906: val it = [(4,[(#,#)]),(1,[(#,#)])] : states neuper@37906: *) neuper@37906: fun del_assoc2 (cI:calcID) (uI:iterID) ps = neuper@37906: case assoc (ps, cI) of neuper@37926: NONE => ps neuper@37926: | SOME (cs, us) => neuper@37906: overwrite (ps, (cI, (cs, del_assoc (us, uI)))); neuper@37906: (* neuper@37906: > del_assoc2 4 1 (!states); neuper@37906: val it = neuper@37906: [(3, (((EmptyPtree, ([], Und)), []), [(1, ([], Und)), (3, ([], Und))])), neuper@37906: (4, (((EmptyPtree, ([], Und)), []), [(2, ([], Und))]))]*) neuper@37906: neuper@37906: (*///7.10. neuper@37906: fun overwrite2 (ps, (((uI:iterID), (pI:calcID)), p)) = neuper@37906: let val new_ps = overwrite (the (assoc (ps, uI)), (pI, p)) neuper@37906: in (overwrite (ps, (uI, new_ps))) neuper@38031: handle _ => error ("overwrite2 " ^ (string_of_int uI) ^ neuper@37906: " " ^ (string_of_int pI) ^ " not existent") neuper@37906: end;*) neuper@37906: fun overwrite2 (ps, (((cI:calcID), (uI:iterID)), p)) = neuper@37906: case assoc (ps, cI) of neuper@37926: NONE => neuper@38031: error ("overwrite2: calc " ^ (string_of_int uI) ^" not existent") neuper@37926: | SOME (cs, us) => neuper@37906: overwrite (ps, (cI ,(cs, overwrite (us, (uI, p))))); neuper@37906: neuper@55469: (* here is _no_ critical section on states; sufficient would be neuper@55469: fun upd_calc cI cs = neuper@55469: case assoc (Synchronized.value states, cI) of neuper@55469: NONE => error ... neuper@55469: | SOME (_, us) => neuper@55469: Synchronized.change states (fn s => overwrite ...) neuper@55469: *) s1210629013@55445: fun upd_calc (cI:calcID) cs = Synchronized.change states s1210629013@55445: (fn s => case assoc (s, cI) of s1210629013@55445: NONE => error ("upd_calc " ^ (string_of_int cI) ^ " not existent") s1210629013@55445: | SOME (_, us) => overwrite (s, (cI, (cs, us)))); neuper@37906: (*WN051210 testing before initac: only 1 taci in calcstate so far: neuper@37906: fun upd_calc (cI:calcID) (cs as (_, tacis):calcstate) = neuper@37906: (if length tacis > 1 neuper@38031: then error ("upd_calc, |tacis|>1: "^tacis2str tacis) neuper@37906: else (); neuper@37906: case assoc (!states, cI) of neuper@38031: NONE => error ("upd_calc "^(string_of_int cI)^" not existent") neuper@37926: | SOME (_, us) => states:= overwrite (!states, (cI, (cs, us))) neuper@37906: );*) neuper@37906: neuper@37906: neuper@37906: (*///7.10. neuper@37906: fun upd_tacis (uI:iterID) (pI:calcID) tacis = neuper@37906: let val (p, (ptp,_)) = get_state uI pI neuper@37906: in states:= neuper@37906: overwrite2 ((!states), ((uI, pI), (p, (ptp, tacis)))) end;*) s1210629013@55445: fun upd_tacis (cI:calcID) tacis = Synchronized.change states s1210629013@55445: (fn s => case assoc (s, cI) of s1210629013@55445: NONE => s1210629013@55445: error ("upd_tacis: calctree " ^ (string_of_int cI) ^ " not existent") s1210629013@55445: | SOME ((ptp, _), us) => overwrite (s, (cI, ((ptp, tacis), us)))); neuper@37906: (*///7.10. neuper@37906: fun upd_ipos (uI:iterID) (pI:calcID) (ip:pos') = neuper@37906: let val (_, calc) = get_state uI pI neuper@37906: in states:= overwrite2 ((!states), ((uI, pI), (ip, calc))) end;*) wneuper@59276: fun upd_ipos (cI:calcID) (uI:iterID) (ip: Ctree.pos') = Synchronized.change states s1210629013@55445: (fn s => case assoc (s, cI) of s1210629013@55445: NONE => s1210629013@55445: error ("upd_ipos: calctree " ^ (string_of_int cI) ^ " not existent") s1210629013@55445: | SOME (cs, us) => overwrite2 (s, ((cI, uI), ip))); neuper@37906: neuper@37906: neuper@37906: (** add and delete calcs **) neuper@37906: neuper@37906: (*///7.10 neuper@37906: fun add_pID (uI:iterID) (s:state) (p:(iterID * (calcID * state) list) list) = neuper@37906: let val new_ID = get_calcID uI p; neuper@37906: val new_states = (the (assoc (p, uI))) @ [(new_ID, s)]; neuper@37906: in (new_ID, (overwrite (p, (uI, new_states)))) end;*) neuper@37906: (* neuper@37906: > val (new_calcID, new_states) = add_pID 1 (!states); neuper@37906: > states:= new_states; neuper@37906: > !states; neuper@37906: val it = [(3,[(#,#),(#,#)]),(4,[(#,#),(#,#)]),(1,[(#,#)])] : states neuper@37906: > val (new_calcID, new_states) = add_pID 3 (!states); neuper@37906: > states:= new_states; neuper@37906: > !states; neuper@37906: val it = [(3,[(#,#),(#,#),(#,#)]),(4,[(#,#),(#,#)]),(1,[(#,#)])] : states neuper@37906: > assoc2 (!states, (3, 1)); wneuper@59279: val it = SOME EmptyPtree : ctree option neuper@37906: > assoc2 (!states, (3, 2)); wneuper@59279: val it = NONE : ctree option neuper@37906: *) neuper@37906: (*///7.10 neuper@37906: fun add_calc (uI:iterID) (s:state) = neuper@37906: let val (new_calcID, new_calcs) = add_pID uI s (!states) neuper@37906: in states:= new_calcs; neuper@37906: new_calcID end; *) s1210629013@55445: fun add_user (cI:calcID) = Synchronized.change_result states s1210629013@55445: (fn s => case assoc (s, cI) of s1210629013@55445: NONE => s1210629013@55445: error ("add_user: calctree " ^ (string_of_int cI) ^ " not existent") s1210629013@55445: | SOME (cs, us) => s1210629013@55445: let s1210629013@55445: val new_uI = new_key us 1 wneuper@59276: in (new_uI:iterID, overwrite2 (s, ((cI, new_uI), Ctree.e_pos'))) end); neuper@37906: neuper@37906: (*///10.10. neuper@37906: fun del_calc (uI:iterID) (pI:calcID) = neuper@37906: (states:= del_assoc2 uI pI (!states); pI);*) s1210629013@55445: fun del_user (cI:calcID) (uI:iterID) = s1210629013@55445: Synchronized.change_result states (fn s => (uI, del_assoc2 cI uI s)); neuper@37906: neuper@37906: neuper@37906: (** add and delete calculations **) neuper@55469: neuper@55469: (* here is the _only_ critical section on states, neuper@55469: because a single calculation (with _one_ cI) is sequential *) wneuper@59265: fun add_calc (cs: Chead.calcstate) = Synchronized.change_result states s1210629013@55445: (fn s => s1210629013@55445: let val new_cI = new_key s 1 s1210629013@55445: in (new_cI:calcID, s @ [(new_cI, (cs, []))]) end); neuper@37906: neuper@37906: (* delete doesn't report non existing elements *) neuper@37906: (*///7.10 neuper@37906: fun del_user (uI:userID) = neuper@37906: (states:= del_assoc (!states, uI); uI);*) s1210629013@55445: fun del_calc (cI:calcID) = Synchronized.change_result states s1210629013@55445: (fn s => (cI:calcID, del_assoc (s, cI))); neuper@37906: neuper@37906: (* -------------- test all exported funs -------------- neuper@37906: ///7.10 neuper@37906: Compiler.Control.Print.printDepth:=8; neuper@37906: states:=[]; neuper@37906: add_user (); add_user (); !states; neuper@37906: ML> val it = 1 : userID neuper@37906: ML> val it = 2 : userID neuper@37906: ML> val it = [(1,[]),(2,[])] neuper@37906: neuper@37906: val (hide,detail) = ([(["pI"],["tac"],true)]:hide, neuper@37906: [(["pI"],["tac"],true)]:detail); neuper@37906: add_calc 1 e_state; neuper@37906: add_calc 1 (e_calcstate,(hide,detail)); !states; neuper@37906: ML> val it = 1 : calcID neuper@37906: ML> val it = 2 : calcID neuper@37906: ML> val it = neuper@37906: [(1, neuper@37906: [(1,(((EmptyPtree,(#,#)),[]),([],[]))), neuper@37906: (2,(((EmptyPtree,(#,#)),[]),([(#,#,#)],[(#,#,#)])))]),(2,[])] neuper@37906: neuper@37906: val (pt,(p,p_)) = (EmptyPtree,e_pos'); neuper@37906: val (pt,_) = cappend_problem pt p Uistate ([],e_spec); neuper@37906: upd_calc 1 2 ((pt,(p,p_)),[]); !states; neuper@37906: ML> val it = neuper@37906: [(1, neuper@37906: [(1,(((EmptyPtree,(#,#)),[]),([],[]))), neuper@37906: (2,(((Nd #,(#,#)),[]),([(#,#,#)],[(#,#,#)])))]),(2,[])] neuper@37906: (* ~~~~~~~~~~~~~~~~~~~~ unchanged !!!*) neuper@37906: neuper@37906: get_state 1 1; get_state 1 2; neuper@37906: ML> val it = (((EmptyPtree,([],Und)),[]),([],[])) : state neuper@37906: ML> val it = neuper@37906: (((Nd neuper@37906: (PblObj neuper@37906: {branch=NoBranch,cell=[],env=(#,#,#,#),loc=(#,#),meth=[], neuper@37906: model={Find=#,Given=#,Relate=#,Where=#,With=#},origin=(#,#), neuper@37906: ostate=Incomplete,probl=[],result=(#,#),spec=(#,#,#)},[]),([],Und)), neuper@37906: []),([(["pI"],["tac"],true)],[(["pI"],["tac"],true)])) : state neuper@37906: neuper@37906: del_calc 2 1 (*non existent - NO msg!*); del_calc 1 2; !states; neuper@37906: ML> val it = [(1,[(1,(((EmptyPtree,(#,#)),[]),([],[])))]),(2,[])] neuper@37906: neuper@37906: del_user 1; !states; neuper@37906: ML> val it = [(2,[])] neuper@37906: neuper@37906: add_user (); add_user (); !states; neuper@37906: ML> val it = 1 : userID neuper@37906: ML> val it = 3 : userID neuper@37906: ML> val it = [(2,[]),(1,[]),(3,[])] neuper@37906: *) neuper@37906: neuper@37906: neuper@37906: (* -------------- test all exported funs -------------- neuper@37906: print_depth 9; neuper@37906: states:=[]; neuper@37906: add_calc e_calcstate; add_calc e_calcstate; !states; neuper@37906: |val it = 1 : calcID neuper@37906: |val it = 2 : calcID neuper@37906: |val it = neuper@37906: | [(1, (((EmptyPtree, ([], Und)), []), [])), neuper@37906: | (2, (((EmptyPtree, ([], Und)), []), []))] neuper@37906: neuper@37906: add_user 2; add_user 2; !states; neuper@37906: |val it = 1 : userID neuper@37906: |val it = 2 : userID neuper@37906: |val it = neuper@37906: | [(1, (((EmptyPtree, ([], Und)), []), [])), neuper@37906: | (2, (((EmptyPtree, ([], Und)), []), [(1, ([], Und)), (2, ([], Und))]))] neuper@37906: neuper@37906: neuper@37906: val cs = ((EmptyPtree, ([111], Und)), []) : calcstate; neuper@37906: upd_calc 1 cs; !states; neuper@37906: |val it = neuper@37906: | [(1, (((EmptyPtree, ([111], Und)), []), [])), neuper@37906: | (2, (((EmptyPtree, ([], Und)), []), [(1, ([], Und)), (2, ([], Und))]))] neuper@37906: neuper@37906: get_calc 1; get_calc 2; neuper@37906: |val it = ((EmptyPtree, ([111], Und)), []) : calcstate neuper@37906: |val it = ((EmptyPtree, ([], Und)), []) : calcstate neuper@37906: neuper@37906: del_user 2 3 (*non existent - NO msg!*); del_user 2 1; !states; neuper@37906: |val it = 3 : userID neuper@37906: |val it = 1 : userID neuper@37906: |val it = neuper@37906: | [(1, (((EmptyPtree, ([111], Und)), []), [])), neuper@37906: | (2, (((EmptyPtree, ([], Und)), []), [(2, ([], Und))]))] neuper@37906: neuper@37906: del_calc 1; !states; neuper@37906: |val it = 1 : calcID neuper@37906: |val it = [(2, (((EmptyPtree, ([], Und)), []), [(2, ([], Und))]))] neuper@37906: neuper@37906: add_calc e_calcstate; add_calc e_calcstate; !states; neuper@37906: |val it = 1 : calcID neuper@37906: |val it = 3 : calcID neuper@37906: |val it = neuper@37906: | [(2, (((EmptyPtree, ([], Und)), []), [(2, ([], Und))])), neuper@37906: | (1, (((EmptyPtree, ([], Und)), []), [])), neuper@37906: | (3, (((EmptyPtree, ([], Und)), []), []))] neuper@37906: neuper@37906: add_user 2; !states; neuper@37906: |val it = neuper@37906: | [(2, (((EmptyPtree, ([], Und)), []), [(2, ([], Und)), (1, ([], Und))])), neuper@37906: | (1, (((EmptyPtree, ([], Und)), []), [])), neuper@37906: | (3, (((EmptyPtree, ([], Und)), []), []))] neuper@38007: *)