The implmentation of size is correct. When you call size [1,2] you are passing it a list containing tuple of two intergers, this counts as one item, thus the result. What you probably wanted to do is "size [1;2];;". [1;2] is a list containing two items, because list items are seperated by ; not , .

Cheers, Rob

By on 11/17/2006 1:30 AM ()

Sorry missed the fact there was alread a reply ... had an early start this morning :(

By on 11/17/2006 1:33 AM ()

Hi Dan,

Lists are enumerated with ";". Tuples are constructed with ",". F# thinks that [1,2] is a list containing 1 tuple and therefore counts the size (as matched) as 1.

If you execute "size [ 1 ; 2 ];;" you should get the desired result of a size of 2.

HTH,

---O

By on 11/16/2006 2:18 PM ()

I see:

[1,2] is treated as an abbreviation for [(1,2)], rather than a synonym for [1;2].

Thanks!

-- Dan

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