An Interview With F# Creator Don Syme
OCatenac passes along an interview with Don Syme, chief designer of F#, which is Microsoft Research's offering for functional programming on the .Net platform. Like Scala, which we discussed last fall, F# aims at being an optimal blend of functional and object-oriented languages. "[Q] What is the best program you've seen written in F#? [A] I've mentioned the samples from F# for Scientists, which are very compelling... For commercial impact then the uses of F# in the finance industry have been very convincing, but probably nothing beats the uses of F# to implement statistical machine learning algorithms as part of the Bing advertisement delivery machinery. ... We've recently really focused on ensuring that programming in F# is simple and intuitive. For example, I greatly enjoyed working with a high-school student who learned F#. After a few days she was accurately modifying a solar system simulator, despite the fact she'd never programmed before. You really learn a lot by watching a student at that stage."
Will D flat be the same language as c#?
Sure, when everything works out. Something tells me F will mean something completely different when youre getting compiler errors or crashes.
and the emotive language and buzzwords
*yawn* unconvinced.
Last year I wanted to know what all the hoopla was about functional programming. I checked out Haskell, Scala, OCaML and F#. Coming from a Java/Delphi/C# background myself I had to go through it a couple of times before I "got" it. I'm glad I did because I banged out my first production IronPython lambda function on last Friday (yay!).
I know that MS bashing is popular here on Slashdot, but I really want to take a moment to say that the .NET Framework really is excellent. The ability to mix and match different paradigms and languages in a clean an concise manner which is a joy to program in.
Yeah I know patents bla bla mono bla bla Novell bla bla Miguel bla bla.
...of object-oriented and functional programming languages would be one without any functional perspective. I've learned both, I've managed both, and OO didn't drive me insane. Functional-based programming languages are syntactically inferior to OO ones, just as natural languages have features that make some more primitive than others.
"Please describe the scientific nature of the 'whammy'" - Agent Scully
If someone makes a debugger or syntax checker for it, will it be called 'F#CK'?
Slashdot: Where opinions are just opinions until you have mod points.
If you also know Java well, Groovy can also be an excellent tool, and is also useful in production environments.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Dunno why exactly this was modded all the way down to -1, he has a good point.
// This is the time it takes jupiter to revolve around the sun (in earth days) // This is the same as above, but for earth.
A child "modifying a program" isn't very spectacular. Any moron with no experience can modify "hello world" to spit out "goodbye world". I'm quite certain that "modifying a solar system simulation" went something along the lines of this:
Problem 1:
Part A) Replace the values in the program with the proper values for the orbit of the planets.
int orbit_of_jupiter = 0;
int orbit_of_earth = 0;
void main()
{
lots of programming that is NEVER looked at or touched by the student;
}
Part B)
Record your results in the Excel spreadsheet and email it to the teacher. Then print out a copy and hand it in because the teacher isn't quite smart enough to open attachments in outlook.
I mean, seriously people. When you hear claims of "High school child modifying amazingly complicated programs that take years of know how to write correctly", think about it for a little bit. If it sounds too good to be true then it probably is. If F# were this amazing new language that allowed anyone with no experience to write any program, we'd have heard about it one hell of a long time ago.
-1 disagree is not a modifier for a reason. -1 troll, flaimbait, redundant, overrated are NOT acceptable substitutes.
Just out of curiosity, since you post has done locked up my brain...why exactly would you WANT a "FreeDOS clone optimized for SSD" anyway? DOS is really very tiny, so tiny in fact that even on the most RAM deprived of Kiosks you should have no problem simply loading DOS into RAM. And if you are doing something with a lot of heavy I/Os then DOS probably wouldn't be the first choice anyway.So is this one of those "because it's there" kind of deals, or is there a specific purpose in mind?
And as for F# if it fits better than other languages for a job I say great. I've always said every language has its place, even the much maligned VB6. For making a basic GUI for a local database VB6 was the best tool IMHO for the job. And if F# is really as simple to pick up as he says maybe F# can become the new teaching language like old VB was back in the day.
ACs don't waste your time replying, your posts are never seen by me.
FORTRAN has dug itself into a corner where it survives quite nicely. It's used for mathematical, engineering and scientific libraries. FORTRAN just seems to lend itself to expressing these sorts of problems better. Mind you, the whole program probably won't be written in FORTRAN - any UI code and other glue will be written in C. F# is filling the same niche for .NET - the mathematical and analytic libraries are being written in F# while C# is used for UIs and other glue. So even if it's a completely different paradigm, in spirit it's the FORTRAN of the CLR.
To say a language is "functional" does not mean the same thing as the common usage of the word, which is to say "useful" or "utilitarian", though in my experience with Ocaml, Haskell, and Erlang, they are that as well if you take the time to learn to use them well. Fortran and F# have just about nothing in common.
The name "functional" is a little confusing, since imperative languages are heavily based on functions as well, though they are not typically used in the same way. For instance, in a functional language it is usually much easier to write functions that compute useful things without causing side effects, such as modification of shared state. They also usually support such features as tail call optimization (which causes certain forms of recursion to require constant rather than linear stack space), closures, the ability to declare functions within other functions, and the ability to call a function with less than its expected number of arguments, yielding a function of the remaining arguments.
Another common trait of functional languages is the absence of looping constructs, in favor of recursion and library functions like map and fold.
There's one particular reason to look at F#, and that's FParsec. Parser combinators are just awesome, and don't get me wrong - I like the original Parsec, and Haskell in general! - but its IDE support is minimal, and debugging it is a pain.
With F#, you get the same awesome tool, but in an environment where you can actually use it for day-to-day jobs - write any parsing code as an F# library using FParsec, and call it from the main body of C#/VB/IronPython code.
Being an old fuddy-duddy, my first thought that Microsoft was doing a dot NET version of Fortran, but...
Obvious retort is why?
I've no idea why you'd want one, but it exists, nonetheless - made by Fujitsu of all things.
Oh, by the way, Fujitsu must really be into BDSM or something - they also offer COBOL for .NET.
He was probably modded as troll because, while he may be entirely correct about "marketing droids", the conclusion that "F# stinks" doesn't exactly follow from that - unless he has some specific horror stories to share. Or at least saw the language, and is qualified to judge on its merits (i.e. familiar with similar existing languages).
Totally marketing garbage. Man is probably a great guy, with a lousy job. But F#, really? even .NET is ripping off Java.
I'm not sure I follow. Are you saying that F# is somehow "ripping off" Java? If you mean it's a "rip off" something else, then, well, it's clearly designated as an OCaml derivative, it's not exactly news... but we wouldn't get far if people wouldn't "rip off" the work of others, and build on that. You know, just like Java ripped off C++ and Smalltalk, and JavaScript ripped off Self, and Smalltalk ripped off Lisp, etc...
If you mean .NET as a whole being a rip-off of Java, then you're late by like 6 years or so - C# 1.0 was for the most part "a better Java" (note the "better" part, however), but since then it has evolved much faster, and Java is struggling to keep pace, "ripping off" C# as it goes. To give a specific example: C# had first-class functions (called anonymous delegates in the language) in version 2.0, released in 2005. Java still doesn't have them, and they will only likely come in Java 7, to be released by the end of this year. To give another example, C# 2.0 and above has generics that Java language designers would call "reified". Java doesn't, and there's no telling when, or even if, it will.
Microsoft talks about building "ecosystems" but the way they do it, everything in the ecosystem has to have a M$ logo on it. Why can't they just inter-operate and integrate with outside software?
Uhh, I don't even know where to begin here.
Here is the C# language specification, if you ever want to write your own C#compiler. Here is the CLI spec - this covers VM semantics, all involved file formats, and the fundamental class library - this is useful for a .NET compiler for any language.
And third-party languages for .NET do exist in large quantities. One good example is Delphi Prism, which provides full Visual Studio experience, not any worse than what is there for C# out of the box. Then there's Eiffel, Smalltalk, Perl, Fortran, COBOL... IronPython and IronRuby were also outside projects, by the way - their authors got hired by MS along the way because the company was interested in developing dynamic languages on the platform, and, naturally, picked the two most popular ones.
Libraries are also part of the "ecosystem", by definition and there are tons of third-party ones. I won't even bother giving links as there are too many - google it if you want.
So, can you explain what you mean by "inter-operate and integrate with outside software" with respect to .NET, if the above is not good enough?
Well, C++ templates are unique. I don't know any other language that has a macro facility that pretends to be a generic type system... ~
Anyway, C++ was not original from language design perspective - it does indeed rip off Simula a lot - but who actually wrote anything in Simula? It was a very niche language, while C++ became mainstream. Most people who used it first saw all those Simula features in C++, and don't really know better. So "according to many developers", the assertion may even be correct...
It's very similar to how a lot of Java coders genuinely believe that Java was the one to pioneer OOP, and haven't even heard of Smalltalk, much less Simula.
I'm going to say something anathema to the /. crowd, but I'm looking into it with interest for replacing Python. I first teethed on FORTRAN, moved to Matlab 10 years lates, and have been using C extensively for the past 2 years. I'm starting into Python as a quick and dirty replacement for Matlab, and am quickly falling into a love-hate relationship with it.
The love comes from all the cool things that Python can do, for free. Dynamic typing, .append() functionality, etc. It's just awesome.
The hate comes from the sheer lunacy that is Python syntax. Forced whitespacing doesn't suit my debugging style (why not just have the compiler recognize either whitespace or accolades?); functions names like len() are just, frankly, idiotic (length() is much more readable to beginners, and takes only a few extra milliseconds to type for experienced users); and the way of working with indices is just weird (2:5 means the 2nd, 3rd, and 4th elements, but not the fifth; range(2 5) gives you 2 3 4, but not 5.).
Python reminds me of many of these incredibly powerful scientific projects that never got used by a non-scientist until it was far too late to make changes. range() is a good example of this, as while it perfectly emulates "for i=2; i < 5; i++", it is NOT what you expect to get when you say, outloud, "I want a range of numbers from 2 to 5". Having contributed to Scilab, I should know as I'm equally guilty of this kind of thing.
If F# can fill this void, by giving functional programming with functional syntax, I'll probably stop my Python experiments and move directly to F#.
Although to be honest, I'd love to find a python front end that uses non-insane syntax and then simply precompiles it into python syntax at run-time. Then you don't have the MS, Windows, and .Net ickiness.
P.S. I'm not looking to start a flame war about force whitespacing. There are really good reasons to like it. All my programs have consistent whitespacing, except when I debug (I like to put debug programming all the way against the margin, that way there's no possibility of ever forgetting it in the code)). However, you can't have it both ways on readability vis-à-vis function names and indices.
www.eissq.com/BandP.html Ball and Plate System. Amuse your friends. Crush your enemies.
He was probably modded as troll because, while he may be entirely correct about "marketing droids", the conclusion that "F# stinks" doesn't exactly follow from that - unless he has some specific horror stories to share. Or at least saw the language, and is qualified to judge on its merits (i.e. familiar with similar existing languages).
Looking at the wikipedia articles, I tend to think he has a point. Look at the F# version of the famous factorial program and compare to the Haskell version(s). I think anyone would be hard-pressed to prefer the F# version, but who knows?
Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
F# version is essentially the same as OCaml version. In practice, you will notice that there are a lot of people who prefer OCaml to Haskell even today, and that has to do with quality of implementation. Haskell is a nice language on the paper, but its laziness makes it both hard to implement fast, and insanely hard to debug.
With F#, you get language on par with OCaml (so less high-level and expressive than Haskell). But you also get the ability to directly call any existing .NET library - no wrappers or FFI declarations needed. Furthermore, you get an IDE with syntax highlighting, code completion, error checking as you type, and debugging.
Also, keep in mind that most people who get acquainted with F# today aren't familiar with Haskell. In fact, most of them don't even know it exists. They are C++, C# and VB users, who suddenly discover a new project type in VS2010, and are curious as to what this is all about. For them, the basis of comparison will be a typical imperative OO language, not Haskell - and most marketing materials are written with that in mind. It is generally assumed that people who know Haskell can judge these kind of things on their own :)
I understand that it is popular to bash anything that burst forth from the loins of Microsoft, but c'mon! This is Don, The Don, this is one hard-core damned brilliant programming dude (for want of a better term). He was single handedly responsible for generics in c# (something I am greatly thankful for in my day to day work) F# is his baby; the guy is passionate about the idea of a real world practical functional language. Sometimes people use emotive language when they are talking about things that they have devoted themselves to for years. Especially when they believe that it could bring functional programming into the mainstream. I have used F#, and personally really enjoy coding with it (and especially the different way in which solving problems in this manner makes you think). Might be a long time before it is excepted into production code though...
...of a functional language, it is simply Microsoft's offering of a functional language. The former statement sounds like it's one of the dozens of functional languages fostered in academia, for academia to play with. The whole difference here is that, as of Visual Studio 2010, F# becomes a fully productized and supported language in the .NET world. That's really what's exciting for functional language geeks, because never before a real, modern functional language of the generation built in academia in the 90s, like OCaml and Haskell, had such a mainstream backing.
F# version is essentially the same as OCaml version.
I don't know OCaml (I have a cursory knowledge of Haskell, which is why I picked that for comparison), but I could read the OCaml version no problem. The Scala version was difficult, but after staring at it for a bit I understands what it's getting at (especially the _ syntax is unnecessary obtuse). I still think F# is the worst of the lot. Big disclaimer: I have only looked at the factorial example. So this is sort of criticism based on "Hello World" snippets. I'm just saying that the poster far above might actually know what he is talking about,.
Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
WTF#
There is a basic rule about writing programs - choose not a vendor specific language, and the useful lifetime of your program will surpass the life of your hardware.
F# is really just an OCaml variant anyway. Why should I buy something that is locked into a particular vendor and OS when I can get the same thing for free and run it on all the systems I own?
This article smacks of marketing to developers too much for me to feel comfortable with it... ok for Microsoft tards but not for people who haven't sold their souls.
Why are most programmers uncomfortable with it?
Possible because:
n1=1
n2=2
n3=6
n4=24
n5= "Segmentation fault. Core dump"
What can be done to break this cycle?
Try this:
#define "Segmentation fault. Core dump" 120
Advanced??? Changed maybe. 30 years ago I taught myself BASIC from reference manuals in a few hours, enough to write a quadratic equation graphing program for my calculus class for extra credit. My second program was a password cracker so I could get higher priority on the university computer. I've modified code in languages that I had no experience in without any manual just by looking at syntax. So someone taking a few days to learn a programming language and modifying a planet simulator isn't all that impressive for a language ... they just found someone that learns quickly. I'm impressed in the person that picked it up, not the language. It mostly comes down to understanding if/then/else logic, loop constructs, and how to call methods after you learn syntax. Learning these constructs isn't too difficult, applying them takes a little more.
.. instead of spending a few days learning syntax, and a few months mastering a language, we now take a few days to learn syntax, and YEARS to learn all the calls and libraries that go along with it. My first attempt at C++ resulted in my giving up, not because I didn't understand the language but because I was trying to write GUI programs and didn't have the right book to explain which libraries to use and why.
So now
Programming tools have definitely advanced. The days of punched cards and line editors like EDLIN are far gone for most programming needs. It's nice that modern languages don't let you overflow arrays anymore or have to deal with pointers.
The biggest advances in programming??? Compilers, recursion, and object oriented syntax. I've seen far too many 'the next big thing' to get excited over something like this. Remember when C# was supposed to be the next big thing???
But I'm still using the same if/then/else and loop logic that I did 30 years ago. No matter how much things change, they still stay the same....
I rarely read replies, it's my opinion and if you thought about your opinion a little more, I'm OK with that.
One can write a Haskell version of factorial that looks pretty much the same as the F# version:
This contains similar pattern matching expression, even using the same match-anything-pattern-keyword '_' and some additional polymorphism syntax in the type signature. The type signature could be left out and what's shown is what the compiler would then automatically derive.
As one might expect, you can get moderated as Flamebait if you say the same thing about opensource as somebody said about .Net.
The funny thing is that the moderator missed the point. The AC was mocking the logic of the other poster, not really making a statement about OSS projects.