-
Notifications
You must be signed in to change notification settings - Fork 32
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
parse one-sided formulas correctly and add tests #20
Conversation
Failure on mac nightly looks unrelated... |
Looks good to me in general, but why do we want/need to support one-sided formulas? |
They're supported in the |
(And in the |
If you have a use case in mind, fine by me. |
I guess I could see this being useful for something like unsupervised learning, where there's no response. As much as I dislike |
Right, that's the kind of use case I'm imagining. I'd be fine with making |
Using |
Is |
In general I agree that making it explicit is preferable (just like making the intercept explicit is preferable). |
As of 0.6 it's no longer a macro, it's just a regular infix operator in Base that has assignment precedence in the parser. That's why when I made |
|
Yeah, I mean it's not perfect, but IMO it's nicer than just
Unlikely, given that |
I'd like to revisit this now that #54 has been merged which (indirectly) removed the most common way that people in practice are constructing one-sided formulae (by calling |
One thing to consider would be requiring parens around the RHS (as in |
Due to other parsing oddities, we encourage fully parenthesizing formulas, e.g. |
I'm closing this in favor of using |
Constructing one-sided formulas was a pain in butt. A one-sided formula is something like
@formula(~ 1+x)
, which should be converted toFormula(nothing, :(1+x))
.This PR adds a helper function to raise non-infix
~
in@formula
expressions (which gets attached to the first argument of the formula) to be the outermost call, and check for single-argument (one-sided) calls to~
.