1 / 5
Mar 2011

Hello,
I hope I'm not breaking any forum rules by making this post. This is an act of desperation, you will see why when I explain my situation. Please at the very least read my post, I'm only asking for advice, I'm not asking you to do my work for me.
I'm an IT student in my last year, I have a thesis due in 3 weeks. The topic of the thesis is "Practical programming experiments in F#"
I am a reasonably skilled programmer, when it comes to OOP (C#, Java) I have about 1 year of work experience as a C# programmer.
But I don't know anything about functional programming. I went through "Survival F#", and am currently reading through "Real world functional programming" and "Beginning F#". I think I'm starting to understand the concepts behind functional programming, but so far I have no idea how or where to use them.

My thesis supervisor - the one who I should be consulting this with - is a really knowledgeable guy, he's got about 10 MVP awards hanging on his wall. But he's extremely busy and has a unique policy for communicating with students (it's pretty close to "talk to the hand" )
- he does not reply to emails
- he does not pick up his phone
- he is not present at his offcie during his official office hours

Basically the only way I'm ever able to talk to him is if I stalk him when he gives lectures, and talk to him after the lectures (which is usually in a loud crowded corridor while we're walking towards his office)
he basically tells me the same thing every time.
1. he tells me we can't have a consultation until I produce something and send it to him first, so we can discuss it.
2. he gives me a set of instructions on what it is I should do (firing at high speed, usually not letting me speak). These instructions usually vary every time we talk.

There is no dialogue with this guy (believe me, I've tried) no "I could do this or this, which one would be better?" or "would this be acceptable? Is this complex enough?"
Here's what I'm supposed to do:
I am to create a set of practical examples - analysis->design->implementation - of solving some problem, implementing some algorithm, in F# using functional approach.
At first he said things like "should be as complex as possible" but the last time I've talked to him he said "these examples should be fairly simple so that you don't have any problems with them". He also said the exampless should ideally involve parallel execution, since functional programming is well suited for that.
My problem is - examples of what? Putting aside the fact that I can do little more than Hello World in F#, I don't know what kind of problems the functional paradigm is suited for, what would demonstrate its benefits.
What I'm asking for are ideas (concrete ideas) like "do this and this, it's really easy in functional programming and rather cumbersome in OOP" Something an non-mathematician could understand.
If you know a site where such examples of functional programming are discussed, that would be of huge help as well. Please don't tell me to google it, I've been doing that so far unsuccessfully, so I started googling functional programming forums.
I'm not asking for source code - although if anyone could provide code in F# or OCaml, that would be fantastic, I'd kiss that person's legs.

Let me just add that passing or failing at this school depends on this thesis. Failing would have dire consequences for me, I won't go into details.
I hope my plea for help wasn't too unreasonable, and that I will find someone able and willing to help me here.
Thank you in advance.

  • created

    Mar '11
  • last reply

    Aug '11
  • 4

    replies

  • 807

    views

  • 4

    users

  • 3

    links

Well, then it is time to do something. You have plenty of opportunities here. Pick a number of simpler problems and start solving. You will find out yourself in which case F# or any other func. language is suitable or it is better to code in C/C# or similar. Learning by doing.

hello, so I've picked my topic, it's gonna be fractals and similar things. they aren't that hard to code, they are naturally functional, and they look nice. Now I'm battling with existing examples which by large I cannot get to compile. For instance this one:
tomasp.net/blog/infinite-cheese.aspx1
there is a block of code that's errorneous (just one):

// Returns a cube with filtered sides
let private get_cube(incl_sides) =
[ for (side,trigs) in cube
when Set.mem side incl_sides
->> trigs ]

the when keyword is underlined, and the error message goes as follows:
Unexpected keyword 'when' in expression. Expected '->' or other token.

I won't sugarcoat it, I don't understand the syntax of this code. Any ideas what could be wrong, and how to fix it? In an effort to understand the code, I searched the language specs. As far as I know, there is nothing about the Set.mem function or the ->> operator.

4 months later

Hi, the code you posted uses an old syntax of list generators. When and --> are not used anymore and have been substituted by, respectively, if and yield. Thus, the code above could be rewritten as:
[
For (side, trigs) in cube do
If (set.mem side incl_side) then
Yield trigs
]

By the way, if you are still interested in understanding better this syntax (and F# in general) you might want to take a look at http://www.amazon.com/Friendly-Fun-game-programming-ebook/dp/B005HHYIWC/ref=sr_1_12?s=digital-text&ie=UTF8&qid=1313593351&sr=1-122 (also available here: http://www.smashwords.com/books/view/817651). I'm a coauthor of the book and we have written this book with students like you in mind. The book discusses a series of game-related problems such as bouncing ball, asteroid field, starships, etc. to present the various constructs of the F# language. The book shows the most important features of the language: functions, tuples, lists (lists generators included wink ), discriminated unions and even computation expressions (monads). In the last two chapters we use XNA to build a 2D and 3D renderer for two of the samples we have seen.
The book is recommended for programmers who are already familiar with an imperative programming language, but it may also be read by complete beginners to programming (but they should study, not only read, the book). Also, the in-depth discussion about computation expressions (monads) might be of interest even for seasoned functional programmers.
By the way, the book is relatively short and cheap, so I think you should at least take a quick look at the links above. smile

Giulia