From 3b415e52da3de11cf9203176791435473e48af8f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 11 Apr 2024 12:41:05 -0700 Subject: [PATCH] Fixed issue with lambdas --- examples/map.modal | 8 ++++++++ src/modal.c | 1 + 2 files changed, 9 insertions(+) create mode 100644 examples/map.modal 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); }