-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
[Booleans] new concept #781
base: main
Are you sure you want to change the base?
Conversation
concepts/booleans/about.md
Outdated
true | ||
``` | ||
|
||
Because `5 > 12` is `false`, clearly the combined expression must be `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe we can say the combined expression is clearly false
since we haven't introduced why the expression would be false
. We also risk reinforcing whatever interpretation the student got from line 85 because they might think Julia stops when it hits a false value regardless of which operator is used so that's what "unambiguous" means.
concepts/booleans/about.md
Outdated
``` | ||
|
||
Because `5 > 12` is `false`, clearly the combined expression must be `false`. | ||
The `1 != 0` expression is not relevant and is never evaluated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 != 0
isn't evaluated when the left side evaluates to false. It is evaluated if the left side evaluates to true so we can't say it's never evaluated without qualifying that never.
concepts/booleans/introduction.md
Outdated
true | ||
``` | ||
|
||
Parentheses are optional and can make the code easier to read. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be included under the logical OR section. However, we've already mentioned this in the Boolean logic section so it can be dropped.
concepts/booleans/introduction.md
Outdated
|
||
In Julia (and many other programming languages), `&&` has a [higher precedence][operator-precedence] than `||` (in the same way that `*` is applied before `+`). | ||
This means that `true || false && true` evaluates to `true` because it is parsed as `(true || false) && true`. | ||
It is common to include explicit brackets anyway so that the reader doesn't need to think about this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is common to include explicit brackets anyway so that the reader doesn't need to think about this. | |
It is common to include explicit parentheses anyway so that the reader doesn't need to think about this. |
Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
I need to think about this and try again. |
Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
Your key point is that comparison operators aren't taught till the next concept. I'm a bit less worried about this in One take-home message: don't blindly reuse text from the older exercise drafts, as I did here.. There are reasons why this syllabus hasn't launched. I'll think about this, and try again tomorrow. |
I did a major rewrite (essentially from scratch) of both Markdown files, in response to the all-too-valid criticisms from @BNAndras. Further comments welcome, from anyone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at a computer but these jumped out at me.
Only expressions which evaluate to `true` or `false` will be treated as a `Bool`. | ||
|
||
Specifically, empty arrays or strings will *not* be interpreted as `false`. | ||
There must be an appropriate test such as `isempty()` if you want special handlind for empty values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be an appropriate test such as `isempty()` if you want special handlind for empty values. | |
There must be an appropriate test such as `isempty()` if you want special handling for empty values. |
true | ||
``` | ||
|
||
These operators will be familiar to users of many other languages, though *not* Python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is confusing. and
and or
exist in other languages. Perhaps we say the operators and these concepts should be familiar coming from other languages but they might have different names there.
For discussion on the forum.
This concept draft borrows heavily from
exercises/concept.wip/.docs/introduction.md
, with some edits and new additions. It pairs withannalyns-infiltration
.