First hand at F#

Filed Under (Development) by Karun on 24-05-2009

Tagged Under : , ,

With the release of the first beta of Visual Studio 2010 which includes support for F#, it was only a matter of time till I tried my hand at it.

I don’t go for Hello World programs. Apart from C, the first code I’ve written in every other language (since I heard this question) has been the same. Keeping up tradition, here’s the F# port.

let Check (x: int) = float(int(sqrt(float x))) = sqrt(float x)
for x = 32 to 99 do
let sqVal = pown x 2
if (Check(sqVal / 100) && Check(sqVal % 100)) then
System.Console.WriteLine(sqVal);
done

This code aims to find every 4 digit number that is a perfect square whose upper and lower two digits are both perfect squares. This question was part of my sem 1 C paper and got me a 0/10. Clearly the examiner didn’t understand my answer. :P In honor of the great act of stupidity on my side (of writing such a solution in an exam), I recreate this in every concievable language as my first code :)

This is my first piece of code in a functional language so if I could have done this better, please let me know. Now to try out Haskell :)

A note about the VS 2010 F# editor. I know its not meant for performance but compiling clearly takes a couple of seconds. The IDE also could do with a bit more work with its intellisense because it didn’t like remembering System.Console and instead searched for the string everytime meaning I would hit System.Configuration instead (I am used to hitting enter after ‘Con’ due to C# :))

VS 2010 Beta 1: User Interface

Filed Under (Review) by Karun on 21-05-2009

Tagged Under : , , ,

Well, I’ve been browsing through Visual Studio 2010 for a while now. I’ve not gotten into coding but did get a chance to have a look at the User Interface for this product. Here are some of the things I’ve noticed.

  1. WPF is in: Oh yes, you heard right! The start page uses WPF for a clean and slick use. Have a look at the start screen (image in the gallery at the bottom)
  2. New context highlighting: Its bigger and better than ever! The editor looks slicker that ever before and I’m loving every byte of it ;)
  3. Changed Intellisense drop down menu: I must admit, my favourite part of the VS editor is its code intellisense and they have changed things up a bit in this department. I must admit though, I haven’t figured out what the Ctrl+Alt+Space exactly does :(
  4. Inbuilt support for Office projects: Want to write managed code extentions for Office products? Go right ahead. Start your work out of the box ;) I believe you don’t need to export PIA with your projects any more. (More on this in a technical detail post)
  5. F# supported OOB: I’m sure you have heard of F#, the object oriented functional programming language. Well, it isn’t an outcast any more. :P Visual Studio 2010 has full support for the language. No more need for downloading and installing separate binaries. :)

One thing still remains the same. The installer takes a lot of time to finish up the entire process. Also, .NET Framework 4.0 Beta 1 asked me for a reboot before proceeding with the rest of the installer (Don’t remember 3.5/2.0 asking for reboots in prior Visual Studios). I dislike installers asking me to reboot but I especially hate it when it doesn’t give me an option to restart later ¬¬. The installer isn’t going to go ahead either way. The rest will be completed after reboot. You should let me restart later ;( I’ll make sure I mention that in my feedback to the VS team :)

There are a lot of videos out there about Visual Studio. You might want to check out channel 9 for 10-4. The 10-4 shows are downloadable so you can get the weekly video podcast whenever you want :)

Au revoir!

Visual Studio 2010 / .NET 4.0 Beta 1 released

Filed Under (Preview) by Karun on 21-05-2009

Tagged Under : , , ,

Yes, they are out! You might have been hearing about the two for the past week or two around the interneticle blogosphere. I certainly did and as with every VS release, I was excited. VS is the best IDE I have seen so its no surprise that a new release excites me.

Initial reports state that the editor now uses WPF at points, has a brand new editor and improvements in syntaxes. Another thing they have changed is VS 2010 now has native support for F# :o This release isn’t really high on performance and optimization but gives you a good look as to where this project is going. Seems really exciting the things they have done. You can have a look at the Visual Studio 2010 Training Kit VS 2010 TS B1 :)

All this and much more in this release. I’ll have an initial review up by tonight when I get my hands on it.

People who are waiting to download it can do so off MSDN Premium, Microsoft Downloads or try the Web Installer. I’m sure there are other not so legal ways to do it as well :P If you are looking for a x64 VS 2010 Team System then don’t. There isn’t one :( So its x86 for all of us! Don’t worry, the following OS’ are supported:

  • Windows 7 RC (x86 and x64) Ultimate Edition
  • Windows Vista (x86 or x64), all editions except Starter Edition
  • Windows XP (x86 or x64), Service Pack 2 or later, all editions except Starter Edition
  • Windows Server 2003 (x86 or x64), Service Pack 1 or later, all editions
  • Windows Server 2003 R2 or later (x86 or x64), all editions
  • Windows Server 2008 (x86 and x64) or later (all editions)
  • Windows Server 2008 R2 RC (x64) Enterprise Edition

Windows 7 might be supported in this release but Microsoft doesn’t really recommend using VS 2010 B1 on Win7. Why? I guess as with most betas, you want bug reports that are purely based on your product. Two betas working together could do a lot more weirder things than just one.

If you already have Visual Studio 2008 on your machine then don’t worry, VS 2010 B1 will install beside it without disturbing your precious VS 08 install ;) As with any beta, don’t rely on it for your major dev work and avoid installs on your primary machine.