lang/interpret_test/TestAstFunc2/good-unification.txtar
raw| 1 | -- main.mcl -- |
| 2 | $funcgen1 = func() { |
| 3 | func($b) { |
| 4 | $b + " " + "world" |
| 5 | } |
| 6 | } |
| 7 | |
| 8 | $funcgen2 = func() { |
| 9 | func($b) { |
| 10 | if $b == "hello" { |
| 11 | "hey" |
| 12 | } else { |
| 13 | $b |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | $funcgen3 = func() { |
| 19 | func($b) { |
| 20 | if $b == "hello" { |
| 21 | func() { |
| 22 | "hey" |
| 23 | } |
| 24 | } else { |
| 25 | func() { |
| 26 | $b |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | $fn1 = $funcgen1() |
| 33 | $out1 = $fn1("hello") |
| 34 | test "${out1}" {} |
| 35 | |
| 36 | $fn2 = $funcgen2() |
| 37 | $out2 = $fn2("hello") |
| 38 | test "${out2}" {} |
| 39 | |
| 40 | $fn3 = $funcgen3() |
| 41 | $out3 = $fn3("goodbye") |
| 42 | $name3 = $out3() |
| 43 | test "${name3}" {} |
| 44 | -- OUTPUT -- |
| 45 | Vertex: test[goodbye] |
| 46 | Vertex: test[hello world] |
| 47 | Vertex: test[hey] |