Skip to content

Commit

Permalink
New syntax for #%deforestable distinguishing floe positions
Browse files Browse the repository at this point in the history
Based on recent discussions, as a general maxim:

  Our core language should be rich enough
  to express desired optimizations.

Initially, as this wasn't the case, we were performing deforestation
by matching host language forms. This of course meant that we were
constrained to Racket syntax in such functional operations. Now that
we are broadening our core language to express deforestation, in
keeping with the above maxim, we would prefer to support Qi syntax in
function positions in these operations.

Towards this goal, this new syntax for the `#%deforestable` core form
introduces support for `floe` positions.

Right now, it simply segregates arguments into `expr` and `floe`
positions so that these are appropriately expanded. The code
generation still matches the name of the functional list
transformation (e.g. `map`, `filter`) and "hardcodes" the known
invocation of the corresponding underlying operation. Eventually we
hope to make deforestation user-extensible to arbitrary functional
list (at least) operations. At that stage, we wouldn't have this kind
of standard information that we could leverage during code generation,
so we will need to modify the syntax of `#%deforestable` to encode
enough information to be able to perform appropriate code generation
for arbitrary user-defined operations. We are not there yet :)
  • Loading branch information
countvajhula committed Aug 2, 2024
1 parent 4edc552 commit 7f4c3a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qi-lib/flow/extended/expander.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ core language's use of #%app, etc.).
(esc ex:racket-expr)

;; core form to express deforestable operations
(#%deforestable (name:id arg:racket-expr ...))
(#%deforestable name:id (f:closed-floe ...) (arg:racket-expr ...))
(#%deforestable name:id (f:closed-floe ...+))
(#%deforestable name:id)

;; backwards compat macro extensibility via Racket macros
Expand Down

0 comments on commit 7f4c3a3

Please sign in to comment.