F#

  • I had too much fun with the last post just to let it drop: I decided to port the main command to F#, to show how it's possible to combine C# and F# inside a single project. The premise I started with was that the point-in-curve.cs library is something that we know works - and don't want to re-write - but would like to use from a new application we're developing in F#. This also gives us the chance to compare the performance between C# and F# when solving the same problem (although as we'll be calling through to some…

  • I'm in San Rafael today, at Autodesk's headquarters, to present F# at an internal meeting. I've just come in for a few days, so rather than adjusting to the Pacific timezone I'm settling for living on Eastern time: I get up at 4am (whether I like it or not 😉 and go to bed as early as I can in the evening. Which gives me some time to catch up on email and think about blog posts. It's a fun time to be in the US, on balance: I flew in (via New York, as it happens) just as one…

  • This post has nothing whatsoever to do with Autodesk software: I just thought some of you might be interested in an old project I worked on during my University studies. I've already mentioned the project briefly in a couple of previous posts. So, after dusting off the 3.5 floppies I found in the attic, and working out how to extract the code from the gzipped tarballs they contained (thankfully WinZIP took care of that), I started the work to port the code from Miranda to F#. Miranda is still available for many OS platforms, although it has apparently largely been…

  • In the last post we saw some code that downloaded data - serially - from a number of websites via RSS and created AutoCAD entities linking to the various posts. As promised, in today's post we take that code and enable it to query the same data in parallel by using Asynchronous Workflows in F#. Asynchronous Workflows are an easy-to-use yet powerful mechanism for enabling concurrent programming in F#. Firstly, a little background as to why this type of technique is important. As many - if not all - of you are aware, the days of raw processor speed doubling…

  • OK, OK, you are probably thinking "why would anyone ever want to use AutoCAD as an RSS reader?". The answer is, of course, "they wouldn't". The point of the next few posts is not actually to enable AutoCAD to be used to read RSS, but to show how it is possible to use F# and .NET to extract information from RSS feeds and create corresponding AutoCAD entities. The reason I came onto this subject will also become more clear when you see my next post: I have been researching Asynchronous Workflows in F# - an uber-cool mechanism for managing concurrent,…

  • A quick post, for now, just to point you to this blog: http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx This will only work with Visual Studio 2008, it seems, so I haven't yet tested this out myself (I tend to be a laggard when it comes to Visual Studio, for some reason). A quick note on what I've been up to in my spare time: I'm currently diving deeply into F#, to prepare for some internal presentations I'll be giving in February. As part of the exercise I went up to the attic and dusted off the 3.5" floppies containing my old final year project from…

  • In parts 1 & 2 of this series we looked at metaprogramming with AutoCAD using AutoLISP and VB(A), and then using VB.NET and C#. In this post we're going to look at what's possible from F#, through the lens of my relative inexperience with the language, of course. The quotations mechanism in F# appears to be the way to represent, analyse and execute program structure. This article describes the concepts, although it's quite deep and doesn't address the case that's most immediately interesting to AutoCAD develeopers: the ability to evaluate and execute code represented as a string. In fact, this…

  • In one of my sessions at this year's AU, "There's More to .DWG Than AutoCAD®", I'll be showing some VB.NET code that goes through and collects information about solids, presenting it in a dialog along with the sum of the various volumes. You can get the code and the results from Part 1 of the session's handout. Just for fun, I thought I'd write some F# code to add the volumes of the 3D solid objects in the modelspace of the current drawing. I adopt a similar approach to the VB code - not caring about intersecting volumes, for instance…

  • I've been working through some draft chapters of Don Syme's Expert F# book (posted here, while the final version will be available in hardcover from early December). I'm definitely enjoying working with F#: the beauty of functional programming combined with the flexibility of .NET is a killer combination. Before I dive into the sample I put together for today's post, I thought I'd scribble down some musings on the language, to help position the technology in comparison with more popular imperative/object-oriented languages... Functional programming is great for deep mathematical problems, and so will play well with developers needing to perform…

  • For my follow-up F# post I wanted to find something that showed off more of the capabilities of the F# language, while remaining something worth integrating with AutoCAD. The good news (at least as far as I'm concerned 🙂 is that one of the samples that ships with F# turned out to be perfect for this. The sample is known as "The Famous DirectX Demo", and is really, really cool. It uses F# to represent - extremely succinctly - a simulated, animated surface. And when I say succinct I mean it's tiny: with F# it's possible to represent complex mathematical…