-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfun.m
34 lines (28 loc) · 789 Bytes
/
fun.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// fun.m
//
// A little fun test for interacting with static variables.
//
// © Copyright 2011 Joshua Ballanco. See COPYING for license information.
//
#import <Foundation/Foundation.h>
#import "y.h"
int main(int argc, const char *argv[])
{
if (argc < 2) {
printf("Usage: fun <num>\n");
exit(1);
}
__block int limit = atoi(argv[1]);
static int count = 0;
RecurBlock count_until = YComb(^{
if (count < limit) {
printf("%i\n", ++count);
this_block(NULL);
}
return;
});
printf("I can count to %d!\n", limit);
count_until(NULL);
return 0;
}