[Haskell-cafe] Re: Wikipedia on first-class object

Cristian Baboi cristi at ot.onrc.ro
Mon Dec 31 01:45:43 EST 2007


On Sun, 30 Dec 2007 21:07:44 +0200, Daniel Fischer  
<daniel.is.fischer at web.de> wrote:

> Am Sonntag, 30. Dezember 2007 19:31 schrieb Cristian Baboi:

>>
>> I mean this:
>>
>> module Module where
>>
>> a= let x=1:x in x
>>
>> main = <do something to write a (a notation for a) to file>
>>
>> The function must work if one change a to let x=2:x in x, let x=1:2:3:x
>> and variations on the same theme.

> Can Java, C?

I think most of us can write a C program that can print circular lists.


> What do you mean by 'notation'?

I might have used the wrong word.
Can you write the NUMBER 1 on a piece of paper ?
I think you cannot. You must use some encoding for it.
The same thing with  let x = x in x.

How can one print numbers in Haskell ?
I don't understand.

When I say print (2+4), why 6 is printed and not 10 - 4 ?


> Would
> main = do
> 	txt <- readFile "Module.hs"
> 	let definitions = parseModule txt
> 	case lookup "a" definitions of
> 	  Nothing -> putStrLn "No definition for a"
> 	  Just rhs -> writeFile "Notation.hs" (prettyprint rhs)
> satisfy you?

Yes, but there is a little problem with 'txt<- readFile "Module.hs" and  
case lookup "a" ... '
You see, I don't know if I must print a or b.


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
http://www.eset.com


More information about the Haskell-Cafe mailing list