C9 Lectures: Dr. Don Syme - Introduction to F#, 1 of 3

F# is Microsoft's first functional programming language to be included as one of Visual Studio's official set of languages. F# is a succinct, efficient, expressive functional/object-oriented programming language under joint development by Microsoft Developer Division and Microsoft Research. During the course of Erik Meijer's fantastic lecture series on functional programming fundamentals several of you asked for examples of specific topics in F#.
In part 2 of this 3 part lecture series (see part 1 here), Dr. Syme provides an overview of the following topics:
Functional Data
Pattern Matching
Imperative Basics
Sequences
NOTE: Announcing the F# February 2010 Release!
The F# Team says: We’re excited to announce that we have made available a new release of F# along with the Visual Studio 2010 RC and a matching February 2010 F# CTP for VS2008.
In addition, we’ve launched the F# PowerPack as a CodePlex project, enabling this set of valuable F# extensions to continue to grow and improve separately
from the stable core F# releases.
Part 1
Part 3
Get the slides for this lecture series here.
Read Don's Blog
Don and C9, thanks for these. The videos are a very approachable way to learn.
You're welcome. More to come.
C
Great tutorial.
Why is let triangle () = .... and not let triangle = ...
The way I understood is the triangle is a value, but the () makes think it's a function.
Very nice. Thank you.
I'd much prefer to see a correct model of Blackjack though. Aces are worth either 1 or 11, and seeing such a flaw in an example is hard to take. Hopefully, you'll show us how to actually do it in the next part!
Thanks!
Cmon ... this tutorial is excellent!! ...nothing here is 'hard to take'!!
He shows you (and explains!) every line of code ... if you wish to make this example 'more correct' just spend a few minutes .. adjust the example as you see fit and post about your experience! ...
Don Syme ... thanks for doing this!!
Has anybody purchased the Chris Smith book? (Programming F#: A comprehensive Guide -- isbn: 0596153643)
The are only a few reviews on Amazon (all positive) but I'd appreciate more comments and maybe a little bit more critical perspective before I buy.
I haven't read the whole of Chris Smith's book yet, but so far I can recommend it, it is well written, nicely formatted and generally easy to read. I have two other great F# books as well, but my impression is that Chris Smith's book is the best introduction to F# I've seen yet.
Don & C9, thanks for another great video!
BTW: I simply cannot resist the temptation to point out that one of the code examples can be simplified, in the allFiles function, the following is used:
for file in Directory.GetFiles dir do yield file
which is equivalent to:
yield! Directory.GetFiles dir
I bought Chris Smith's Programming F#. It's excellent book. Concise explanation.
Thanks Charles and Dom.
It's really useful for someone like me who is learning F#.
I do hope that more and more F# shows are coming in future.
And i really would like to watch the discussion about FP between Erik and Dom.
Charles... Can u arrange?
There's also a most excellent interview with Don on Infoq. Here Don touches on the background for the design of F# and how to make it fit with .Net. It's quite enlightening and I certainly learned a lot from it.
Yes. I've been wanting to shoot a Don/Erik E2E for a long time.. Hopefully, we can do this in April..
C
I agree, an in depth discussion between Erik and Don would be fun. I wouldn't mind seeing them point out the major differences between F# and Haskell, as well as how to write Haskell-esque F#. I would think we would see a lot of material similar to Matt
Podwysocki's articles on monads.
By the way, if you are interested in more videos, community, etc. around F#, please join Community for F# (http://c4fsharp.groups.live.com). We have Live Meetings every third Tuesday of each month at 12:00 pm EST. Details can be found on the Live Group (you'll have to join to see it though as Live Groups doesn't allow anything to be just public :-/). Hopefully Don will join us soon! Tomorrow we have Steffen Forkmann talking about Fake (F# make), Natural Spec, and Functional NHibernate.
Excellent. I am looking forward to seeing part 3.
Using snippets would make things a lot easier. Won't have to copy and paste code from the slides.
Hi,
First of all, excellent presentations.
A couple of questions that I will submit more to come after I finish watching:
- why not have all the collection as seq ?
- is there a unit testing framework available for F# ?, since it's a .net language I guess I can use stuff like nunit or xunit.
Thank you,
The "seq" type is just an alias for "IEnumerable", and all the F# collection types implement the IEnumerable interface, so you can treat e.g. a list of integers as a seq of integers.
Yes, you can use things like NUnit (we actually use this on the F# team for some of our unit testing). There are also some unit testing tools developer in F#, like FsCheck. You might check out http://stackoverflow.com/questions/1989487/f-development-and-unit-testing to learn more.
hey Charles can you arrange something with Eric and Don going deep or something like that, to talk about the shift in the fp mindset for imperative programmers (for us which our first language was pascal and second ansi c and end to c# or vb it is quite
a step immutability etc) or if this isn't feasible just invite Don to talk about his new book about f# which is coming soon
thank you
Alex
Next time Don's in town I will arrange an Erik/Don conversation. C