One may use a Polish notation to flatten down the nested pairs of an arrow definition so to remove parenthesis.
For example, the arrow ((a → ( b → c )) → d)
is flattened as → → a → b c d
.
By using slash (/) as → and plus (+) as the atom separator, one may serialize the arrow definition into a string. Atoms may also contain %-encoded byte such as the reserved “/” and “+” characters.
hello
is the UTF-8 encoded 5 bytes length binary string “hello”/a+b
is a → b
, that is the arrow from “a” to “b” (“a” is the queue, b is the head)/c/a+b
is c → (a → b)
, that is the arrow linking “c” to the arrow a→b//a+b+c
is (a → b) → c
, that is the arrow linking the arrow a→b to “c”/a/b+c
is a → (b → c)
, that is the arrow linking “a” to the arrow linking b→c/a//b+c+d
is a → ((b → c) → d)
//a/b+c+d
is (a → (b → c)) → d
Ambiguous expressions are solved by following the rules bellow.
/a+
is a → ''
/+a
is '' → a
/+
is '' → ''
/a/b+c
is a canonical string corresponding to a → (b → c)
/a/b+c+d
is an ambiguous string with an additional atom. It is parsed as: a → ((b → c) → d)
/a/b+c+d+e
is parsed as: a → (((b → c) → d) → e)
, hote how the rule tends to form a left-leaning tree of atoms./a+b/c+d
is (a → b) → (c → d)
/a/b+c/d+e
is a → ((b → c) → (d → e))
/a+b/c+d/e+f
is ((a → b) → (c → d)) → (e → f)
/a/b/c+d
is a → (b → (c → d))
/a+b+c/d+e
is ((a → b) → c) → (d → e)
/a+b+c/d+e/f+g
is ((a → b) → c) → ((d → e) → (f → g))
/
is 0
/a/
is a → 0
/a+b/
is (a → b) → 0
/a/b/
is a → (b → 0)
/a
is a → ''
//a+b
is (a → b) → ''
/a+b/c
is (a → b) → (c → '')
/a/b/c
is a → (b → (c → ''))
/a/b/c/d
is a → (b → (c → (d → '')))
/a/b+c/d
is a → ((b → c) → (d → ''))
/a+b//c+d
is (a → b) → ((c → d) → '')
+
= /+
= ('' → '')
(empty rule & extra + rule & empty rule)++
= '' → ('' → '')
(empty & extra + & empty & extra)//a
= (a → '') → ''
(uncomplete rule twice)//
is 0 → ''
(the second / is empty, it’s the tail of the first / which has no head)///
= (0 → '') → ''
(zero rule & uncomplete rule twice)a/
= a → 0
(extra empty pair)/a/
= a → 0
(extra empty pair)/a+b//
= (a → b) → (0 → '')
(extra pair, zero, uncomplete pair)/a//
= a → (0 → '')
+a
= '' → a
(empty & extra + rule)a+
= a → ''
(extra + & empty)a++
= (a → '') → ''
(extra + & empty & extra + & empty)/a+/
= (a → '') → 0
(zero extra pair)'+/a+b'
= '' → (a → b)
(empty & extra atom)'a+b/'
= (a → b) → 0
(extra zero pair)'a+b+c'
= (a → b) → c
(extra & extra atom)'a+b/c'
= '//a+b/c+'
(extra & extra uncomplete pair)'a/b+c'
= '/a/b+c'
(extra pair)'a+/b+c'
= '//a+/b+c'
(extra pair)'a/b'
= '/a/b'
= '/a/b+'
= a → (b → '')
(extra & uncomplete)'a/b/c/'
= '/a/b/c/'
= a → (b → (c → 0))
(extra & extra & uncomplete)The textual representation of arrows is roughly compatible with file or URI pathes, especially by using ‘.’ instead of ‘+’.
/some/path/file.ext
= (some → (path → (file → ext)))
/path/to/dir/
= (path → (to → (dir → 0)))
/some/path/to/file.txt.gz
= (some → (path → (to → ((file → txt) → gz)))
Please note file.txt
and /file.txt
are the same arrow. Additional conventions may be needed to distinguish absolute paths and relative pathes
In the notation above, blobs may be identified either by their full content or by their hexademical-encoded footprint introduced with a ‘$’ character.