Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Lang.NEXT 2012 Expert Panel: Web and Cloud Programming (and more)
Apr 10, 2012 at 12:21 PM@Petr:
let aString = "string"
let stringResult = aString |> Seq.map (fun c -> Char.ToUpper(c)) // returns seq<char>, not String, not expected
let listResult = aString |> Seq.map(fun c -> int c) // returns seq<int> as expected
And in both cases you specifically had to point out the function that F# uses and you lost type information in the first case.
I don't agree with your comments on erasure & type classes. The reified types wouldn't help Scala one bit to achieve their collection library. (I'm not saying that reified types aren't usefull, just that they don't help here)
And I see now that by functional datastructures, they mean efficient persistent datastructures. So, does F# have datastructures (Lists, Sets, Maps) that are immutable and have a very efficient (close to O(1)) update and delete operations?
Lang.NEXT 2012 Expert Panel: Web and Cloud Programming (and more)
Apr 10, 2012 at 10:57 AM@Petr: You use Set.filter, that's cheating, can you write
let filtered = set |> filter (fun elm -> elm = 2)?
(you can in Haskell, but I don't think F# has type classes or type constructors)
In scala filter is implemented once, for all collections (of course some collections override & specialize for performance), it still supports the uniform return type principle and you don't need to tell it specifically what function it has to call.
In F# you have to reïmplement filter for all collections and then you still can't handle my last example with strings.
Lang.NEXT 2012 Expert Panel: Web and Cloud Programming (and more)
Apr 10, 2012 at 10:12 AM@Petr: Haskell, Ocaml, ml etc have functional datastructures as well but they don't apply the uniform return type principle in their collections.
In Scala the type of 'result' will be a Set[Int], in F# & C# it will be an IEnumerable. Scala is one of the few languages that has a type system that is powerfull enaugh to allow this trickery.
Of course Scala can have behave similarly as F# or C# if you want it to (aSet.iterator.filter... )
A more powerfull example:
http://www.scala-lang.org/docu/files/collections-api/collections_2.html