Define deforestable runtime#207
Open
dzoep wants to merge 70 commits into
Open
Conversation
- extend the info struct to contain syntax with CPS runtime reference (as a bound identifier) - amend define-deforestable to allow lambda with CPS runtime - move map-cstream-next into define-deforestable of map form fix fallback codegen to properly match on extended info struct
- filter - filter-map - take - require racket/contract/base to allow virtual contract failures within the deforested pipeline - needed by take
- extend the deforestable-info with `kind` field
- when `'T`, it is a transformer
- add #:transformer, #:producer, and #:consumer keywords to define-deforestable
- use #:transformer to define all transformers in list.rkt
- remove all old remaining transformer classes:
- `fst` (from cps.rkt)
- `fst-filter-map`, `fst-map`, and `fst-take` (from syntax.rkt)
- add new `fst-new` syntax class providing both:
- ability to match deforestable transformers within a sequence
(see `make-deforest-rewrite` in fusion.rkt)
- providing all attributes needed for generating fused operation
(see `deforest-pass` in cps.rkt)
- add `filter-not` form using (define-deforestable #:transformer ...) - add test for it (including support predicate)
- documentation: - new `list-tail` form with `drop` alias - add all new forms to the overall grammar - document previously added `filter-not` form - deforested `list-tail` - add the new form using (define-deforestable #:transformer ...) - provide it twice - including variant as `drop` - tests - deforested sequence including `list-tail` - testing functionality with basic use-cases
- remove make-producer-curry - remove make-blanket-curry - simplify make-fine-curry - make both producers' prepare a lambda instead of case-lambda
- remove make-fine-curry - add preliminary producer state expression to the syntax classes - remove unused attributes of range syntax class
- simplify contract to specify only in-flow arguments (none for range, list? for implicit producer) - merge `curry` and `prepare` attributes (and prepare's runtime) into the `prepare` attribute - simplify `deforest-pass` - remove curry - fill-in contract details - cleanup consing - remove runtime implementations for producers' prepare - start preliminary work on `fsp-new`
- remove range->cstream-next - support producer-specific identifiers
- implement rest alias for (list-tail 1) - implement cdr, cddr, cdddr, cddddr, and cdddddr aliases - document the new aliases
- add prepare field to deforestable-info struct - expand arguments upon matching actual deforestable producer (range) - copy deforestable-clause-parser temporarily to deforest/syntax.rkt - add separate define-deforestable #:producer pattern
THIS IS BROKEN WORK IN PROGRESS - move list->cstream-next into list.rkt as define-deforestable (list->cstream) - matching (#%deforestable ...) on the injected list->cstream->cstream-next does not work - the naming issue is not the probllem (this IS the generated name for the moment) - (list->cstream->cstream-next) is injected in fusion.rkt, lines 63-76 - generate-fused operation sees only the identifier, not the expanded form (to core language) - those loops thru hoops with local-expand and friends are just one of many random attempts
- use expand-flow from invoke submod flow/extended/expander - expand both use-cases in fusion.rkt - fix fsp-new pattern - #%deforestable - NOT #:deforestable - explicitly name the info struct for producers
- remove original fsp syntax class - remove unused requires from cps.rkt - remove unused list->cstream-next producer runtime - fix and remove unused requires in syntax.rkt - remove fsp-* syntax classes - reduce fsp-new attributes
…not use syntax quote on prepare.
…n as documentation and other parts of the deforestation infrastructure.
…me as in racket/list documentation (in each section).
dzoep
marked this pull request as draft
April 3, 2026 20:31
dzoep
marked this pull request as ready for review
July 3, 2026 18:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Remaining Work
WIP
Won't Do
Done
Release steps
Public Domain Dedication
(Why: The freely released, copyright-free work in this repository represents an investment in a better way of doing things called attribution-based economics. Attribution-based economics is based on the simple idea that we gain more by giving more, not by holding on to things that, truly, we could only create because we, in our turn, received from others. As it turns out, an economic system based on attribution -- where those who give more are more empowered -- is significantly more efficient than capitalism while also being stable and fair (unlike capitalism, on both counts), giving it transformative power to elevate the human condition and address the problems that face us today along with a host of others that have been intractable since the beginning. You can help make this a reality by releasing your work in the same way -- freely into the public domain in the simple hope of providing value. Learn more about attribution-based economics at drym.org, tell your friends, do your part.)