Tons this week. Vladimir Matveev’s is my favorite new F# blogger with very well written data structure posts, Ashley Feniello continues his fantastic FScheme series, and Jomo Fisher posts some great Freebase and DGML examples. That’s just the tip of the F# iceberg, do come inside.
The basic idea is to run a simulation by iterating a pure function from world state to world state. We’ll add a new ‘run’ primitive which will expect several user-defined functions to have been set up. The world state is initially produced by an ‘init’ function. Then every 30th of a second a ‘tick’ function is called to produce a new world state from the current state. Finally a ‘draw’ function will be called to render the world.
I’m working on a program to keep track of paired trades with trailing stops. I need to download stock prices, so I thought I might reuse some old code of mine. Here is the updated framework.
NAG (Numerical Algorithms Group) is currently running a beta test of a NAG Library for .NET. One noticeable feature of the comments received so far is the relatively large number of users interfacing to the library from F# rather than C# or VB.NET.
But what if you wanted to extend the web store to have features like the online retailer Amazon, e.g. multiple sellers, recommendations, etc.? Answer: serious table and relationship proliferation. Enter an alternative model: the Associative model of data, a dynamic model where data is defined simply as items and links.
We obtained a surprising performance result when comparing optimized parallel ray tracers written in F# and C++ recently. The following two programs render the same highly complex scenes containing over a million objects. Surprisingly, the 136-line managed F# program runs slightly faster at 17s than the 168-line unmanaged C++ which takes 18s.
Today’s post will be devoted to various ways of integration between Iron Python and F#. I’ll try to skip the details of DLR configuration, because this is vast topic that worth separate post (maybe even a few posts). Instead I’ll focus on questions of integration.
What we’ll try to do in this post is to create the structure (based on 2-3 trees) with following characteristics. Immutable (modification returns new instance of structure with changes applied), Enqueue/Dequeue both in start and end in amortized constant time, and Concatenation support.
There are many special types of trees that perform insert/remove operation in intelligent way ensuring that result tree is small but branchy :). This trees are called self-balanced, most well-known of them are AVL trees, Red-black trees, 2-3 trees. This post is dedicated to the latter ones.
This post I’d like to dedicate to reviewing functionality of Async module – creating and manipulating async computations.
The previous post presented a way to access the image data from the Webcam using DirectShow.Net and F#. We can manipulate this data to do some basic image processing operations with it.
The Managed Extensibility Framework is an interesting new technology in .NET 4.0. This is a simple example in F#. This code sets up MEF hosting and asks for all extensions in the c:\extensions folder.
I recently posted about the freebase web service here. This sample reads biological classifications and renders them in DGML. The result is a huge graph, here’s a little piece of it…
Here’s another F# web service sample. This one uses the Bing Phone API to do a query. This time the code uses Xml instead of JSON and XmlDocument instead of a DataContract deserializer. This is pretty much a straight transliteration of one of the Bing SDK samples.
The web service at Freebase.com lets you access all sorts of structured data from a web service. Here’s a sample that shows you how to access this data from F#. It uses DataContract and the JSON serializer. The code below reads and prints the elements of the periodic table.
Julien Ortin’s BitTorrent in F# series: I/O Operations and Bitfield
One important thing is that a BitTorrent transfer is considered as a stream of pieces. So, if you have a 100-byte file, and a 400-byte one, and if the piece size is 200-byte long, the data from the piece need to be appropriately split (both when reading and when writing). In this library, we use a reference to the AsyncWorker described on Don Syme’s blog.
I have recently been experimenting with combining Reactive X, WPF, and F# and have found the combination to be very palatable. I chose drag and drop as the test case because it is both non trivial and generally deeply stateful. The resulting Rx turns out to be one fifth the code of my original C#, much easier to read and has fewer errors.
After my initial fooling around with turning AutoCAD into a Spirograph using F#, I decided to come back to this and bolt a jig on the front to make the act of making these objects more visual and discoverable.
I have been working for quite some time now on Asteroid Hunter. This has not left me much time for exploration with F#, but there is quite a bit a learned during the process anyway.
My recent work on Professional F# 2.0 has left me thinking a lot about the nature of abstractions.
I thought these code examples all look rather verbose – in the case of Clojure because in that way rather typical for Java, the APIs are pretty verbose to use, and in the case of C# because of all the syntactic, well, ahem, necessities, as well as the fact that there’s no language feature for integrating nested sequences seamlessly. Keeping it nice and simple, in F# that example can look like this…
Tail recursion is essential in functional languages like F#, where iterative solutions are often implemented using recursion.