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

Add documentation for in-place backward pipes #855

Open
aidanmontare-fed opened this issue Oct 23, 2024 · 2 comments
Open

Add documentation for in-place backward pipes #855

aidanmontare-fed opened this issue Oct 23, 2024 · 2 comments

Comments

@aidanmontare-fed
Copy link

The in-place backwards pipe operators are a little confusing to me, so I was wondering if other newcomers would benefit from some additional documentation on them.

  • an example of how you might use these operators could help aid in understanding
  • how the operators are written might be made explicit, at least I found myself wondering whether it was <|= or =<| (though I quickly figured it out, and the second form wouldn't match any of the other in-place operators in coconut/python anyway)
  • It might be helpful to list out all the in-place versions, since I think some of them are not mentioned in the documentation at all.

Counterpoint, perhaps if these are infrequently used, adding detailed information on them would be confusing to newcomers. But the language documentation describes itself as a reference/specification, so I think it makes sense to include them.

@aidanmontare-fed
Copy link
Author

This might just be because I'm new to them, but another potential source of confusion: can you use in-place pipes in a pipeline at all? Would that make sense?

@evhub
Copy link
Owner

evhub commented Oct 29, 2024

All in-place operators behave as they do in Python, such that a <op>= b is roughly equivalent to a = a <op> b. Assigning with an in-place operator is a statement, not an expression, so you can't use it inside of a pipeline (in the same way you can't use = in the middle of expressions; that's why := exists).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants