qi
qi copied to clipboard
Add pure runtime or "control" versions of all forms
All of Qi's forms can be fully specified syntactically, e.g. (>< sqr)
. But some of them can also be specified using flows encoded as input values (which we'll call "control" inputs) to these forms at runtime, e.g. (~> (-< (gen sqr) 1 2 3) ><)
. In this second version, the ><
form is specified purely at runtime, including the function to map over the input values which is provided here as a "control" input. This allows the ><
form to be controlled at runtime rather than determined at compile time.
Many Qi forms (such as pass
, feedback
, and more) already support full runtime specification, but many still don't. Review these and ensure that all forms that need to support this behavior, do.
Note to the reader: if you arrived here having encountered a case where you wanted a form to be controllable at runtime, please comment below and that form will be prioritized.
Cassie on the Racket Discord reports this case for group
: (lambda (x) (~> (data) sep (group (add1 x) selection-flo remainder-flo)))
We could either support this via the usual control inputs way:
(lambda (x)
(~> (data)
sep
(-< (gen (add1 x))
_)
(group selection-flo
remainder-flo)))
as well as:
(lambda (x)
(~> (data)
sep
(-< (gen (add1 x))
(gen selection-flo)
(gen remainder-flo)
_)
group))
Or we could potentially introduce a new way where designated parts of the form specification (e.g. in the case of group
, perhaps just the number of values to group) could be treated as Racket expressions.