Freigeben über


Somasegar's WebLog : F# - A Functional Programming Language

I've been playing around with F# for a little while, but I hadn't gotten my hopes up that it'd end up an official part of Visual Studio. It looks like my trusty intuition isn't as trusty as I'd hoped it would be. There's a team forming to help bring F# into Visual Studio.

If you know what F# is, you can go to Soma's blog to find out more (or just download it): Somasegar's WebLog : F# - A Functional Programming Language. Something else to look at is Don Syme's Blog.

If you don't know what F# is, it's a Functional programming language by Microsoft Research on the .NET runtime, based on ML and OCaml. If that makes a lot of sense to you, you can find out where to get started in the  F# Community or on Don Syme's Blog. They both link to the F# Wiki.

If you're not familiar with functional programming, you can check out these entries:

The definitions will tend to refer to "lambda calculus" (not that there's anything wrong with that). If you've worked with Mathematica or LISP, then you already understand it. Hopefully, my take on this won't oversimplify things.

What's cool about functional languages is that you focus on writing functions that take arguments (and the arguments can be functions). So, you ask "what's special? I have function pointers in C and C++ and other languages". First, functional languages are restricted so that they don't have side effects, which makes it easy to write highly concurrent code. With the multi-core CPU's gaining more cores as time goes by, the ability to write concurrent code is a big deal. You get concurrency for free with functional languages--no need to write semaphores or critical sections or any other synchronization code yourself. Second, you'll find a lot of AI code written in functional languages because those arguments can be other functions, and variables can be functions, and you can easily write functions that write functions. (Yes, you read that correctly). So, a rule base is easy to write--just write code that writes code, and evaluate that code (LISP has an eval function for that, as do Python, Ruby, and other languages).

Comments