aboutsummaryrefslogtreecommitdiff
path: root/examples/strfib.c
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-01-02 19:24:13 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-01-02 19:24:13 +0300
commit0c32a26c9a43b2d45968b9ac59b8916c1d4092d1 (patch)
treeba7d6ef7f3749a42a6118c35996f2931aa4f83e2 /examples/strfib.c
parent6b08e86c9a16bfac5a208a04926dcc66b861a096 (diff)
downloadcsx-0c32a26c9a43b2d45968b9ac59b8916c1d4092d1.tar
csx-0c32a26c9a43b2d45968b9ac59b8916c1d4092d1.tar.xz
csx-0c32a26c9a43b2d45968b9ac59b8916c1d4092d1.zip
.
Diffstat (limited to 'examples/strfib.c')
-rw-r--r--examples/strfib.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/examples/strfib.c b/examples/strfib.c
deleted file mode 100644
index 6e22c7f..0000000
--- a/examples/strfib.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <csx/csx.h>
-#include <stdio.h>
-
-
-static csx_type_function_list *l;
-static csx_type_function_string *s;
-static csx_type_function_atom *a;
-static csx_type_function_evaluate *e;
-
-static char *append;
-static char *define;
-static char *cdr;
-static char *ifx;
-static char *not;
-
-void printfibs(char *strfib)
-{
- const char *input = "oooooooooo" + 9;
- int i;
- for (i = 0; i != 10; ++i)
- puts(e(l(strfib, s(input - i), 0)));
-}
-
-void process()
-{
- char *strfib = a("strfib");
- char *n = a("n");
- e(l(define, l(strfib, n, 0),
- l(ifx, l(not, n, 0), s(""),
- l(ifx, l(not, l(cdr, n, 0), 0), s("o"),
- l(append, l(strfib, l(cdr, n, 0), 0),
- l(strfib, l(cdr, l(cdr, n, 0), 0), 0), 0),
- 0),
- 0),
- 0));
- printfibs(strfib);
-}
-
-int main()
-{
- l = csx_list;
- s = csx_string;
- a = csx_atom;
- e = csx_evaluate;
- append = a("append");
- define = a("define");
- cdr = a("cdr");
- ifx = a("ifx");
- not = a("not");
- process();
- csx_free();
- return 0;
-}