I’ve been reading this chapter for two days, and I still don’t understand why integers can access data in a way that we can’t understand!
Thank having a forum to communicate with.
In the above examples we only used 1
which access the root of the tree and returns the entire solution list.
$ brun '1' '("example" "data" "for" "test")'("example" "data" "for" "test")
However, every unquoted integer in the lower level language refers to a part of the solution.
You can imagine a binary tree of f
and r
, where each node is numbered:
1
/ \
/ \
/ \
/ \
/ \
/ \
2 3
/ \ / \
/ \ / \
4 6 5 7
/ \ / \ / \ / \
8 12 10 14 9 13 11 15
etc.
$ brun '2' '("example" "data" "for" "test")'"example"
$ brun '3' '("example" "data" "for" "test")'("data" "for" "test")
$ brun '5' '("example" "data" "for" "test")'"data"
And this is designed to work when there are lists inside lists too.
$ brun '4' '(("deeper" "example") "data" "for" "test")'"deeper"
$ brun '5' '(("deeper" "example") "data" "for" "test")'"data"
$ brun '6' '(("deeper" "example") "data" "for" "test")'("example")