Skip to content

Adding first-class thunks? #7

@simendsjo

Description

@simendsjo

I was creating my own enumeration library when I decided to look closer at cl-transducers. I'm using thunks for expensive computations. A few questions:

  1. Would you like this added to cl-transducers8
    Adding lazy to construct them, ensure-forced for evaluation etc.

  2. Should knowledge about them be added to transducers that needs to look at the values?
    Changing (funcall pred input) to (funcall pred (ensure-forced input)) for the transducers that needs to evaluate the input.
    Without this, users themselves have to make sure to add a step to force evaluation before each transducer than needs to evaluate the input -- which seems quite leaky.

While it's very little code needed, it's more of an architectural question. I found for my own enumeration library that having lazy supported by take-while and similar functions made the calling code more robust. But it also means people writing transducers needs to know that they have to ensure thunks has been evaluated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions