Show
Ignore:
Timestamp:
09/05/09 14:21:41 (3 months ago)
Author:
sukyoungryu
Message:

[disambiguator] Fixed handling getters and setters in ExprDisambiguator?. Fixed libraries and tests using getters.

Location:
trunk/ProjectFortress/demos
Files:
20 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/demos/ArrayListLong.fss

    r3550 r4130  
    2222assertStr[\T\](a:ZZ32, b:ZZ32, s:String, l: List[\T\]) = 
    2323  if a=/=b then 
    24     fail(a "=/=" b ": " s l.asString()) 
     24    fail(a "=/=" b ": " s l.asString) 
    2525  end 
    2626 
    2727assertStr[\T\](a:Boolean, s:String, l: List[\T\]) = 
    2828  if NOT a then 
    29     fail("Failed assertion: " s l.asString()) 
     29    fail("Failed assertion: " s l.asString) 
    3030  end 
    3131 
    3232assertStr[\T\](a:Boolean, s:String, l: List[\T\], r: List[\T\]) = 
    3333  if NOT a then 
    34     fail("Failed assertion: " s l.asString() " and " r.asString()) 
     34    fail("Failed assertion: " s l.asString " and " r.asString) 
    3535  end 
    3636 
     
    6464  ll : List[\ZZ32\] := l 
    6565  for i <- seq(0#sz) do 
    66       (e,ll0) = ll.extractLeft().get() 
     66      (e,ll0) = ll.extractLeft.get 
    6767      assertStr(e,i,"extractLeft wrong in ",ll) 
    68       assertStr(ll.left().get(),i,"left wrong in ",ll) 
     68      assertStr(ll.left.get,i,"left wrong in ",ll) 
    6969      ll := ll0 
    7070  end 
    71   assertStr(ll.isEmpty()," not empty after extractLeft(); it's ",ll) 
     71  assertStr(ll.isEmpty," not empty after extractLeft; it's ",ll) 
    7272  ll := l 
    7373  for i <- seq(1#sz) do 
    74       (ll0,e) = ll.extractRight().get() 
     74      (ll0,e) = ll.extractRight.get 
    7575      assertStr(e,sz-i,"extractRight wrong in ",ll) 
    76       assertStr(ll.right().get(),sz-i,"right wrong in ",ll) 
     76      assertStr(ll.right.get,sz-i,"right wrong in ",ll) 
    7777      ll := ll0 
    7878  end 
    79   assertStr(ll.isEmpty()," not empty after extractRight(); it's ",ll) 
     79  assertStr(ll.isEmpty," not empty after extractRight; it's ",ll) 
    8080end 
    8181 
     
    125125      chkPop(ivli,0,i,2) 
    126126      print(".") 
    127       rli=li.reverse() 
     127      rli=li.reverse 
    128128      for j <- 0#i do 
    129129          print(".") 
  • trunk/ProjectFortress/demos/BiCGSTAB.fss

    r3647 r4130  
    229229     excessive boundary checking. 
    230230     *) 
    231   r[i] := b[i] - c[i], i <- x.indices() 
     231  r[i] := b[i] - c[i], i <- x.indices 
    232232  c1 : RR64 := dot_product(r, r) (* r DOT r *) 
    233233 
    234234  label MainLoop 
    235235    if (c1 < er0) then exit MainLoop with () end 
    236     p[i] = r[i], i <- r.indices()  (* p = r *) 
    237     r'[i] = r[i], i <- r.indices() (* r' = r *) 
     236    p[i] = r[i], i <- r.indices  (* p = r *) 
     237    r'[i] = r[i], i <- r.indices (* r' = r *) 
    238238 
    239239(* 
     
    247247      c2 = dot_product(r', y) (* r' DOT y *) 
    248248      alp = c1 / c2 
    249       e[i] := r[i] - alp y[i], i <- r.indices() (* e = r - alp y *) 
     249      e[i] := r[i] - alp y[i], i <- r.indices (* e = r - alp y *) 
    250250      MatrixVectorProduct[\imax,jmax,kmax\](Ap,Ae,Aw,An,As,At,Ab,e,v) 
    251251      ev = dot_product(e, v) (* e DOT v *) 
     
    253253      (* We get ev=vv=0 when imax=jmax=kmax=2. Thus, we need to avoid NaN. *) 
    254254      c3 = if (vv=0) AND (ev=0) then 1 else ev / vv end 
    255       x[i] := x[i] + alp p[i] + c3 e[i], i <- x.indices() (* x = x + alp p + c3 e *) 
    256       r[i] := e[i] - c3 v[i], i <- e.indices() (* r = e - c3 v *) 
     255      x[i] := x[i] + alp p[i] + c3 e[i], i <- x.indices (* x = x + alp p + c3 e *) 
     256      r[i] := e[i] - c3 v[i], i <- e.indices (* r = e - c3 v *) 
    257257      rr := dot_product(r, r) (* r DOT r *) 
    258258      println(it " residual = " rr) 
     
    261261 
    262262      bet = c1 / (c2 c3) 
    263       p[i] := r[i] + bet (p[i] - c3 y[i]), i <- p.indices() (* p = r + bet (p - c3 y) *) 
     263      p[i] := r[i] + bet (p[i] - c3 y[i]), i <- p.indices (* p = r + bet (p - c3 y) *) 
    264264 
    265265      it += 1 
  • trunk/ProjectFortress/demos/Cfa.fss

    r3546 r4130  
    403403  println "Test Program:" 
    404404  if debug 
    405   then println (p.asString())// 
     405  then println (p.asString)// 
    406406  else println (p.toSource())// 
    407407  end 
     
    410410  result = (VDASH p).getValue() 
    411411  if debug 
    412   then println (indent result.asString())// 
     412  then println (indent result.asString)// 
    413413  else println (indent result.toSource())// 
    414414  end 
  • trunk/ProjectFortress/demos/DynamicSemantics.fss

    r3492 r4130  
    2323(* Runtime value ***************************************************************) 
    2424trait RuntimeValue comprises { Val, FnValue } 
     25  getter asString(): String 
    2526  getValue(): Value 
    26   asString(): String 
    2727  toSource(): String 
    2828end 
    2929 
    3030object Val(v: Value) extends RuntimeValue 
     31  getter asString() = v.asString 
    3132  getValue() = v 
    32   asString() = v.asString() 
    3333  toSource() = v.toSource() 
    3434end 
     
    3636object FnValue(fun: FnExpr, sigma: Map[\String, RuntimeValue\]) 
    3737  extends RuntimeValue 
     38  getter asString() = "(" fun.asString ", " sigma ")" 
    3839  getValue() = fun 
    39   asString() = "(" fun.asString() ", " sigma ")" 
    4040  toSource() = fun.toSource() 
    4141end 
  • trunk/ProjectFortress/demos/FeatherweightJava.fss

    r3645 r4130  
    4747 
    4848    label find 
    49       for i <- fields_v.indices() do 
     49      for i <- fields_v.indices do 
    5050        if n = fields_v[i].name then 
    5151          exit find with v.args[i] 
     
    9090(* Exprs *) 
    9191trait Expr 
     92  getter asString(): String 
    9293  isVal(): Boolean = false 
    9394  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr 
    9495    ensures { outcome.isVal() } 
    95   asString(): String 
    9696end 
    9797 
    9898object Var(x: String) extends Expr 
     99  getter asString(): String = x 
    99100  opr =(self, other: Var) = (x = other.x) 
    100   asString(): String = x 
    101101  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr = theta[x] 
    102102end 
    103103 
    104104object New(tag: Type, args: List[\Expr\]) extends Expr 
     105  getter asString() = "new " tag.asString <|[\String\] a.asString | a <- args|> 
     106 
    105107  isVal() = BIG AND[arg <- args] arg.isVal() 
    106108 
    107109  opr =(self, other: New) = 
    108     (tag = other.tag) AND (BIG AND[i <- args.indices()] args[i] = other.args[i]) 
    109  
    110   asString() = "new " tag.asString() <|[\String\] a.asString() | a <- args|> 
     110    (tag = other.tag) AND (BIG AND[i <- args.indices] args[i] = other.args[i]) 
    111111 
    112112  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr = 
     
    115115 
    116116object Proj(receiver: Expr, field: String) extends Expr 
     117  getter asString() = (receiver.asString "." field) 
     118 
    117119  opr =(self, other: Proj) = 
    118120    (receiver = other.receiver) AND (field = other.field) 
    119121 
    120   asString() = (receiver.asString() "." field) 
    121  
    122122  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr = 
    123123    CT_.field(cast[\New\](receiver.eval(CT_, theta)), field) 
     
    125125 
    126126object Invk(receiver: Expr, m_name: String, args: List[\Expr\]) extends Expr 
     127  getter asString() = (receiver.asString "." m_name args) 
     128 
    127129  opr =(self, other: Invk) = 
    128130    (receiver = other.receiver) AND (m_name = other.m_name) AND (args = other.args) 
    129  
    130   asString() = (receiver.asString "." m_name args) 
    131131 
    132132  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr = do 
     
    142142 
    143143object Cast(typ: Type, term: Expr) extends Expr 
     144  getter asString() = ("(" typ.asString ")" term.asString) 
     145 
    144146  opr =(self, other: Cast) = (typ = other.typ) AND (term = other.term) 
    145  
    146   asString() = ("(" typ.asString() ")" term.asString()) 
    147147 
    148148  eval(CT_: ClassTable, theta: Map[\String, Expr\]): Expr = do 
     
    156156(* Types *) 
    157157object Type(name: String) 
    158   asString() = name 
     158  getter asString() = name 
    159159  opr =(self, other:Type) = (name = other.name) 
    160160end 
     
    163163(* Syntactic Subcomponents *) 
    164164object Decl(typ: Type, name: String) 
    165   asString() = typ " " name ";" 
     165  getter asString() = typ " " name ";" 
    166166end 
    167167object Cons(tag: Type, params: List[\Decl\], 
  • trunk/ProjectFortress/demos/HeapShakedown.fss

    r3550 r4130  
    3636    end 
    3737    println( 
    38         BIG ||[(i,l) <- headers.indexValuePairs()] 
     38        BIG ||[(i,l) <- headers.indexValuePairs] 
    3939            //l (BIG ||[row <- data] "," row[i])) 
    4040  end 
    4141 
    4242checkFull(h0: Heap[\ZZ32,ZZ32\], n:ZZ32): () = 
    43     if h0.isEmpty() then 
     43    if h0.isEmpty then 
    4444        if NOT (n=0) then fail("empty with n=/=0") end 
    4545    else 
    4646        flags : Array[\Boolean,ZZ32\] = array[\Boolean\](n).fill(false) 
    47         (k:ZZ32, v:ZZ32, h:Heap[\ZZ32,ZZ32\]) := h0.extractMinimum().get() 
     47        (k:ZZ32, v:ZZ32, h:Heap[\ZZ32,ZZ32\]) := h0.extractMinimum().get 
    4848        k_prev : ZZ32 := k 
    4949        expected: ZZ32 := 1 
    5050        flags[v] := true 
    5151        failed : Boolean := false 
    52         while NOT h.isEmpty() AND expected <= n do 
    53             (k,v,h) := h.extractMinimum().get() 
     52        while NOT h.isEmpty AND expected <= n do 
     53            (k,v,h) := h.extractMinimum().get 
    5454            if k < k_prev then 
    5555                println("FAIL: Keys " k_prev " and " k " out of order.") 
     
    6363            expected += 1 
    6464        end 
    65         if NOT h.isEmpty() then 
     65        if NOT h.isEmpty then 
    6666            println("FAIL: Too many elements.") 
    6767            failed := true 
     
    7474            expected := 0 
    7575            println(h.asDebugString) 
    76             while NOT h.isEmpty() AND expected <= n do 
    77                 (k,v,h) := h.extractMinimum().get() 
     76            while NOT h.isEmpty AND expected <= n do 
     77                (k,v,h) := h.extractMinimum().get 
    7878                println(expected ": min = (" k "," v ")") 
    7979                println(h.asDebugString) 
     
    106106    assert(n,sz," size versus computed size") 
    107107    if (sz > 0) then 
    108         (mn_k, mn_v) = h.minimum().get() 
    109         assert(mn,mn_k," computed minimum versus .minimum()") 
     108        (mn_k, mn_v) = h.minimum.get 
     109        assert(mn,mn_k," computed minimum versus .minimum") 
    110110    end 
    111111  end 
     
    175175            appending[\RR64\]( 
    176176              <| 1.0 s, s lg s |>, 
    177               testHeap(s,lazy[\ZZ32,ZZ32\],(0#s).indexValuePairs()), 
     177              testHeap(s,lazy[\ZZ32,ZZ32\],(0#s).indexValuePairs), 
    178178              testHeap(s,lazy[\ZZ32,ZZ32\],(0#s).map[\(ZZ32,ZZ32)\](spread)), 
    179               testHeap(s,pairing[\ZZ32,ZZ32\],(0#s).indexValuePairs()), 
     179              testHeap(s,pairing[\ZZ32,ZZ32\],(0#s).indexValuePairs), 
    180180              testHeap(s,pairing[\ZZ32,ZZ32\],(0#s).map[\(ZZ32,ZZ32)\](spread)) 
    181181        ))) 
  • trunk/ProjectFortress/demos/Lambda.fss

    r3663 r4130  
    245245            ')'  => fail ("unexpected ')' in arg list, last arg " id) 
    246246            else => if isDigit(curr) then 
    247                         fail ("unexpected digit " curr.asString() " in arg list") 
     247                        fail ("unexpected digit " curr.asString " in arg list") 
    248248                    else 
    249249                        mkLambda(id,parseLambdaF(newlineOK)) 
     
    259259        r = parseReqTerm(true) 
    260260        if curr=/=')' then 
    261             fail("unexpected terminator " curr.asString() ", expected ')'") 
     261            fail("unexpected terminator " curr.asString ", expected ')'") 
    262262        end 
    263263        skip(newlineOK) 
  • trunk/ProjectFortress/demos/PureListLong.fss

    r3550 r4130  
    2222assertStr[\T\](a:ZZ32, b:ZZ32, s:String, l: List[\T\]) = 
    2323  if a=/=b then 
    24     fail(a "=/=" b ": " s l.asString()) 
     24    fail(a "=/=" b ": " s l.asString) 
    2525  end 
    2626 
    2727assertStr[\T\](a:Boolean, s:String, l: List[\T\]) = 
    2828  if NOT a then 
    29     fail("Failed assertion: " s l.asString()) 
     29    fail("Failed assertion: " s l.asString) 
    3030  end 
    3131 
    3232assertStr[\T\](a:Boolean, s:String, l: List[\T\], r: List[\T\]) = 
    3333  if NOT a then 
    34     fail("Failed assertion: " s l.asString() " and " r.asString()) 
     34    fail("Failed assertion: " s l.asString " and " r.asString) 
    3535  end 
    3636 
     
    6464  ll : List[\ZZ32\] := l 
    6565  for i <- seq(0#sz) do 
    66       (e,ll0) = ll.extractLeft().get() 
     66      (e,ll0) = ll.extractLeft.get 
    6767      assertStr(e,i,"extractLeft wrong in ",ll) 
    68       assertStr(ll.left().get(),i,"left wrong in ",ll) 
     68      assertStr(ll.left.get,i,"left wrong in ",ll) 
    6969      ll := ll0 
    7070  end 
    71   assertStr(ll.isEmpty()," not empty after extractLeft(); it's ",ll) 
     71  assertStr(ll.isEmpty," not empty after extractLeft; it's ",ll) 
    7272  ll := l 
    7373  for i <- seq(1#sz) do 
    74       (ll0,e) = ll.extractRight().get() 
     74      (ll0,e) = ll.extractRight.get 
    7575      assertStr(e,sz-i,"extractRight wrong in ",ll) 
    76       assertStr(ll.right().get(),sz-i,"right wrong in ",ll) 
     76      assertStr(ll.right.get,sz-i,"right wrong in ",ll) 
    7777      ll := ll0 
    7878  end 
    79   assertStr(ll.isEmpty()," not empty after extractRight(); it's ",ll) 
     79  assertStr(ll.isEmpty," not empty after extractRight; it's ",ll) 
    8080end 
    8181 
     
    125125      chkPop(ivli,0,i,2) 
    126126      print(".") 
    127       rli=li.reverse() 
     127      rli=li.reverse 
    128128      for j <- 0#i do 
    129129          print(".") 
  • trunk/ProjectFortress/demos/Syntax.fsi

    r1969 r4130  
    2525trait Ast 
    2626  getId(): ZZ32 
    27   toString(): String 
     27  asString(): String 
    2828  toSource(): String 
    2929end 
  • trunk/ProjectFortress/demos/Syntax.fss

    r3237 r4130  
    2929(* abstract syntax tree *) 
    3030trait Ast 
     31  getter asString(): String 
    3132  getId(): ZZ32 
    32   asString(): String 
    3333  toSource(): String 
    3434end 
     
    3838object Program(decls: List[\FnDecl\], expr: Expr) extends Ast 
    3939  id = nextId() 
     40  getter asString() = 
     41    (BIG //[d <- decls] (indent d.asString)) // // indent expr.asString 
     42 
    4043  getId() = id 
    41  
    42   asString() = 
    43     (BIG //[d <- decls] (indent d.asString())) // // indent expr.asString() 
    4444 
    4545  toSource() = 
     
    5151object FnDecl(name: String, param: String, body: Expr) extends Ast 
    5252  id = nextId() 
     53  getter asString() = name "_" id "(" param ") = " body.asString 
    5354  getId() = id 
    54   asString() = name "_" id "(" param ") = " body.asString() 
    5555  toSource() = name        "(" param ") = " body.toSource() 
    5656end 
     
    6666object Var(name: String) extends Expr 
    6767  id = nextId() 
     68  getter asString() = name "_" id 
    6869  getId() = id 
    69   asString() = name "_" id 
    7070  toSource() = name 
    7171end 
     
    7373object App(function: Expr, argument: Expr) extends Expr 
    7474  id = nextId() 
     75  getter asString() = function.asString "(_" id " " argument.asString ")" 
    7576  getId() = id 
    76   asString() = function.asString() "(_" id " " argument.asString() ")" 
    7777  toSource() = function.toSource() "("         argument.toSource() ")" 
    7878end 
     
    8080object If(cond: Expr, thenB: Expr, elseB: Expr) extends Expr 
    8181  id = nextId() 
     82  getter asString() = 
     83    ("if_" id " " cond.asString "\n" indent "then " thenB.asString "\n" 
     84     indent "else " elseB.asString "\n" indent "end") 
    8285  getId() = id 
    83   asString() = 
    84     ("if_" id " " cond.asString() "\n" indent "then " thenB.asString() "\n" 
    85      indent "else " elseB.asString() "\n" indent "end") 
    8686  toSource() = 
    8787    ("if  "   " " cond.toSource() "\n" indent "then " thenB.toSource() "\n" 
     
    9898object FnExpr(param: String, body: Expr) extends Value 
    9999  id = nextId() 
     100  getter asString() = "fn_" id " " param " => " body.asString 
    100101  getId() = id 
    101   asString() = "fn_" id " " param " => " body.asString() 
    102102  toSource() = "fn"     " " param " => " body.toSource() 
    103103end 
     
    105105object True extends Value 
    106106  id = nextId() 
     107  getter asString() = "true" 
    107108  getId() = id 
    108   asString() = "true" 
    109   toSource() = asString() 
     109  toSource() = self.asString 
    110110end 
    111111 
    112112object False extends Value 
    113113  id = nextId() 
     114  getter asString() = "false" 
    114115  getId() = id 
    115   asString() = "false" 
    116   toSource() = asString() 
     116  toSource() = self.asString 
    117117end 
    118118 
  • trunk/ProjectFortress/demos/aStar.fss

    r3663 r4130  
    316316sudoku(compact:String): Sudoku = do 
    317317    st0 = emptySudoku() 
    318     for n<-compact.bounds() do 
     318    for n<-compact.bounds do 
    319319        i=n DIV 9 
    320320        j=n REM 9 
  • trunk/ProjectFortress/demos/newtictactoe.fss

    r4015 r4130  
    3131 
    3232object IllegalMove(n) extends Exception 
    33     asString() = "Illegal move at " n 
     33    getter asString() = "Illegal move at " n 
    3434end 
    3535 
     
    4343(* Represents the tic-tac-toe board *) 
    4444object Board(N: ZZ32, locs: List[\Maybe[\String\]\]) 
     45 
     46    getter asString() = BIG || [i <- 0#N] ((if i=0 then "" else (("+---")^N)[1:] "\n" end) || renderRow(i)) 
    4547 
    4648    (*) A board may be indexed by a move number from 1 to `N^2`. 
     
    6163 
    6264    renderRow(i: ZZ32) = BIG || [j <- 0#N] (squareLabel(i, j) || (if j=N-1 then "\n" else "|")) 
    63  
    64     asString() = BIG || [i <- 0#N] ((if i=0 then "" else (("+---")^N)[1:] "\n" end) || renderRow(i)) 
    6565 
    6666    (*) `BIG SQCUP`: if there is one winner, you get `Just` that winner. 
  • trunk/ProjectFortress/demos/posFeedback.fss

    r3550 r4130  
    130130    getter asString(): String = 
    131131        ("Entity(" positivity ", [" known[0] " " known[1] "]) t = " time // 
    132          facts.asString()) 
     132         facts.asString) 
    133133 
    134134    otherResult(result: ZZ32): ZZ32 = 1 - result 
  • trunk/ProjectFortress/demos/sudoku.fss

    r3550 r4130  
    7070      for i <- 0#9, j<- 0#9 do 
    7171         if |board[i,j]| = 1 then 
    72             elem = board[i,j].minimum().get() 
     72            elem = board[i,j].minimum.get 
    7373            propagateSingleton(board, i, j, elem) 
    7474         else 
     
    9292                             init init {5}  init {1}  init init {9}  init; 
    9393                             {9}  init {7}  {8}  init {4}  {6}  init {2} ] 
    94    println(board.asString()) 
     94   println(board.asString) 
    9595   println("Starting parallel sudoku solver") 
    9696   recordTime(6.847) 
    9797   propagate(board) 
    9898   printTime(6.847) 
    99    println(board.asString()) 
     99   println(board.asString) 
    100100end 
    101101end 
  • trunk/ProjectFortress/demos/tennisRanking.fss

    r3645 r4130  
    136136  played:Map[\String,Map[\String,String\]\] := {[\String,Map[\String,String\]\]} 
    137137 
     138(* asString() returns the following: 
     139     ranking  name  totalWon / totalLost (thisWon / thisLost)  totalgames (thisGames)  totalPoints (thisPoints) 
     140 *) 
     141  getter asString():String = (twoToStr ranking) "  " (tostring()) 
     142 
    138143  (* Has played a singles game with this player? *) 
    139144  playedSingle(against: String) = 
    140145    do 
    141146      againstGames = played.member(against) 
    142       againstGames.holds() AND: againstGames.get().member("").holds() 
     147      againstGames.holds AND: againstGames.get.member("").holds 
    143148    end 
    144149 
     
    150155      then if against1' <- withGames.member(against1) 
    151156           then (against1' = against2) 
    152            else withGames.member(against2).holds() AND: 
    153                 (withGames.member(against2).get() = against1) 
     157           else withGames.member(against2).holds AND: 
     158                (withGames.member(against2).get = against1) 
    154159           end 
    155160      else false end 
     
    182187  tostring():String = 
    183188    name "    " (twoToStr totalWon) " / " totalLost " (" thisWon " / " thisLost ")      " (totalWon+totalLost) " (" (thisWon+thisLost) ")       " totalPoints " (" thisPoints ")"// 
    184  
    185 (* asString() returns the following: 
    186      ranking  name  totalWon / totalLost (thisWon / thisLost)  totalgames (thisGames)  totalPoints (thisPoints) 
    187  *) 
    188   asString():String = (twoToStr ranking) "  " (tostring()) 
    189189 
    190190(* asStringTie() does not return the ranking *) 
     
    300300    init(name, 0, 0, 0, if old then oldPoints else 1000 end) 
    301301    numPlayers += 1 
    302     database.member(name).get() 
     302    database.member(name).get 
    303303  end 
    304304 
     
    380380  println msg' 
    381381  if debugOut.holds 
    382   then debugOut.get().println(msg') 
    383        debugOut.get().close() 
     382  then debugOut.get.println(msg') 
     383       debugOut.get.close() 
    384384  end 
    385385  fail "end" 
     
    504504    ranking: ZZ32 := 1 
    505505    (* the points of the previous player *) 
    506     points : ZZ32 := database.member(top).get().totalPoints + 10 
     506    points : ZZ32 := database.member(top).get.totalPoints + 10 
    507507    for i <- seq(0#numPlayers) do 
    508508      (_,v) = arr[i] 
    509       player = database.member(v).get() 
     509      player = database.member(v).get 
    510510      (* print a player with the new ranking result *) 
    511511      if player.totalPoints = points 
     
    513513           fout.print(player.asStringTie()) 
    514514      else player.ranking := i+1; ranking := i+1; points := player.totalPoints 
    515            fout.print(player.asString()) 
     515           fout.print(player.asString) 
    516516      end 
    517517      (* find MVP players *) 
     
    534534    for i <- seq(0#numPlayers) do 
    535535      (_,v) = arr[i] 
    536       player = database.member(v).get() 
     536      player = database.member(v).get 
    537537      if player.preRanking - player.ranking = mip 
    538538      then mipPlayers := mipPlayers.addLeft(player.name) end 
     
    549549    (* print MIP players and their old and new rankings *) 
    550550    mipRec(p:String): String = do 
    551         player = database.member(p).get() 
     551        player = database.member(p).get 
    552552        (" " player.name 
    553553         " (ranking " player.preRanking " => " player.ranking ")") 
  • trunk/ProjectFortress/demos/tictactoe.fss

    r4015 r4130  
    3434 
    3535object IllegalMove(n) extends Exception 
    36     asString() = "Illegal move at " n 
     36    getter asString() = "Illegal move at " n 
    3737end 
    3838 
     
    4242(* 
    4343opr [n:ZZ32](z:List) = 
    44     z.take(n).drop(n-1).left().get() 
     44    z.take(n).drop(n-1).left.get 
    4545*) 
    4646 
    4747(* Returns nth element of a list *) 
    4848element(z:List[\ZZ32\], n:ZZ32) = 
    49     z.take(n+1).right().get() 
     49    z.take(n+1).right.get 
    5050 
    5151(* Replaces the index-th element with val *) 
     
    6262(* Represents the tic-tac-toe board *) 
    6363object Board(rows) 
    64     asString() = do 
     64    getter asString() = do 
    6565        var all:String = "" 
    6666        for y <- seq(0#boardSize) do 
     
    156156        who = all.filter(fn i => i =/= 0) 
    157157        if |who| > 0 then 
    158             who.left().get() 
     158            who.left.get 
    159159        else 
    160160            0 
  • trunk/ProjectFortress/demos/trips.fss

    r3550 r4130  
    5656object trip (a:ZZ32, b:ZZ32, c:ZZ32) 
    5757    extends StandardTotalOrder[\trip\] 
     58    getter asString():String = "[trip " a " " b  " " c "]" 
    5859    opr CMP(self, other:trip):TotalComparison = 
    5960        (a CMP other.a) LEXICO (b CMP other.b) LEXICO (c CMP other.c) 
    60     asString():String = "[trip " a " " b  " " c "]" 
    6161end trip 
    6262 
     
    103103object generator(doc:String, max:ZZ32, fun:ZZ32->List[\trip\]) 
    104104    extends StandardTotalOrder[\trip\] 
     105    getter asString():String = "[generator " doc " max: " max "]" 
    105106    opr CMP(self, other:generator):TotalComparison = doc CMP other.doc 
    106     asString():String = "[generator " doc " max: " max "]" 
    107107end generator 
    108108 
  • trunk/ProjectFortress/demos/turnersParaffins0.fss

    r3550 r4130  
    9191(* H objects are the leaves of the trees.*) 
    9292object H extends Radical 
     93    getter asString():String = "H" 
    9394    opr CMP(self, other:Radical):TotalComparison = 
    9495        typecase other of 
     
    99100    opr |self|:ZZ32 = 0 
    100101    canonical():Boolean = true 
    101     asString():String = "H" 
    102102end H 
    103103 
    104104(* Rad objects are the internal nodes of the trees.*) 
    105105object Rad (r1:Radical, r2:Radical, r3:Radical) extends Radical 
     106    getter asString():String = 
     107        case self of 
     108            methyl => "M";  ethyl  => "E"; propyl => "p3" 
     109            butyl  => "b4"; pentyl => "p5" 
     110            y3 => "y3"; t4 => "t4"; y4 => "y4"; z4 => "z4" 
     111            else => "[R " r1 " " r2 " " r3 " ]" 
     112        end 
    106113    opr CMP(self, other:Radical):TotalComparison = 
    107114        typecase other of 
     
    114121    opr |self|:ZZ32 = 1 + |r1| + |r2| + |r3| 
    115122    canonical():Boolean = r1 <= r2 <= r3 
    116     asString():String = 
    117         case self of 
    118             methyl => "M";  ethyl  => "E"; propyl => "p3" 
    119             butyl  => "b4"; pentyl => "p5" 
    120             y3 => "y3"; t4 => "t4"; y4 => "y4"; z4 => "z4" 
    121             else => "[R " r1 " " r2 " " r3 " ]" 
    122         end 
    123123end Rad 
    124124 
     
    282282object Paraffin (r1:Radical, r2:Radical, r3:Radical, r4:Radical) 
    283283    extends StandardTotalOrder[\Paraffin\] 
     284    getter asString():String = "[P " r1 " " r1 " " r3 " " r4 " ]" 
    284285    opr CMP(self, other:Paraffin):TotalComparison = 
    285286        (r1 CMP other.r1) LEXICO: 
     
    303304    (* The following are for debugging and for testing. *) 
    304305    opr |self|:ZZ32 = 1 + |r1| + |r2| + |r3| + |r4| 
    305     asString():String = "[P " r1 " " r1 " " r3 " " r4 " ]" 
    306306end Paraffin 
    307307 
  • trunk/ProjectFortress/demos/wordcount.fss

    r3664 r4130  
    4545    var start:ZZ32 := 0 
    4646 
    47     while (current < s.size()) do 
     47    while (current < s.size) do 
    4848        if isDelimiter(s[current]) then 
    4949           count := count - 1 
     
    9898    time("Acquired words",start,acq) 
    9999    var invDatabase:Map[\ZZ32,List[\String\]\] = 
    100         BIG UNIONUNION [(x,y) <-database] makeInv(x.asString(),y) 
     100        BIG UNIONUNION [(x,y) <-database] makeInv(x.asString,y) 
    101101    inv = nanoTime() 
    102102    time("Inverted database",acq,inv) 
  • trunk/ProjectFortress/demos/wordcount2.fss

    r4016 r4130  
    120120    time("Acquired words",start,acq) 
    121121    invDatabase:Map[\ZZ32,List[\String\]\] = 
    122         BIG UNIONUNION [(x,y) <-database] makeInv(x.asString(),y) 
     122        BIG UNIONUNION [(x,y) <-database] makeInv(x.asString,y) 
    123123    inv = nanoTime() 
    124124    time("Inverted database",acq,inv) 
    125     entries = <|[\(ZZ32, List[\String\])\] (c,m) | (c,m) <- invDatabase.reverse() |> 
     125    entries = <|[\(ZZ32, List[\String\])\] (c,m) | (c,m) <- invDatabase.reverse |> 
    126126    for (c,m) <- seq(entries[0#100]) do 
    127127        println(m ": " c " times")