Hi Julien,

One of the things we're adding in the next release of F# is range enumerables, e.g.

1
2
3
4
5
6
7
8
9
10
 

let smallNumbers = { 0 .. 10 }

let lotsOfNumbers = { 0 .. 100000 }

let evens = { 0.0 .. 2.0 .. 100.0 }  // note: middle parameter is the 'skip'

let upperCase = { 'A' .. 'Z' }

These all have type IEnumerable<_>, which we often now abbreviate seq<'a> or 'a seq. e.g. int seq and char seq, float seq. This means you can do all the usual IEnumerable operations on these values (map, fold, filter, ...).

There will also be a comprehension notation. For example,

1
{ for x in 0 .. 10 -> (x,x*x) }

generates pairs of numbers and their squares as an IEnumerable<int*int> value.

We're planning to have the new release (1.1.13) out next week - the bits have been finalized, we now just have to put them through some more testing and quality gates and release them.

I'm sure you'll love these features - I've been pleasantly surprised how well they work, especially in conjunction with .NET libraries (of course people in other languages have been aware of the usefulness of a comprehension notation for many years the ML family of languages have always been reluctant adopters of new syntactic devices.)

Together these more of less subsume the operations in RangeOps. This means that module wil be deprecated and removed over time, and so is not really for direct use, though you're by all means welcome to copy out the simple code and use it.

-- don

By on 11/24/2006 6:12 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