Skip to content

Unexpected behavior when bindings are used in floe positions #181

@countvajhula

Description

@countvajhula

Qi binding in Racket expression

flow.rkt> (~>> (odd?) (as p) (range 10) (filter p))
; /Users/siddhartha/work/lisp/racket/qi/qi-test/tests/flow.rkt:11:16: let: duplicate identifier
;   at: p
;   in: (let ((p undefined) (p undefined) (p undefined)) (qi0->racket (thread (thread (esc (λ (p2) (set! p p2))) ground) (esc ((λ (v) (λ rest (apply v 10 (append rest (list))))) (contract (->* (real?) (real? real?) any) (range->cstream-prepare (cstream-next->li...

Expected: '(1 3 5 7 9)

Also, the expansion appears to have many duplicate bindings.

Qi binding in Qi expression

flow.rkt> (~> (odd?) (as p) (range 10) △ (pass p))
; filter: contract violation
;   expected: (any/c . -> . any/c)
;   given: #<undefined>

Expected: 1, 3, 5, 7, 9

(The error message should also implicate pass rather than filter.)

Using a Qi binding as a primitive flow

flow.rkt> (~> (odd?) (as p) p)
; compose: contract violation
;   expected: procedure?
;   given: #<undefined>
;   argument position: 1st
;   other arguments...:
;    #<procedure:composed>

Expected: arity error, 0 arguments provided to odd?, same as (odd?)

Bindings used in non-floe positions

flow.rkt> (~> (odd?) (as p) (gen p))
#<procedure:odd?>
flow.rkt> (~> (5) (as p) (gen p))
5

(works as expected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions