diff --git a/examples/map.modal b/examples/map.modal new file mode 100644 index 0000000..ba064f7 --- /dev/null +++ b/examples/map.modal @@ -0,0 +1,8 @@ +<> (foo ?x) (?x) +<> (map ?x (list ?l)) (map/l map/x ?x ?l) +<> (map/x ?x (?h ?t)) (?x ?h (map/x ?x ?t)) +<> (map/x ?x (?h)) (map/r (?x ?h)) +<> (?h (map/r ?t)) (?map/r (?h ?t)) +<> (map/l map/r ?l) (list ?l) + +map foo (list (1 (2 (3 (4 (5)))))) \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index 73f7656..0e7887e 100644 --- a/src/modal.c +++ b/src/modal.c @@ -177,6 +177,7 @@ rewrite(void) if(s[0] == '?' && s[1] == '(') { r = λ s = create_rule(&lambda, -1, s) + 1; + while((c = *s) && c <= ' ') s++; if((res = match_rule(&lambda, s)) != NULL) return write_rule(&lambda, last, res); }