Hello,
I'm trying to write a simple module for the haskell web server (hws-
cgi).
And I would like to write a simple module that maintains some kind of
state for a session.
But I'm I write I cannot do this in pure Haskell ? Without adopting
the sources of the Haskell web server ?
I'll
pieter:
Hello,
I'm trying to write a simple module for the haskell web server (hws-
cgi).
And I would like to write a simple module that maintains some kind of
state for a session.
But I'm I write I cannot do this in pure Haskell ? Without adopting
the sources of the Haskell web
Hi
I understand the basic principle of recursion but have difficulty
with the following:
-- a recursive function
-- for calculating the length of lists
myLen [] = 0
myLen (x:xs) = 1 + myLen xs
What's happening here?
Top marks for a comprehensive jargon-free explanation.
Thanks in advance
Paul
On Feb 17, 2007, at 21:32 , P. R. Stanley wrote:
Hi
I understand the basic principle of recursion but have difficulty
with the following:
-- a recursive function
-- for calculating the length of lists
myLen [] = 0
myLen (x:xs) = 1 + myLen xs
What's happening here?
This definition uses
prstanley:
Hi
I understand the basic principle of recursion but have difficulty
with the following:
-- a recursive function
-- for calculating the length of lists
myLen [] = 0
myLen (x:xs) = 1 + myLen xs
So this is a definition for the 'length' function on lists.
The list data structure
http://www.thinkgeek.com/geektoys/cubegoodies/86b8/
Now you can really show your coders why unsafePerformIO is to be avoided!
-Nick
ps - Please don't consider this post a product advertisement or
endorsement of any kind.
___
Haskell-Cafe mailing list
The definition of myLen says:
myLen [] = 0
The length for an empty list is zero
myLen (x:xs) = 1 + myLen xs
The length of a list containing x and some other stuff (xs) is 1 +
(the length of the other stuff).
So basically, if you've got a list [1,2,3], it will try to do this:
myLen