Archives
-
Tuples: an F# lightweight data structure
Maybe the best thing to do is to start by showing a few examples of tuples:
-
F# doesn't need parenthesis in functions, or does it?
In a previous posting I mentioned that when you define a function in F# you don't need parenthesis surrounding the parameters, or commas separating them. So, this simple definitions are all valid:
-
Word 2007 and Microsoft Math
Reading Alfred Thompson blog, who focus on computer science teaching at K-12 schools (what we call in Ecuador basic high school), I found this nice entry: Microsoft released a few days ago the Word 2007 Math Add-in. After installing and playing with it for just 2 minutes, I was able to create this document:
-
ParallelFX: multi-processing extensions for .NET Framework
It is interesting how new solutions bring new problems: when Intel noticed that Moore's Law was loosing steam, it had to look for a new way of producing ever more powerful computers ¿their solution? Put more CPU's on every chip (the famous multi-core), they started shyly (2 with Core Duo) then they got up to speed (4, 8 CPU's) and now nobody's laughing when someone says that in 10 years home computers will have 32 or 64 CPU's.
-
F# basic function definition syntax
In the comments to this post, Anon and Josh complain about the syntax of F#. On one hand, they've got a point: most programmers are used to notations similar to those of Visual Basic, C# or Java, and for them many of the syntactic details of F# will look weird (or just plainly annoying ;-) ). On the other hand, it's not the case -as Josh suggests- that Microsoft is creating a new language with a purposedly cryptic syntax :-D; actually, F# was designed to follow as much as possible the syntax -and semantics- of OCaml (1996), a popular language in the functional world. OCaml in turn basically offers object-oriented extensions to Caml (1985), which inherits most of its syntax -and semantics- from ML (circa 1973). So, as much as I would like to say that Microsoft has created a whole new language, its more like it is moving the spotlight to a tradition as old (LISP anyone?) as imperative languages themselves, by providing an implementation nicely integrated into .NET Framework.
-
A better way of getting the average salary
Related to my post yesterday in which I tried to show an appealing business sample in F#, David Taylor commented that this:
-
Visual Studio 2008 and F#
Once I downloaded and installed Visual Studio 2008 Team System in this laptop, one of the first things I did was to install F# to see how well it worked in the shiny new IDE. It worked without any hassle and to celebrate I wrote a typical business example: get the average salary of a group of employees.
-
F#: Going from academia and research to the commercial world
-
Another new version of the F# compiler (1.9.2.7 and counting...)
-
New version of F# available (1.9.1.18)
-
Oracle 10g for Windows Vista released
-
Python 2.5.1 and IronPython 1.1 released
-
In the year of 2005 Skynet launches a massive attack and wins the FIFA World Cup
Months ago the launch of Robotics Studio was announced so that by now many, many people should have developed their pet-robots (as for me, I've lost the touch a long time ago). To prove how versatile those robots are, Microsoft has just released Soccer Simulation for Microsoft Robotics Studio, that allows robots to compete following the rules of RoboCup (whose motto "By 2050, develop a team of fully autonomous humanoid robots that can win against the human world champion team in soccer" I'm not sure whether it makes me laugh or get nervous). For the time being, I'll take it by the lighter side: I hope some Ecuadorean software team develops a robot soccer team as good in RoboCup as our real soccer team is in the real soccer [8-|]. -
Programming in .NET military style
It seems like the .NET platform happened to be a nice innovation test bed. Mary Jo Foley talks about the “Sharps”, the growing cloud of experimental programming languages (A#, Cocoa#, F#, Gtk#, J#, Sing#, Spec#, X#) that range from data oriented (X# or C Omega) to functional programming (F#, my favorite) to operating system construction (Sing#). What all this has to do with the title? Some thirty years ago, the American army figured that its contractors were using too many programming languages (well over 400) so they had a real Tower of Babel. What to do? Well, in pure military fashion they formed a committee to choose the best programming language, the committee decided that no existing programming language deserved the label so that, in order to eliminate the excess of programming languages in use, they decided to create another one: Ada. Ada saw the light in 1980 and, for a while, the Department of Defense tried to force its contractors to use nothing but Ada, in the end they had to abandon the rule, even though the initiative did give fruit: from over 400 languages used they went down to less than 40, nice try indeed. What does all this have to do with .NET? Well, one of the "sharps", A#, is an implementation of Ada in .NET and, to be honest, this is not even news, A# has been alive since 2004 and its latest version (June 2006) works only on .NET 2.0. So if you feel like programming in .NET military style, you can use A# (as for me, I have my hands full with C# and F#).
-
ASP.NET webcasts for Java (well servlets, JSP, Struts, JSF, et al.) developers
-
First class functions and currying
The paradigm behind functional programming says that everything can be solved creating and combining functions. Mathematical functions that is, like in "a transformation that takes values from a domain and map them to a codomain". For example, the domain of the length function is the set of all possible character strings and its codomain are the positive integers, the sin function has as domain all the angles and as codomain the reals between -1 and 1. A couple of function definitions in F#:
-
Video resources for getting your feet wet with functional programming
Since, by pure coincidence, I learnt some LISP and functional programming. languages like Haskell have intrigued me. Now, this kind of academic interests happen to have practical ramifications that may be of interest to many of you. For example, C# 3.0 will have features like lambda functions and type inference which are abilities brought from functional languages, furthermore, Orcas LINQ, the new proposal for integrating generic queries into C# and VB.NET semantics, is a direct application of functional concepts. This video is a fascinating conversation on the relevance of such concepts for solving actual problems like using the potential of multi-core CPUs or handling concurrency in transparent ways, people like Anders Hejlesberg feature on the video, so it's worth downloading. After watching the video I think many of you will want to learn some more about functional languages and, from the many available options, may be the closest one is F#, which was created at Microsoft Research and runs inside Visual Studio, I suggest to start with this very gentle video which is an eye opener, later on you can watch Don Syme (the creator of F#) talking about the ideas behind the language here and then he shows us the language here (although for starters I prefer the Flying Frog Video). Happy lambda programming!