F#
-
Following on from the previous post in this series, today's post completes the implementation to create a full Apollonian gasket in AutoCAD using F#. As a comment on the original Common LISP implementation, someone had contributed a more complete version which allowed me to complete today's F# version. Here's the additional F# file for the project (which I'll be providing in full at the end of the series): module CirclePackingFullFs open System.Numerics; // Use Descartes' theorem to calculate the radius/position // of the 4th circle // k4 = k1 + k2 + k3 +/- sqrt(k1k2 + k2k3 +…
-
To carry on from the last post in this series, today's post is looking at a simple, initial attempt to pack circles into a space using F#. Rather than starting from the C# code in the previous post, I decided to look for a solution that makes better use of F#'s mathematical capabilities. I came across this simple Common LISP implementation, which creates a subset of a full Apollonian gasket. [Aside from the links in the previous post, this page may also provide additional insights into programmatic approaches for solving this problem.] Here's my equivalent F# code: module CirclePackingFs …
-
I've been planning to look at it for ages – and have certainly mentioned it before – but other things have kept on cropping up. Well last Thursday, on my train trip back from Wallisellen (the home of Microsoft Switzerland), I finally managed to take the plunge and start working with the Async CTP for Visual Studio 2010. I'd been in Wallisellen to attend an MSDN TechTalk presentation by Stephen Toub, Principal Architect on Microsoft's Parallel Computing Platform team. I've followed Stephen via his blog – and the Parallel Programming with .NET blog – for a long time, and thought…
-
Or perhaps the title should really be "why it's really a good idea to avoid misusing mutable state when using F# Asynchronous Workflows". Ultimately I wanted to share a brief (or not, we'll see), cautionary tale about the dangers of shared state when implementing concurrent tasks. I've been using F# for some time, and have it fairly well drilled into my skull by this point that shared, mutable state is bad. And yet occasionally it somehow creeps in as an expedient way to solve certain issues: perhaps it's just a lack of discipline on my part or the years of…
-
This handout is for the companion class to the one whose handout formed my last post. While that class was user-focused, this one, "CP322-2 - Integrate F# into Your C# or VB.NET Application for an 8x Performance Boost", is more developer-focused and takes the hood off the implementation of the BrowsePhotosynth application. The code for this special version of the application – which imports synchronously via C# and synchronously/asynchronously via F# – is available here for download. Introduction This class takes a look at the implementation of BrowsePhotosynth for AutoCAD, the ADN Plugin of the Month from October 2010 and…
-
A colleague set me a fun little geometry-related challenge a couple of days ago: to write C# and F# applications to make AutoCAD draw lines between a number of points spaced evenly around the circumference of a circle. Here's the first C# version I wrote, which makes use of a function to collect the various points before indexing into the collection from a nested loop: using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using System; namespace CircleOfLines { public class Commands { public static Point3dCollection pointsOnCircle( Point3d center, double radius, int n ) …
-
I had a very nice surprise in my inbox, this morning. Thorsten Meinecke, from GTB in Berlin, decided to convert the VB.NET code contained in the last post into an F# script and to share it with this blog's readership. Thanks, Thorsten! 🙂 One thing about it being an F# script (typically stored in a .fsx file) is that it can be loaded and executed directly from the "F# Interactive" (FSI) component in Visual Studio without the need to build it into a project creating an executable. What's also very nice is that the XAML defining the WPF dialog is…
-
I just thought I'd report back on a few changes made to the BrowsePhotosynth Plugin of the Month during the course of this week. The updated version has just been announced on Scott Sheppard's blog and I thought I'd share some of the specific implementation details. The first one (in the 1.0.1 update) was a really interesting problem and I owe a big thanks both to Alberto Venturini for reporting it and to Marat Mirgaleev, from our DevTech team in Moscow, for helping test on a comparable OS. The problem was that on all the systems upon which Alberto had…
-
Many of you will have seen previous incarnations of this tool, during its development. It's a little more complex than most of our other monthly plugins – mostly as it depends on a couple of external components – but the functionality should hopefully be simple enough to understand and use. I won't go into great details here, but if you're using AutoCAD 2011, give it a try by downloading the ZIP from the Autodesk Labs Plugin of the Month site and executing the contained installer package. From there you should be able to run the BROWSEPS command inside AutoCAD to…
-
The class catalogs for AU 2010 – for both the physical and virtual classes – have now been posted to the AU website: I have a few AU classes scheduled – thanks to any of you who took the time to vote for them. My first class is virtual… Getting to Know the AutoCAD® Plugins of the Month (CP212-1V) Tuesday November 30th, 6:00-7:00 am PST Tuesday November 30th, 11:00 am-12:00 pm PST The Autodesk Developer Network (ADN) team has been publishing "Plug-ins of the Month" on Autodesk Labs for over a year. Each of these plug-ins extends an Autodesk® product…