dokondr's blog

Haskell on Pocket PC?

Submitted by dokondr on Thu, 03/30/2006 - 6:37am.

Any ideas on how much work needs to be done for using Haskell on PPC Windows Mobile platform?
It would be interesting to use PPC as:
1) Haskell learning tool, so small code snipets could be entered and run directly on hand-held (REPL). How hard is it to port Hugs to PPC for this? Do any other (then Hugs) implementations exist that are easier to port?
2) Running on PPC Haskell applications cross-compiled on host PC. How much work must be done for GHC to support this?

3) There are several ways both for porting Haskell to PPC as well as cross-compiling Haskell code. Which one makes more sense to implement and will take less effort:
a) Porting/compiling to VM byte code (Java, Parrot)?
b) Porting/compiling to .NET CLR?

4) And finally, do any projects already exist in this area?

Newbie: Recursive lambda definitions?

Submitted by dokondr on Sat, 03/18/2006 - 1:04pm.

Haskell newbie: Recursive lambda definitions?
Simon Thompson gives the following exercise (10.9) in his "Haskell. The Craft of Functional Programming" book:

10.9 Define a function total

total:: (Int -> Int) -> (Int -> Int)

so that total f is the function which at value n gives the total

f 0 + f 1 + ... + f n

I use 'where' clause to describe the resulting function 'tot':

total:: (Int -> Int) -> (Int -> Int)
total f = tot 
    tot n
	| n >= 0 = (f n) + (tot (n-1))
	| otherwise = 0

test = total f1 4

Q: Is it possible instead of naming and defining a resulting function (such as 'tot' in this example) just use recursive lambda definition? In this example recursion is required to create a function which is a variable sum of another function applications like:

f 0 + f 1 + ... + f n

Giving function a name ('tot' in this case) makes recursive definition possible. But what about lambda recursion? Can it be defined?