Saturday, March 30, 2013

F# Slice

(In learning from "Programming F# 3.0, 2nd Edition")

Ruby's indexer can take range as parameter. In F#, Item property cannot do that. But, in F", GetSlice property cannot do that and it is called "Slice".

defining
member this.GetSlice(lowerBound : int option, upperBound : int option) =
  ...
accessing
xxx.[1..42]
xxx.[1..]
xxx.[..42]

Both two arguments are option type.

No comments:

Post a Comment