Adventure in parserland – parsing lambda expressions in F# – Part V
We are now going to look at a solution which is concise, efficient and gives sophisticated error messages. It is also less than 20 lines of code. We’ll be using FParsec. FParsec is a port of an Haskell...
View ArticleA simple scheme to implement Design by Contract in C++
Recently I got interested in C++ again. The new lambda functions in C++ 11 open up a world of opportunities for C++ programmers. I’ll talk more about how you can write functional code in C++ 11 in...
View ArticleWriting functional code in C++ – Records
This is the first of a series of posts about writing functional code in C++. My goal is different from FC++, which is a full fledged ‘environment’ to write functional code. Instead, I want to...
View ArticleWriting functional code in C++ II – Function composition
Function composition is at the core of functional programming. You start by being very confident that certain very small functions are correct, you compose them in well known ways and you end up being...
View ArticleLetter on investing
In 2007 I wrote a blog post on investing. During the last five years, my view evolved a bit. People often ask me how to get a financial education. This is the latest email I sent on the topic. From:...
View ArticleWriting functional code in C++ III – Performance of different allocation schemes
Now we know how to represent records and we know how to operate on them using a nice F# like syntax. But how do we store our record in a data structure in the first place? Code for this post is here....
View ArticleWriting functional code in C++ IV – Algebraic datatypes
And here comes the guilt bit. I have the strong suspicion (but not certainty) that what I am doing here can be done with templates, but didn’t take the time to do it. With that out of the way, let’s...
View ArticleWriting functional code in C++ V – Miscellaneous and conclusions
Just a couple of trivialities and my parting thoughts. Nested functions If your language has lambdas, you don’t need nested functions support because you can implement them using it. I am a heavy user...
View ArticleAnd now Andy has a blog …
For those of you interested in C++, Andy Sawyer now has a blog here. Here is an extended discussion on how to choose an STL container. Enjoy !!
View ArticleRetrieving SQL Server data with type providers and exposing it with ASP.NET...
For a good introduction on how to use Web APIs in F#, read here. The starting point for type providers is here. This post is about how I solved a practical problem using these technologies. First,...
View ArticleExceptions vs. Return Values to represent errors (in F#) – I – Conceptual view
Recently I’ve been reading numerous articles on the age old question of exceptions vs. return values. There is a vast literature on the topic with very passionate opinions on one side or the other....
View ArticleExceptions vs. Return Values to represent errors (in F#) – II– An example...
In the previous post, we talked about the difference between Critical and Normal code. In this post we are going to talk about the Critical code part. Ideally, we want: A way to indicate that a...
View ArticleExceptions vs. Return Values to represent errors (in F#) – III–The Critical...
Code for this post is here. In the last post we looked at some Critical code and decided that, albeit correct, it is convoluted. The error management path obfuscates the underlying logic. Also we have...
View ArticleExceptions vs. Return Values to represent errors (in F#) – IV – Implementation
The Critical monad is defined as follows. First there is the type that propagates through the monad: type Result<'a, 'b> = | Success of 'a | Failure of 'b Then we define the usual computation...
View ArticleLLite : language friendly literate programming
LLite : language friendly literate programming LLite : language friendly literate programming Luca Bolognese 22/11/2012 1 Main ideas 1.1 Unhappiness with existing tools 1.2 A different interpretation...
View ArticleFunctional programming in C
Functional programming in C – I Functional programming in C – I Luca Bolognese 19/12/2012 0.1 Discriminated unions in C 0.2 Nested functions and lambda variables 0.3 Automatic cleanup of local...
View ArticleFunctional programming in C – Implementation
Functional programming in C – Implementation Luca Bolognese 19/12/2012 0.1 Cleanup 0.2 Lambdas 0.3 Unions 0.1 Cleanup Let’s start simple with the cleanup function. First we need the usual barrage of...
View ArticleFunky C for literate programming
Funky C for literate programming Luca Bolognese 31/12/2012 1 Main ideas 2 Lack of tuples 3 Folding over arrays 4 Deallocating stuff 5 Discriminated unions 6 Main data structure 7 Tokenizer 8 Parser 9...
View ArticleRetrieving SQL Server data with type providers and exposing it with ASP.NET...
For a good introduction on how to use Web APIs in F#, read here. The starting point for type providers is here. This post is about how I solved a practical problem using these technologies. First,...
View ArticleExceptions vs. Return Values to represent errors (in F#) – I – Conceptual view
Recently I’ve been reading numerous articles on the age old question of exceptions vs. return values. There is a vast literature on the topic with very passionate opinions on one side or the other....
View Article