Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support concept of "none" in `change`. #782

danfuzz opened this issue Nov 12, 2019 · 0 comments

Feature request: Support concept of "none" in `change`. #782

danfuzz opened this issue Nov 12, 2019 · 0 comments


Copy link

@danfuzz danfuzz commented Nov 12, 2019

change as currently written always has some value in it, and it defaults to 0 if not specified upon creation. This can lead to undesired behavior, specifically, failing to output a value if the first value ever emitted actually is 0. Of course, in some cases one can know of a particular value which is guaranteed to be out-of-range in context and can be stored in change to guarantee output; however when building a deeper abstraction it's not always possible to pick such a value.

To solve this problem, I created a change variant which explicitly supports the concept of having no value. When it has no value, sending any value to it will cause output. And, in addition to the set message, it also responds to set-none.

It seems to me that this might be useful enough to folks to be worth adding to Pd itself. For reference, here's the implementation of my variant of change — attached as an image — but note, it diverges from the built-in's behavior in that with no argument the initial value is "none" not 0. For backward-compatibility, it might make sense for change to accept literally none as an argument.


You can also find source for it here:

@umlaeute umlaeute added the feature label Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.