Hello,
I see these codes in my book:
FixedPointList[# /. {s[x_][y_][z_] -> x[z][y[z]], k[x_][y_] -> x} &,
s[s][k][s[s[s]][s]][s]]
In my thought:
s[s][k][s[s[s]][s]][s]] only has one part, how can it generates s[x_][y_][z_] and k[x_][y_].
Hello,
I see these codes in my book:
FixedPointList[# /. {s[x_][y_][z_] -> x[z][y[z]], k[x_][y_] -> x} &,
s[s][k][s[s[s]][s]][s]]
In my thought:
s[s][k][s[s[s]][s]][s]] only has one part, how can it generates s[x_][y_][z_] and k[x_][y_].
Hi Zhenyu
Not sure what you mean by
s[s][k][s[s[s]][s]][s]] only has one part
To help understand the pattern matching take a look at
s[s][k][s[s[s]][s]][s] /. s[x_][y_][z_] :> {x, y, z}
(* {s, k, s[s[s]][s]}[s] *)
to see what matches x, y and z.
There are several combinator related functions in the Wolfram Function Repository to help visualize the evolution. e.g.
Magnify[ResourceFunction[
"CombinatorEvolutionPlot"][(ResourceFunction["CombinatorPlot"][#,
"FramedMatches", "SKGlyphs" -> {s, k}] & /@
ResourceFunction["CombinatorFixedPointList"][s[s][k][s[s[s]][s]][s], "SKGlyphs" -> {s, k}]),
"StatesDisplay"], .9]
Have you seen this.
Zhenyu,
The red s means the S combinator was applied. Similarly, the blue k means the K combinator was applied. There may be many parts in the expression that match S or K, the order in which they are applied results in a different evolution, but the same final result. This is discussed in detail in the “Updating Schemes and Multiway Systems” section in Stephen’s book.
Hi Rohit,
It’s too difficult to me. I decided to learn it after.