From c458efe6c36ee0915c6a025c75c10301a95aaf55 Mon Sep 17 00:00:00 2001 From: Siddhartha Date: Fri, 13 Sep 2024 14:16:17 -0700 Subject: [PATCH] Fix binding used in a floe position in `pass` We investigated and fixed this in the Qi meeting today. It was another "vindaloo" with currying evaluating its arguments at compile time when the binding is still `undefined`. We fixed it in the usual way of replacing currying with a lambda. This is one of the issues identified in #181. --- qi-lib/flow/core/compiler.rkt | 5 ++++- qi-test/tests/flow.rkt | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/qi-lib/flow/core/compiler.rkt b/qi-lib/flow/core/compiler.rkt index 85edd46c9..0c98f91b2 100644 --- a/qi-lib/flow/core/compiler.rkt +++ b/qi-lib/flow/core/compiler.rkt @@ -405,7 +405,10 @@ the DSL. [_:id #'filter-values] [(_ onex:clause) - #'(curry filter-values (qi0->racket onex))])) + #'(λ args + (apply filter-values + (qi0->racket onex) + args))])) (define (fold-left-parser stx) (syntax-parse stx diff --git a/qi-test/tests/flow.rkt b/qi-test/tests/flow.rkt index a1028004f..f7e765380 100644 --- a/qi-test/tests/flow.rkt +++ b/qi-test/tests/flow.rkt @@ -472,15 +472,15 @@ (filter p))) odd?) (list 1 3 5 7 9)) + (test-equal? "binding a value used in a floe position" + ((☯ (~> (as p) + (range 10) + △ + (pass p) + ▽)) + odd?) + (list 1 3 5 7 9)) ;; See issue #181 - ;; (test-equal? "binding a value used in a floe position" - ;; ((☯ (~> (as p) - ;; (range 10) - ;; △ - ;; (pass p) - ;; ▽)) - ;; odd?) - ;; (list 1 3 5 7 9)) ;; (test-exn "using a qi binding as a primitive flow" ;; exn:fail:contract:arity? ;; (thunk ((☯ (~> (as p) p)) odd?)))