Abstract Wikipedia/Updates/2024-01-17

Abstract Wikipedia Updates Translate

Abstract Wikipedia via mailing list Abstract Wikipedia on IRC Wikifunctions on Telegram Wikifunctions on Mastodon Wikifunctions on Twitter Wikifunctions on Facebook Wikifunctions on YouTube Wikifunctions website Translate

Refreshing the Function page edit

 
The "About" tab of the previous Function page

This week, we are happy to announce that a redesign and rewrite of the Function page has been deployed to production.

The Function page was always a bit different from the others, as it was separated into two tabs: “About” and “Details”.

 
The "Details" tab of the previous Function page

The About page contained an overview of the Function, including its name and description. It also offered a widget to actually run the Function. The Details page showed the formal Function definition, the input and output types, as well as the list of Implementations and Tests.

Feedback for this page was pointing out a few issues: the About page was (intentionally) rather sparse with information, the second line of tabs under “Page” and “Discussion” was a bit confusing, and it was not possible to link the “Details” tab.

 
The new Functions page

Amin, our UX lead, reviewed past research, gathered input from the community and redesigned the whole experience. He combined the description and names from the front page with the type information and argument names from the back page in a new box, the About widget. The widget to try the Function remains in a prominent spot on the top of the page, followed by the tables for the Implementations and Tests, which also have been refreshed, incorporating a “+” for creating new Implementations and Tests. These changes mean that the Function page is now more consistent with other pages, and the technical "back-end" details are more prominent. We hope this does not overwhelm users, or make them feel things are too technical and unwelcoming to them.

We are looking forward to hearing your feedback on the new Function page, and we want to thank everyone for their hard work on designing it, gathering the feedback, developing, and testing it.

Function of the Week: ROT13 edit

This week’s Function of the Week is ROT13. ROT13, short for “rotate by 13 places”, is the best known variant of the Caesar cipher, a simple method to encrypt messages. Every letter gets replaced by the letter 13 places forward in the English alphabet (if the alphabet was a ring). So the first letter, A, gets replaced by N, B by O, C by P, etc. The special thing about the number 13 is that the English alphabet has 26 letters, and 13 is exactly half of that, which means that the letter N in turn is replaced by A, O by B, and P by C, exactly the opposite of what we were saying before.

That means that if you apply ROT13 to a string twice, you move forward 26 letters: every letter becomes itself again! ABC becomes NOP, and applying ROT13 to NOP becomes ABC again. This way, ROT13 is not only an encryption function, but also a decryption function! You can use the same function to encrypt and decrypt messages, which is rather unusual.

ROT13 has been the function I have been using the most outside of Wikimedia tasks: for example, if I put a spoiler into a discussion, I would use ROT13 to encrypt it, and then link to the Wikifunctions page for ROT13.  This allows everyone to easily skip the spoiler, since most people can’t do ROT13 in their head.

Vg vf abg ernyyl zrnag nf n erny rapelcgvba gurfr qnlf, orvat sne gbb boivbhf naq rnfl gb qrpelcg.

ROT13 relies heavily on the English alphabet. The Implementation we have leaves all letters that are not in the English alphabet unmodified. It would be great to have some variants of the cipher available that also work for other alphabets. I am sure that books for kids in languages using Cyrillic for kids contain tables that work on the Cyrillic alphabet, and probably the same for other scripts. It would be interesting to see a few more of those implemented.

As of writing, the Function has only a single Test, which is really not that great. Having more than one Test allows a greater confidence that the different Implementations work and have the same results, and also that it handles different cases appropriately, for example empty strings or an Arabic input passing unmodified, and so on.

The composition relies on the ROT1 function, which rotates the letters by 1. ROT1 turns A into B, B into C, C into D, and so on. If you apply ROT1 to the name of one of the more famous computers in science fiction, HAL, you will learn about the inspiration for that name. If you run ROT1 two times, you effectively get ROT2. And if you run it 13 times, you get ROT13. The composition of ROT13 thus is using 13 calls to ROT1.

When we introduce numbers and functions as argument types, we will likely see the creation of a “repeat” function, which calls a given function a given number of times on a specific input. That will make it possible to write a nice alternative composition that is a bit easier to read.

All examples in the text can be run on the wiki, and you can explore other examples on the linked Function pages.

Recent changes to the software edit

The big user-facing change this week is of course the new design for the Function page, discussed above (T339954). Alongside that, we also added support for displaying user-controlled debug logs in the front-end user experience (T353544), drafted an extensive overview of our front-end code's architecture, and made a number of clean-up fixes to our code.