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

Daniel Fischer daniel.is.fischer at web.de
Sun Dec 30 14:07:44 EST 2007


Am Sonntag, 30. Dezember 2007 19:31 schrieb Cristian Baboi:
> On Sun, 30 Dec 2007 20:24:23 +0200, Daniel Fischer
>
> <daniel.is.fischer at web.de> wrote:
> > Am Sonntag, 30. Dezember 2007 19:04 schrieb Cristian Baboi:
> >> On Sun, 30 Dec 2007 20:00:05 +0200, Daniel Fischer
> >>
> >> <daniel.is.fischer at web.de> wrote:
> >> > Am Sonntag, 30. Dezember 2007 18:16 schrieb Cristian Baboi:
> >> >> A simple question:
> >> >>
> >> >> Can you write the value of x to a file where x = (1:x) ?
> >> >
> >> > Not in finite time and space :)
> >>
> >> I used the word 'value' by mistake.
> >> A notation of the value of x.
> >
> > I suppose
> > let x = 1:x in x
> > is not what you're after?
>
> Yes! Can Haskell do the same ?
>
> 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?
What do you mean by 'notation'? 
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?



More information about the Haskell-Cafe mailing list