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

November 2025

S M T W T F S
       1
2345678
9101112131415
16171819202122
23242526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Nov. 2nd, 2025 05:08 am
Powered by Dreamwidth Studios