Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- cb:
- node:
- node;"value".cb;!
- node;"left".nil=~[node;$"left".cb;visit;!node:]?
- node;"right".nil=~[node;$"right".cb;visit;!node:]?
- ]visit:
- \d: d; "value" 4 ,
- \e: e; "value" 5 ,
- \f: f; "value" 6 ,
- \g: g; "value" 7 ,
- \b: b; "value" 2 , b;"left"d;, b;"right"e;,
- \c: c; "value" 3 , c;"left"f;, c;"right"g;,
- \a: a; "value" 1 , a;"left"b;, a;"right"c;,
- a; ["value: "print;!println;!] visit;!
- this program prints:
- value: 1
- value: 2
- value: 4
- value: 5
- value: 3
- value: 6
- value: 7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement