Advertisement
Guest User

Untitled

a guest
Oct 8th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.39 KB | None | 0 0
  1. type array<'t, 'ndims> =
  2.     {
  3.         nrows : int
  4.         ncols : int
  5.     }
  6.  
  7. type ndims2 =
  8.     static member index (a:array<_, ndims2>) =
  9.         let indexImpl (i:int, j:int) = i + j*a.nrows
  10.         indexImpl
  11.  
  12. let inline indexer (a:array<_, 'ndims>) =
  13.    (^ndims : (static member index : array<_, ^ndims> -> _) a)
  14.  
  15. let x : array<float, ndims2> = {nrows = 2; ncols = 2}
  16. let i = indexer x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement