jaredpar's WebLog

Code, rants and ramblings of a programmer.

Browse by Tags

Tagged Content List
  • Blog Post: Discriminated Unions in C++

    Earlier this week I started writing a function which needed to represent three states in the return value, two of which had an associated value. In my mind I immediately came to the following solution type BuildAction = | Reset | LinkOneWithNext of Statement | LinkManyWithNext of Statement seq...
  • Blog Post: Improving the display of F# seq<T>’s in the debugger

    F#’s seq<T> expressions are a frustrating item to inspect at debug time.  A seq<T> value is a collection and when users inspect such a value at debug time they want to see the contents of the collection.  Instead they are often presented with a view resembling the following The...
  • Blog Post: Converting System.Func<T1..TN> to FSharpFunc<T,TResult>

    Interop of delegate style types between F# and other .Net languages is a pain point that results from a fundamental difference in how delegates are represented in the F# language.  Typical .Net languages like C# see a delegate as taking 0 to N parameters and potentially returning a value. ...
  • Blog Post: Having fun with events in F#

    Recently I ran into a situation where I needed to handle some events in F# in a special way.  In this particular case I wanted to be able to disable and re-enable my handler based on changes in the program.  Essentially the C# equivalent of continually adding and removing the handlers. ...
  • Blog Post: Making F# type inference friendly for C#

    One of my current hobby projects, VsVim , requires me to make a lot of calls between F# and C# projects.  The core Vim engine is a pure F# solution based on Visual Studio’s new editor.  It additionally has a small hosting layer and a large test bed both written in C#.  When working with...
  • Blog Post: Using F# Discriminated Unions in C# (Beta2)

    While updating my VsVim editor extensions for Beta2 [1] I got hit by a change in the way F# exposed discriminated unions in metadata.  My extension consists of a core F# component with a corresponding set of unit tests written in C#.  It’s mostly API level testing and as such I use a lot of...
  • Blog Post: Vim Emulator Editor Extension Released

    I just released version 0.5.0 of VsVim: a vim emulation editor extension for Visual Studio 2010 Beta1 written in F#. This is a hobby project I’ve been working on for awhile now. I expect to continue updating this release as time goes on as I use it on a daily basis and I’m interested in getting back...
  • Blog Post: Mapping LINQ to F#

    In my projects with F#, I often find that I know exactly what type of sequence transformation I want to run, yet I spend all of my time trying to find it!!!  The problem is I’m used to query comprehensions in LINQ terminology.  Select, Where and SelectMany are so ingrained into my programming...
  • Blog Post: Comparing Continuations in C# and F# Part 3: Double wrong

    Is it better to be wrong once or to be right then think you’re wrong but find out you were right but wrong about being wrong? Besides the obvious be right the first time, it’s certainly an educational experience.  Here’s the original sample: let FoldRight combine (sequence:seq<'a>) acc = ...
  • Blog Post: Comparing Continuations in C# and F# Part 2

    In my last post I went over the differences between using a continuation in F# and C# . As it turns out I was right about the limits and symptoms but wrong about the reason. The F# code does indeed generate tail calls for part of the continuation. However this is only a very small portion of the actual...
  • Blog Post: Comparing Continuations in F# and C#

    Lately I’ve been playing quite a bit with F#.  I have several hobby projects I’m working on that take up a bit of my time.  But when I’m not playing around with F# I’m exploring ways to apply certain functional patterns to actual coding on the job and/or porting to my functional library: RantPack...
  • Blog Post: Functional C#: Providing an Option Part 2

    In my previous post I discussed creating an Option style construct for C#/.Net.  This post is a followup with the complete code snippet.  It’s been updated in response to several bits of feedback I received.  Namely Option is now a struct vs. class Added equality metrics Allowing implicit...
  • Blog Post: Unfold

    F# has a handy method called Unfold.  Think of it as the logical opposite of an Aggregate function.  Aggregates take a sequence of elements and convert them to a single element.  An unfold method will take a single element and turn it into a (potentially infinite) sequence of elements...
  • Blog Post: Functional C#: Providing an Option

    Sorry for the terrible pun in the title.  I wanted to blog about developing an F# style Option class for C# and I couldn't resist. The basics of an Option class are very straight forward.  It's a class that either has a value or doesn't.  It's almost like nullable but for every type and...
  • Blog Post: Euler #2

    Problem #2 came quite a bit faster. The yield syntax in F# is very similar to the C# iterator syntax and made translating this sample a breeze.  As a commenter posted, in problem #1, I would've been better served to use Seq.filter as opposed to Seq.choose for the purpose of filtering list. ...
  • Blog Post: Debugging F# list's

    One of the lacking's of the latest F# CTP is debugger visualization support for the built-in list types.  Viewing a list in the debugger is decidedly tedious compared to the mscorlib collection classes.  Take the following quick code sample module Main = do let l1 = [0..4] let l2 = List...
  • Blog Post: Euler and F#

    I've been looking for some new problems to work on in F# to get more comfortable with the language.  I've been rather slack of late because of other projects but I had a little bit of time this week.  I decided it would be fun to join the crowd and play away at the problems on the project euler...
  • Blog Post: F# CTP First Impressions

    I had a little bit of time this weekend to download the F# CTP.  The IDE portion of the CTP is a huge improvement over the previous CTP.  In particular the intellisense engine feels much more smooth, is available in new places and has much better results.  Project engine also has better...
  • Blog Post: F# CTP Released

    A new version of the F# CTP was released today. There are a lot of new improvements to the language and project system. Check it out here
  • Blog Post: ImmutableStack in F# Part 2

    I'm a bit busier than I thought I would be after returning from vacation.  But I had a little bit of time to play around with the implementation again today.  Thanks to all the suggestions in the comments from the previous post .  This version has a couple of improvements including Removing...
  • Blog Post: ImmutableStack in F#

    When learning a new language I find it very instructive to re-code certain structures from my well used libraries into the new language.  It gives a great basis for comparison in terms of ease of implementation, expressiveness of the language and sheer ease of implementation.  So on that note...
  • Blog Post: Learning a new Language: F#

    Time again to learn a new language.  I enjoy picking up a new language every now and again.  It's a great way to branch out your skill set and usually leads to new programming techniques in languages that are a part of professional or hobby life. But why bother?  The popular languages...
Page 1 of 1 (22 items)