Skip to content

Adds a cheatsheet for Java fixes issue #42 #45

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Tristan-Raz
Copy link
Contributor

This adds Python and Java equivalent functions, operators, and one-liners to show how different operators are. This should help the students with Python knowledge.

@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>

<section xml:id="ap-java-cheatsheet" xmlns:xi="http://www.w3.org/2001/XInclude">
Copy link
Member

Choose a reason for hiding this comment

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

This seems odd to include a section AFTER the backmatter. This seems like an appendix to me and should be xi:included inside the backmatter. Therefore it should also have an appendix tag instead of a section

PreTeXt tries to help you semantically structure your book. Its worth following its lead!

Copy link
Contributor Author

@Tristan-Raz Tristan-Raz Jul 29, 2025

Choose a reason for hiding this comment

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

Thank you for your help! I've now made the change, converting the section to an appendix and including it inside the backmatter tag. I will make sure to follow PreTeXt's lead on structure in the future.

Copy link
Collaborator

@pearcej pearcej left a comment

Choose a reason for hiding this comment

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

This leaves the repo in a broken state. Maybe you have some uncommitted changes?

  1. The closing tag of the index needs to be replaced. Maybe you accidentally deleted it?
  2. You need to change main.ptx to include the new appendix where it should go.

@Tristan-Raz Tristan-Raz marked this pull request as draft July 29, 2025 18:48
@pearcej pearcej marked this pull request as ready for review July 29, 2025 19:01
Copy link
Collaborator

@pearcej pearcej left a comment

Choose a reason for hiding this comment

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

This is better, but it needs a full checkover. Here are some issues I see immediately:

  1. Floor Division //: This operator does not exist in Java. Java uses regular / for division, and for integer division, you'd use / with integer operands or Math.floorDiv().
  2. Exponent **: This operator does not exist in Java. Java uses Math.pow() for exponentiation.
  3. Logical operators and, or, not: These are Python operators, not Java. Java uses &&, ||, and !.

There is a LOT here! Often, less is better than more. I recommend we only include things that are discussed in this text, which is supposed to be a simple transition. Do we really want bitwise operations, for example?

@Tristan-Raz Tristan-Raz marked this pull request as draft July 30, 2025 15:45
@pearcej
Copy link
Collaborator

pearcej commented Jul 30, 2025

This is much improved! Let's make a few more changes:

  1. Please use c tags around all code snippets and commands regardless of language.
  2. Please organize the bullets in some less random fashion. Maybe put similar things together?
  3. Please give examples for each of the bullets since only some have them.

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.

3 participants