f#

TwitterFacebook
Get flash to fully experience Pearltrees
http://richardminerich.com/2010/12/an-f-ant-colony-simulation-in-silverlight-4-0-with-dynamic-ai-loading/

An F# Ant Colony Simulation in Silverlight 4.0 with Dynamic ...

I’ve been enviously watching Phillip Trelford publish excellent F# games all week and tonight I just couldn’t stand it anymore. I stayed in, rolled up my sleeves and ported the very same ant colony simulation I used in my CUFP workshop to Silverlight 4.0. Wow, just look at those little guys go at it. Silverlight sure is pretty! As you might have noticed by the big white “Click To Load Custom AI” message, you can also compile your own AI and battle it out with what I’ve included here. To make things easy I’ve provided a ready to go solution .
Many people expect the performance of F# to be comparable to the performance of C# "because they both compile to the same intermediate language (CIL)". Although the VM obviously places the same ceiling on the performance of both F# and C# there are some features that affect performance differently between the two language implementations. Firstly, C# and F# don't actually compile down to the same CIL because only F# generates tail calls. http://fsharpnews.blogspot.com/2010/12/performance-related-features-in-f-and-c.html

Performance-related features in F# and C#

Lorenz attractor

http://fsharpnews.blogspot.com/2010/07/lorenz-attractor.html The Lorenz attractor is a fractal derived from the trajectory of a 3-dimensional dynamical system that exhibits chaotic flow. This blog post describes a 35-line program that computes trajectories of this attractor and visualizes them as a beautiful whisp using Windows Presentation Foundation: The program is as follows: > #r "PresentationCore.dll";; > #r "PresentationFramework.dll";; > #r "WindowsBase.dll";; > #r "System.Xaml.dll";; > let trajectory f (x, y, z) dt n = let s, b, p = 10.0, 8.0 / 3.0, 28.0 let mutable x = x let mutable y = y let mutable z = z let a = Array.zeroCreate n for i=0 to n-1 do a.
Last time, we provided the components to actually make the SEO helpers into a real application . This time, we make the application more friendly. In particular : default files and directories are created if they don’t exist yet. Then, instead of being forced to use a command window, this time, double clicking will suffice. This will also allow us to see how to use events and Winforms (yup, no WPF !), and how to use functions to make form building a tad quicker.

SEO Analysis in F#, a friendly application

http://lepensemoi.free.fr/index.php/2010/06/27/seo-analysis-in-f-a-friendly-application
http://codebetter.com/matthewpodwysocki/2009/09/14/constraining-f/ Generic constraints inside .NET has always been a fun enterprise, especially given how C# handles them There has been some discussion on Jon Skeet’s blog about the fact that C# does not allow for generic constraints referring to a number of types. These include: However, as Jon correctly points out, this is indeed supported by the CLR directly. In fact, with our knowledge of F# constraints , we can write this exact function in F# without any such issue. It’s little wonder that F# has learned some of their lessons from C#, but as well as having the language designed by the person who brought generics to .NET also helps.

Generically Constraining F#

F#: Pipelined Monads

I was actually quite pleased that I got my state/error monad working ( F#: Pipelined Monads ), but there was a far more elegant solution staring me in the face. Thanks to other members of the F# community, I have reverted my code back to how it was and added two operators. In doing so the code is now far more elegant. http://stevehorsfield.wordpress.com/2009/09/12/f-pipelined-monads-solutions-from-the-community/
http://blogs.msdn.com/b/andrewkennedy/archive/2008/08/29/units-of-measure-in-f-part-one-introducing-units.aspx

Units of Measure in F#: Part One

I've stumbled over here into F# land because I started working on a program that needs to process and analyze GPS data contained in GPX files, and it became painfully obvious very quickly that a programming framework that would handle units in a natural way was practically a must, and it ALSO became painfully obvious very quickly that the OO inheritance mechanisms in the common procedural languages (C++, C#, Java, VB etc) all present major roadblocks to implementing a "units of measurement" framework. I cannot even begin to describe how exciting it is to discover that this is a core feature of F#. But going beyond that particular domain, I would propose that the idea that units are not a "near must" almost everywhere else, is actually an illusion born more of ignorance than anything.
(Read this blog entry at a pace which is appropriate for you . Some readers will find this mostly old-hat, whereas others will find it rough going at parts. I encourage you to take a break and try out the code examples, if that helps you out.) I would like to discuss catamorphisms. A catamorphism is a generalization of a fold on lists to an arbitrary data type. http://lorgonblog.wordpress.com/2008/04/05/catamorphisms-part-one/

Catamorphisms, part one

Correct by Construction in F#

http://blogs.msdn.com/b/jomo_fisher/archive/2008/04/22/correct-by-construction-in-f.aspx Correct by Construction in F# Jomo Fisher—a theme in the design of the F# language is that problems in the code are revealed as compilation errors. Consider this C# code which is used to compose a courteous letter to a customer: I want to stop now and claim that I’m not picking on C# which is a wonderful language.