TP

# F# quotations visualizer

I already explained what F# quotations are and I explained how you can do some simple manipulations with it. In this article I'd like to present an application that I wrote and that can be helpful when working with quotations. It displays clear graphical representation of given F# quotation (using Windows Forms TreeView control).

Published: Wednesday, 21 June 2006, 2:20 AM
Tags: meta-programming, f#

# Calling functions in LINQ queries

The LINQ Project [^] is an extension to .NET Framework and most important .NET languages (C# and VB.Net) that extends these languages with query operators and some language features that make it possible to integrate queries in the languages. Thanks to LINQ you can write queries that read data from database (or any other data source). For example, imagine that you want to write set of queries for eshop and you need to perform a price calculation in more queries. The problem with LINQ queries is that you can't simply call a function written in C# that calculates price. The following example is NOT WORKING for this reason:

// function used in filter
static decimal CalcPrice(Nwind.Product p)
{
return p.UnitPrice * 1.19m;
}
// query that uses MyFunc
var q =
from p in db.Products
where CalcPrice(p) > 30m
select p


I think that this is a big limitation, because when you want to keep some more complex logic in the data access layer you should be able to reuse parts of queries that are similar across more queries. The good thing is that with latest release, LINQ became extensible so it is possible to write a extensions that allow this scenario...

Published: Saturday, 10 June 2006, 2:26 PM
Tags: c#

# Slides and demos from F# presentation

This semester I attended Advanced .NET Seminar that was led by Tomas Matousek [^] who is one of the authors of Phalanger project [^] (Which is an amazing project by the way. It takes PHP source code and compiles it without any modification to .NET). Seminar was mostly focused on Rotor and .NET internals, so if you want to learn more about these topics you can look at Advanced .NET programming [^] slides (by Tomas Matousek).

I did one presentation at this seminar too. It was about the F# language developed at Microsoft Research. It was just a quick overview of F# features, because F# is very rich topic, so it coveres only the language (functional vs. imperative behavior), F# type system, compilation of F# constructs to .NET and interoperability with .NET (for example how to create windows forms application in F#). At the end, I also mentioned F# meta-programming that allows you to look at F# code as data.

Published: Friday, 9 June 2006, 9:14 PM