//
//
// This file is for Assignment 4, BU CAS CS 520, Fall, 2008
//
//

(* ****** ****** *)

// An implementation of random-access list based on nested datatypes

(* ****** ****** *)

staload "ralist.sats"

(* ****** ****** *)

fun ralist_last {a:type} {n:pos} .<n>. (xs: ralist (a, n)):<> a =
  case+ xs of
  | RAone x => x
  | RAevn xxs => let
      val xx = ralist_last {P a a} xxs in xx.1
    end // end of [RAevn]
  | RAodd (_, xxs) => let
      val xx = ralist_last {P a a} xxs in xx.1
    end // end of [RAodd]
// end of [ralist_last]

(* ****** ****** *)

(* end of [ralist.dats] *)