Feb. 14th, 2009

juan_gandhi: (Default)
At last started seriously working on the code. Love Scala.

(the following is a trivial validation code for a poset)
  def validate() {
    foreach((x: T) => {
      require(le(x, x), " reflexivity broken at " + x)
      foreach((y: T) => {
        if (le(x, y)) {
          if (le(y, x)) require(x.equals(y), " antisymmetry broken at " + x + ", " + y)
          foreach((z: T) => 
            if (le(y, z)) require(le(x, z), "transitivity broken at " + x + ", " + y + ", " + z)
          )
        }
      })
    })
  }

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14 151617 181920
212223 24252627
28 2930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 30th, 2025 06:58 am
Powered by Dreamwidth Studios