Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Don Syme: Introduction to F#, Part 2

Download

Right click “Save as…”

The conversation Mike Hall recently had with Don Syme, a researcher at MSR Cambridge who focuses on language development and is the key author of F#, continues. (See Part 1 here)

And there's a lot of code in this one. Put your study caps on.

Check out Don's blog!

Tags:

Follow the Discussion

  • ChadkChadk excuse me - do you has a flavor?
    Wow, bloody hell. My eyes Perplexed
    That is SO confusing.
  • The F# console window in Visual Studio looks great.  The code snippets at the start helped a lot.  But the interactive simulation around the 18 minute mark was what really surprised me.
  • Tommy CarlierTommyCarlier Widen your gaze
    Great video. Nice combination of interview and demo.
  • andrzejandrzej XNA Rocks!!!!
    awesome!!! the directx script is fascinating. where can i get it?
  • The DirectX donuts demo is available on The HubFS--the F# community site: http://cs.hubfs.net/forums/thread/95.aspx
  • ChadK: Which part is confusing? Let's break it down!

  • ChadkChadk excuse me - do you has a flavor?
    coonsta wrote:
    

    ChadK: Which part is confusing? Let's break it down!


    I think that the start, moved too fast on. Really, the code seemed nonsense to me.

    The Part 1, with the hello world seemed fine. No ;, i like!

    The way you select things you want  to run 6 minuts into the vidoe is quite cool, for debugging purposes, and in the case its used, where you show what impact each cal do.

    What is the language aimed for? Scripting? Or is is supposed to be an anlternative to C#?

    The lamda stuff with the events seemed cool. YET i think, like in some of the other stuff, just seemed comfusing, with all the strange characters that is use, like in the line containing the event with the lambda stuff, where did the "_" come from?

    I think it was confusing for me, because theres so many characters like -, >, <, _ all over the place. In C#, to compare it with a language i know good, have an acceptable amount of that.

    Part 4 seemed even more confusing.

  • ChadK: assuming they use the same syntax as ML, the "_" just means ignore this argument.

    for example in:
    renderer.DrawScene.Add(fun _ -> bla bla...

    renderer.DrawScene.Add takes a function as an argument, which itself takes an argument. So they pass an anonymus function, but since this function won't use it's argument, they don't give it a name.. just a _.

    It is supposed to help with clearity when reading the code. had they written "fun x -> bla bla..." you might think, "what's this x? it doesn't seem to get used". Instead you put a "_" indicating that you are only accepting an argument to appease the type checker.
  • Does the .net CLR support proper tail calls?
    I believe that was a problem for som developers, who were working on a ML compiler for the Java VM.

  • ktrktr two sides to everything
    that's incredible. you can really see the power when he starts piping functions to each other. i also like how almost anything can be declared inline. its so free flowing. i love it. it reminds me of my calculus classes somehow..... hmm.. perhaps its the "let x =" lol
  • nedned
    So, what's in the display case behind Don?
  • mikehallmikehall Mike
    Don came over to the building I work in which houses some of the Mobile and Embedded devices group (MED) - My office was full of embedded hardware, so there wasn't much room to film the video, so we ended up filming the interview in one of our conference rooms which has a display of mobile and embedded devices.

    Let me know if you want to get a walkthrough of the breadth of Windows Mobile devices that are shipping these days!

    - Mike
  • That was so PROFOUND.

    I'm a long-time DirectX developer and a recent functional programming nutcase, and I was already excited to try F# before seeing this. Seeing this interactive demo knocked my socks off. There is amazing potential behind interactive simulations like this--experimenting with various renderers, techniques and even engines interactively can immensely speed up development and tweaking--you always have to tweak settings to make things look right. With this interactivity, you no longer have to build a special GUI for tweakability.

    And physics! Tweaking physics parameters on the fly and observing their effects. Ow, what a bucket of PURE joy.

    Fun days ahead!
  • Berre wrote:
    Does the .net CLR support proper tail calls?
    I believe that was a problem for som developers, who were working on a ML compiler for the Java VM.


    Yep, the CLR has a tail call instruction, but mono does not, or at least didn't last time I checked. There is a compiler switch to turn tail call off so you can create mono comptable F# code.
  • AdelinoAdelino Adelino
    PLEASE please please no more auto-focus... there is a manual option to focus... you can do it manually.
    I skiped the first part because I can't handle the go on focus and out of focus...
  • why language is named F#, i mean why not just F or other name?
  • Do you plan to add to F# something like http://nemerle.org/Macros_tutorial - nice compile time code transformation/generation
  • Am I missing the point here? F# is a massive step backwards! What is the point of it?
     
    Lots of the syntax was different just for the sake of it. Why use "open" to reference a namespace instead of the far more intuitive "include" or "using"? What's with the return of "let"?! Why use "<-" instead of "=" - all different for the sake of it.

    The 'coolness' of the demos wasn't F#, it was managed DirectX - which tells us a lot!

    Perhaps I'm just not getting it, but F# seemed to be the quickest way to write reams of unreadable and unmanagable code.
     
    A solution looking for a problem.
  • Ahh, this takes me back to the Msc days.

    I occasionally thinks that a functional language might be helpful to create correct and effective programs that uses multi-core CPUs. This is because a "pure" functional language doesn't allow side-effects (modifying a member variable is a side effect).


    FYI: Ericsson (you know the mobile phones) developed a functional language that they still use in their AXE line AFAIK.

    http://en.wikipedia.org/wiki/Erlang_programming_language

    Guaranteeing correctness is as far as I remember also one of the functional languages strong points.

    Btw. a simple F# to solve the problems of the game tower of hanoi:

    let rec hanoi n x y z =
    match n with
    | 0 -> []
    | d -> List.append (hanoi (d-1) x z y) ((x,y)::(hanoi (d-1) z y x));;

    hanoi 2 1 2 3;;

    becomes

    [(1, 3); (1, 2); (3, 2)]

    Ie. for 2 bricks move brick from pin 1 to pin 3, from pin 1 to pin 2 and finally from pin 3 to pin 2.

  • Ion Todirel wrote:
    why language is named F#, i mean why not just F or other name?


    I think this is a nerdy in-joke; I'm sure Don can correct me if I'm wrong: F#'s theoretical roots are the polymorphic, typed lambda calculus, otherwise known as System F. (Sounds kinda like Plan 9 From Outer Space to me.) Of course, to be .NET hip you have to be something-sharp, hence system F + # = F#.
  • Chadk wrote:
    What is the language aimed for? Scripting? Or is is supposed to be an anlternative to C#?


    F# is a general-purpose language so there are a lot of programs you would write in either F# or C#. Outside of the mainstream, F# and C# both have some specific niches where they excel: F# is great for writing compilers and mathsy stuff; C# has more of a systems programming feel--munging with pointers, structs and unsafe code.

    In my experience F# is much more succinct than C#. That, with features like Python-style whitespace indentation and type inference, make F# feel much more "scripting" than C# does.
  • orcmidorcmid Orcmid as Apparition
    I've been carrying these two videos around on my laptop since they were posted, and I finally watched them today.  (I carried the F# 1.1.11.7 distro around longer but started getting into it last week with 1.1.12.3, the one with #light -- #white in the demo.)

    The comments are almost as good as the videos.   I agree that the demos move quickly and the camera focusing and panning can be tough.  As I recall, the demo at lang.net was more difficult because we couldn't see what Don was typing, just the results (and don't trust my memory for that).

    The comments are also very useful in showing where the unfamiliar or the dissonant show up for people. 

    I've wanted to get back into the cockpit of a functional language for some time now, and it was easy to settle on F# as a place to start.  My selection was motivated around its roots in ML and OCaml, which I want to know more about.  And more than that, having the F# system be grounded on .NET provides yet another avenue to making use of all of the libraries and functions available on the CLI.  It is sort of a nothing-to-loose investment and I can use F# where it covers a sweet spot for me, and use other programming systems when that's more appropriate.

    As long as it runs on the CLI and inter-working of components works between F# and other .NET languages, this strikes me as very useful.  So that's a bonus, for me, over firing up a Scheme compiler or some other not-yet-.NET functional language.
  • Hi Andy,

    Most of the unusual syntax (open, let, <-, =, etc.) comes from Ocaml. The intersection of Ocaml and F# is large enough that you can write significant programs using only that subset and compile them as MSIL, Ocaml byte code, and Ocaml native code. In fact, this is how the F# compiler was bootstrapped: The F# compiler started life as an Ocaml program.

    As language features are added to F# they tend to be very .NET-oriented, so the full F# language is definitely a new .NET language and not just an Ocaml variant.

    F# syntax is fairly different from C#, and that can be overwhelming initially. To get a good feel for the language, why not look at the F# samples and try to write some toy programs? When you see something that feels foreign you're probably looking at an F# idiom that doesn't exist in C#. Sometimes in those seemingly dark corners lie the really cool differences between C# and F#.

    Once you have some familiarity with the F# and aren't just stumbling over syntax, try writing some bigger examples. Maybe write something in C#, then in F#; then try another problem first in F# and then in C#. This is a good way to appreciate the difference between C# and F#. I'm pretty sure you'll get a feel for how "thinking in F#" can improve the design of your C# programs.

    For example, in C#, when you have classes with virtual methods spread over various files, the F# programmer may think of discriminated unions and pattern matching (think of a virtual method call like a pattern match on the constructor). Then you appreciate some aspects of F# that are just unbelievably clean and cool. (Want to match on two values? It is very easy with pattern matching in F#. Doing a similar thing in C# is a bit messy and can lead to a bit of a code explosion.)

    I've been noodling around with F# for quite a long time, so your experience as a newcomer to F# is very different than mine--which makes your insights doubly interesting. Please post to this forum; or on the F# community site, hubFS; or send me mail (dominic at dcooney dot com.)

    Ciao,

    Dominic
  • Is the video still working?
  • Could someone find out what is wrong with the video for part 1 and 2????
  • Sparkywil2300 Super #
    Actually user Geek1ab from Part 1 had links to both videos. From his post:

    Part 1 at: http://www.mefeedia.com/entry/1143750
    Part 2 at: http://www.mefeedia.com/entry/1160609

    I an getting P2 as I make this post
  • thanks for the links
  • Hi Don, I really like what you did with F# but why all the change from c# in the syntax/keywords for things that are doing the same thing????
    like void and unit?? (i'm sure you know best all those construct that have had a synthax change, me i'm still new)

    I guess some change could be nice but are you sure they are all necessery? I'm sure it would be easy just to redo at least the most evidant unnecesery naming change!!

    I've use a lot of language (delphi,c,c#,vb, javascript etc....) and all of them had to use other syntax just to prove themselve different.
    C# which use similar syntax to java is in my opinion a very clear syntax.

    (i'm not talking about the specific part of the F# language but the identical parts to C#)

    My brain is tired of translating everything languages construct everytime a new nice language come out and F# is so nice.

    Anyway I guess your doing this because Microsoft told you this so that in the future they can incorporate F# in C#.

    still why unit for void, why not void i can't understand hehehe in delphi a unit is a module not nothing... and unit??? i don't see the point of using a word like unit to represent nothing.

    Anyway this is only my opinion as a starter with F#. I understand for people that are already totally in it that their language construct is what they want but heck it's always the same * a new language arrive.

    I still think F# as a wonderfull future tho and I'll put the time to learn it but these days, all those C# changes + all the change that are coming from every libraries, my brain is so fucking tired, please every component and language programmers relax a bit for me to breathe hehehe

    and i'm a young programmer hehhee how old programmers are doing these days???? I'm sure most are in the verge of depression hehhe

    I still think those new tools/constructs/components are useful and will save me a lot of time but dam, they will all become mandatory and after so many years i'm still totally in books, guide, tutorials, videos, .....

    hihihi Smiley sorry all, I just wonder if i'm alone like this
  • Z#Z#

    Hi PPL... for those who can't download the video by the link above you can use this instead... enjoy... ZEE!!!

    http://download.microsoft.com/download/1/1/5/115186e6-3dbd-40f9-a4fb-d504869c9278/f-sharp-part2.wmv

     

  • Z#Z#

    Also very interesting about F# by Don...

    http://www.infoq.com/interviews/F-Sharp-Don-Syme

     

            Wink ZEE!!!

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.