Apparently, but you need to escape the brackets:

1
2
3
4
5
6
7
8
9
10
11
 

> type 'a ``[,]`` with member x.HowLong = Array2.length1 x;;

> let x = Array2.create 1 2 3;;

val x : int [,]

> x.HowLong;;
val it : int = 1
By on 4/20/2009 11:14 AM ()

thanks Michael. Didn't manage to find this in the spec - do you have a link?

I hope this awkward syntax is ironed out in the Beta.

regards,

Danny

By on 4/21/2009 1:25 AM ()

Under section 3.4 Identifiers and Keywords it states you have to wrap an identifier with an unusual name in ``, i.e. non ident-text as specified by the token ident spec in the table.

If you look in prim-types.fs you can see at the top multi-dimensional arrays defined as:

1
2
3
4
5
6
type 'a ``[]`` = (* inline IL code *)

type 'a ``[,]`` = (* inline IL code *)

type 'a ``[,,]`` = (* inline IL code *)

Hope that helps explain the `` notation.

By on 4/22/2009 5:43 PM ()

I should add, prim-types.fs is found under (F# install directory)\source\fsharp\FSharp.Core\

By on 4/22/2009 5:46 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper