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
Anonymous functions and/or pipelining? #374
Comments
Just noticed #261 while searching for similar issues. That contains a discussion about pipelines and partial function application. |
Just a note: a workaround is to introduce a new unit: >>> unit liter_per_100km = liter per 100 km
>>> 1 / 30 mpg -> liter_per_100km
= 7.84049 liter_per_100km [Area] |
As for the original issue: Yes, we definitely want:
Things I'm not yet sure about:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thought of how this might be useful when trying to work around #305. I'm picturing being able to do something such as the following:
In the above scenario, the main benefit is clarity. You could scale the incoming value, but then it's unclear what's going on. In any case, you're still "lying" about the units, so it's not sufficient to actually address #305. Operator precedence of
//
also makes this a bit nicer, though the parentheses above are a bit annoying.Partial function application via
//
could also make this a bit less annoying, e.g.:As noted above, this example is technically incorrect because the units display incorrectly given the intention.
In general, there are a lot of directions to go in terms of syntax, so I'm not sure what this would best look like. The focus should probably be on ergonomics and making things obvious and unambiguous without tons of parens.
The text was updated successfully, but these errors were encountered: