F# slicing array by indices array

How can I overload .[] for F# array to slice an array based on an arbitrary index array?

For example:

let x = [|1..10|]; 
let indx = [|4;1|];


[| for i in indx ->x.[i]|] 

would work, it would be nicer to be able using x.[indx] directly.


You can always write an F# extension method to get close on the syntax

let a = [| 1..10 |]
let idx = [|4;1|]

type 'T ``[]`` with   //'
    member this.Slice(indices:int array) =
        [| for i in indices -> this.[i] |]

printfn "%A" (a.Slice idx)

but since arrays already have an indexer it doesn't appear there's a way to overload/change it.

Need Your Help

How can we reduce the property proxying overhead of NHibernate?

performance nhibernate fluent-nhibernate proxy castle-dynamicproxy

We are using Fluent NHibernate and NHibernate to map our properties to columns in the database. Here is an abbreviated sample of one of our ClassMaps:

Using Properties with Spring

java spring properties

I have few properties in my Properties file like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.