[Haskell-cafe] Transformation sequence

Andrew Coppin andrewcoppin at btinternet.com
Sat Oct 20 15:05:37 EDT 2007


Brent Yorgey wrote:
>
> Hmm... I'm having trouble understanding exactly what you want.  In 
> particular, I don't understand what this statement:
>
> "But what I *really* want is to print out the transformation *sequence*."
>
> has to do with the pseudocode that you exhibit later.  Could you 
> perhaps clarify a bit more, or give a specific example?

I want to construct a program that prints out something like this:

[\fx -> f(fx)]
[\f -> [\x -> f(fx)]]
[\f -> S[\x -> f][\x -> fx]]
[\f -> S(Kf)[\x -> fx]]
[\f -> S(Kf)f]
S[\f -> S(Kf)][\f -> f]
S(S[\f -> S][\f -> Kf])[\f -> f]
S(S(KS)[\f -> Kf])[\f -> f]
S(S(KS)K)[\f -> f]
S(S(KS)K)I

I can quite happily construct a program which, given the first line, 
yields the last line. But getting it to print all the intermediate steps 
is harder. And, like I said, when something is "hard" in Haskell, it 
usually means you're doing it the wrong way... ;-)



More information about the Haskell-Cafe mailing list