Sunday, March 22, 2009

A Giant Rock


Do I need to use synchronize primitives in F# MailboxProcessor ?

We don’t need any synchronizing primitives or additional synchronizing efforts to use F# Mailboxprocessor. I like to share a simple program which demonstrates that you don’t need care about synchronizing issues. Read more ....
www.paul-abraham.com/FSharpMailboxProcessor.doc

Sunday, February 22, 2009

Data Abstraction in F#

Data abstraction deals with the question, how to compose compound data from primitive types. SICP states : Data abstraction is a methodology that enables us to isolate how a compound data object is used from the details of how it is constructed from primitive data object. We will firstly implement a solution which is similar to the SICP text book (http://mitpress.mit.edu/sicp/). It uses tuples as primitive data structure. Indeed, tuples are very straightforward and powerful primitive data structure in functional programming ,but on the other hand, we have to consider, whether these primitives are suitable for .Net platform in the era of SOA or cloud computing.
Please check http://www.paul-abraham.com/FSharpCode2SICP.doc to get the whole series .

Monday, February 16, 2009

Mendelssohn's Workroom


This is the work-room of Felix Mendelssohn. I visted his home Leipzig . He wrote Elias in this room,yeah , a small room;but, with great impact:)

Saturday, February 14, 2009

WCF F# Examples

I like to share some WCF Examples which I have implemented in FSharp . I am going touch aspects of WCF by giving examples.

Example 1 15.02.2009
I like to show you in this example to setup a basic WCF service programmatically. We will add two channels(web service and tcp/ip) and enable metadata behavior which allows users to create proxy clients.
Download the source code(www.paul-abraham.com/FSharpWCFSimple1.zip) and compile it in shell command. Open the test client proxy by typing:
wcftestclient http://localhost:2008/SimpleService.

Read more www.paul-abraham.com/WCFProgrammingWithFSharp.doc

Monday, January 5, 2009

Domain Specific Languages with F#

Sourcecode: www.paul-abraham.com/DSLPolynomial.zip
Domain Specific Language (DSL) is a programming language which is applied on a specific area. Domain Specific Languages have habitually very small syntax and offers limited expressions, consequently it is very easy to learn and the user can focus on solving a problem rather than learning a fully fledged language. Pattern matching capabilities of F# and tools for parsing (fsyacc.exe) & lexing(fslex.exe) allow you create own DSL effortlessly. Martin Fowler has written a profound article in this subject (http://martinfowler.com/dslwip/UsingDsls.html).
read more www.paul-abraham.com/DSLPolynomial.doc

Sunday, December 7, 2008

Mutual Recursion in F#

Mutual recursion is an important concept in functional programming. It is useful if two function need to call each other. In the following example, I am calculating Fibonacci numbers in straight and mutual recursive fashion:
#light
// Straight Version
let rec fibonacci(n) =
if n<1>=0 "))
if n <=2 then 1 else fibonacci(n-1)+fibonacci(n-2)

let n=fibonacci(8)
printfn "%d" n

// mutual recursion version
let rec f(n)= if n=1 then 1 else g(n-1)
and g(n)= if n=1 then 0 else g(n-1)+f(n-1)

let mr_fibonacci(n)=f(n)+g(n)

let mr_d=mr_fibonacci(8)
printfn "%d" mr_d