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

August 2025

S M T W T F S
      12
3456789
10 11 12 13141516
171819 20212223
2425 26272829 30
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 2nd, 2025 04:57 am
Powered by Dreamwidth Studios