Opened 10 years ago

Closed 10 years ago

#14621 closed enhancement (fixed)

Bitwise xor documentation in the tutorial and FAQ

Reported by: Tomer Bauer Owned by: Minh Van Nguyen
Priority: minor Milestone: sage-5.10
Component: documentation Keywords: xor exclusive preparser
Cc: Merged in: sage-5.10.beta5
Authors: Tomer Bauer Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

I just found this gem in the Sage preparser: It parses ^^ as a single ^ for the exclusive or operator.

The attached patch fixes the Sage Tutorial and FAQ sections in the documentation with this little info.

Attachments (1)

trac_14621_xor.patch (1.4 KB) - added by Tomer Bauer 10 years ago.
Updated patch

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by Leif Leonhardy

Keywords: exclusive preparser added

Please submit a proper Mercurial patch, with the necessary meta data (see http://sagemath.org/doc/developer/walk_through.html#submitting-a-change; you can of course use hg (or sage --hg) commands directly if you prefer).

And afterwards, set the ticket to "needs review".

Changed 10 years ago by Tomer Bauer

Attachment: trac_14621_xor.patch added

Updated patch

comment:2 in reply to:  1 Changed 10 years ago by Tomer Bauer

Status: newneeds_review

Replying to leif:

And afterwards, set the ticket to "needs review".

Done. I have also updated the patch file.

comment:3 Changed 10 years ago by Karl-Dieter Crisman

Reviewers: Karl-Dieter Crisman
Status: needs_reviewpositive_review

Just asking... in the code for preparse we have

    # Use ^ for exponentiation and ^^ for xor
    # (A side effect is that **** becomes xor as well.)
    L = L.replace('^', '**').replace('****', '^')

Do we want to document the **** here? My preference is not to do so, but since we didn't even have the ^^ documented (though I know a lot of people who did use it), maybe we should document it too.

Otherwise very nice work!

Last edited 10 years ago by Karl-Dieter Crisman (previous) (diff)

comment:4 Changed 10 years ago by Leif Leonhardy

Oh, Karl-Dieter, I was just going to add the "beginner" keyword ... ;-D

(since it is easy to review)

comment:5 in reply to:  3 Changed 10 years ago by Leif Leonhardy

Replying to kcrisman:

Just asking... in the code for preparse we have

    # Use ^ for exponentiation and ^^ for xor
    # (A side effect is that **** becomes xor as well.)
    L = L.replace('^', '**').replace('****', '^')

Do we want to document the **** here? My preference is not to do so.

I wouldn't document it (other than in the code) either, since it's an unintended side-effect, may change one day, I don't think anybody is going to use that "feature", and it's unlikely to break anything (i.e., it's IMHO not a pitfall typical users may run into).

comment:6 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.10.beta5
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.