11

So, essentially the project I wish to undertake is an SVG editor. I would prefer to use WPF because then I can leverage XAML for my application layout (that designer is so nifty). Unfortunately, I have only been using the .NET framework for just a few months, and am still unfamiliar with most of the class names.

The goal was to use F# because it is a functional programming language and F#'s recursion and wonderful list operations combined with tuples will work well for what I am trying to achieve. And the goal is to use .NET because of its huge library of available and documented classes with examples.

I have already looked at this question. https://softwareengineering.stackexchange.com/questions/3129/is-there-a-canonical-book-on-f But the answers are just for F# in general and assume you already know C# , which is not particularly useful for me.

The top book as an answer for the question referenced above was Real-World Functional Programming: With Examples in F# and C#. However, the 3 star amazon review on this book while quite harsh and perhaps exaggerated correctly illustrates my problem.

If you're interested in functional programming, but you're not a C# looking to learn F#, you can safely skip this book.

I have looked on online for WPF F# examples, there are various code snippets here and there, but nothing substantial or demonstrating it being used outside a single file script .fsx, and nothing really enterprise-level or even at least professional grade.

So even Microsoft doesn't really have a lot of examples on how to do .NET stuff in F#. The examples I have found are usually only features unique to F#. Take a look at F# 's basic and advanced sections, and you'll find they are guilty of only teaching syntax. For example, the MSDN on WPF for the Line class does not have any code examples in F#.

When you scroll down the the code sample tab for F# it just says

No code example is currently available or this language may not be supported.

With so few available code examples, I am finding it hard to undertake this project.

My question
I would appreciate help with understanding how I should approach this project using F# when I don't know C# all that well.

10

Break the problem into two parts.

  1. Learn the basics of F# by excluding the use of WPF. Learn how to write functions without using mutables and while statements and using function composition. Once you have this done learn how to make use of mutables to update state.

  2. Learn how to use WPF in F# by reading Learning WPF through F#, and vice versa, by John Liao.

If you can't find any code you like in F#, remember that F# is a descendent of OCaml so Google for OCaml and SVG, and you might find something of interest. While F# can't compile OCaml, it is very close and should not take much time to convert. I converted a large amount of OCaml to F# and all of it converted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.