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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove math mode mentions, move short hand syntax documentation #257

Merged
merged 4 commits into from
Mar 7, 2022

Conversation

rgwood
Copy link
Collaborator

@rgwood rgwood commented Mar 7, 2022

What?

Remove mentions of "math mode" from the Nu Book. Move the "Short-hand math mode" section from the Math page to the Variables and Subexpressions page, rename it "Short-hand subexpressions".

Why?

When I read through the Nu Book I was confused by 2 mentions of "math mode". Here it's mentioned in a way that is not reflected in the following example, and here it's mentioned but only in the context of "short-hand math mode".

JT explained some of the historical context, and it sounds like math mode is a bit less salient to users these days:

it's mostly just integrated into how expressions work these days. We used to start with a = to turn into "math mode". Now, if we see an expression and it isn't a call to a command, we treat it like a math expression and try to parse it that way

I think we can make the docs more clear by removing the mentions of math mode altogether. The "short-hand math mode" syntax is still worth documenting, but I think the variables+subexpressions page is a better fit than the math page (because the short-hand syntax can also be used with string operators like =~).

I'm relatively new to Nu (馃) so please let me know if I've missed something important here.

@@ -63,3 +63,21 @@ We can do a very similar action in a single step using a subexpression path:
```

It depends on the needs of the code and your particular style which form works best for you.

## Short-hand subexpressions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are called "row conditions" in the engine code. Not sure if that's clearer or less clear than "short-hand subexpressions"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the header to ## Short-hand subexpressions (row conditions). Think that strikes a balance between:

  1. Fitting the context of the Variables and Subexpressions page
  2. Tying things back to the engine's terminology

Operators can only be used in "math mode".
One way to enter math mode is to begin an expression with `=`.
For example:
The `in` and `not-in` operators are used to test whether a value is in a list. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small tweak here, the operators are in and not-in

@sophiajt
Copy link
Contributor

sophiajt commented Mar 7, 2022

Yeah, good call. I left a couple notes. Good with either "row conditions" or "short-hand subexpressions" but figured I'd give a couple options.

@sophiajt
Copy link
Contributor

sophiajt commented Mar 7, 2022

looks good, thanks!

@sophiajt sophiajt merged commit 3226654 into nushell:main Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants