Skip to content

Commit

Permalink
back out fancy/coffee function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Feb 26, 2013
1 parent 964cefd commit d2480d7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
20 changes: 13 additions & 7 deletions function.tml
@@ -1,44 +1,50 @@
%TestML 1.0
%TestML 0.1.0
# %DumpAst 1

Plan = 21

Label = 'Fruity Tests'

->
{
Label = 'Anonymous function never called'
True == False
}

test1 = (f, c, t) ->
test1 = (f, c, t) {
List(f, '->', c).Join == t
t.Strip(f).Strip('->') == c
t.Strip('->') == List(f, c).Join
}

test1.Type == 'Func'

Label = '$BlockLabel'

test1(*fruit, *color, *thing)

test2 = ->
test2 = {
thing ~~ color
}

test2(*color, *thing)

test3 = (a, b, c) ->
test3 = (a, b, c) {
f1(a) == b
f2(a) == c
}

test3(*input, *output1, *output2)

Label = 'Passing functions as objects'

test4 = (func, num) ->
test4 = (func, num) {
func.Type == 'Func'
func(num)
}

test5 = (num) ->
test5 = (num) {
num == 42
}

test4(test5, 42)

Expand Down
2 changes: 1 addition & 1 deletion semicolons.tml
Expand Up @@ -3,7 +3,7 @@

%TestML 0.1.0

Plan = 2;
Plan = 3;

'one' == 'one'
'two' == 'two';
Expand Down
6 changes: 3 additions & 3 deletions standard.tml
@@ -1,12 +1,12 @@
%TestML 0.1.0

Title = 'Test the TestML Standard Library'
Plan = 10
Plan = 12

True.OK
False.Not.OK
None.Not.OK
*lines.Lines.Count == 5
*lines.Lines.Count == 12
*foo.Lines.Join(' - ') == *bar
*foo.Lines.Reverse.Text == *baz
*foo.Lines.Sort.Text == *baz.Lines.Sort.Text
Expand All @@ -18,7 +18,7 @@ sail

away

### Standard Transforms
### Standard Calls
List
NOT

Expand Down
2 changes: 1 addition & 1 deletion types.tml
Expand Up @@ -20,5 +20,5 @@ b = False
b.Type == 'Bool'
l = List()
l.Type == 'List'
f = ->
f = {}
f.Type == 'Func'

0 comments on commit d2480d7

Please sign in to comment.