Whats this CR on the split block?

image
I know:
JSON ( {"a":1} )
XML ( <hi></hi> )
CSV ( hello,there )

But what is that "CR" thing? How does this work?

It's a carriage return, often notated with "\r" in text languages.

And whats that for?
Is it useful?

It's used as a line break. Different platforms use different line breaks. On Unix it's "\n", line feed; on Windows it's "\r\n", carriage return line feed; on some version of Mac it's "\r", carriage return.

Only really ancient (pre-OS X) ones.

The "line" option should accept either plain \n or the combination \r\n as a line separator (as should all software!). You never see \n\r, always \r\n if both are used, because back when typewriters were used as computer I/O devices, carriage return (moving the entire paper-handling mechanism rightward so that the left margin is up against the print mechanism) took way longer than linefeed (turning the paper-handling mechanism up by one line) and, back then, the code that's now called "newline" was called "linefeed," and the typewriter would keep reading characters during the carriage return, so it could move up a line while the carriage was still in motion. It was common back then for the computer to send \r\n\0\0 to avoid having actual characters printed while the carriage was still moving.

I think we have the cr option only for dealing with malformed text.

It's still called "line feed".

Really? In Unicode?

It's the U+000A Line Feed.

Edit: Pic of Notepad with CRLF circled ellipsed:

Yeah, in my youth \r\n (CRLF) was the standard line separator, but Unix changed that, mainly because the then-new Model 37 Teletype from AT&T, for the first time, made \n by itself do both vertical and horizontal motions.

But the ENTER key on a Windows-oriented keyboard still sends \r when you push it; software changes that to store \r\n in the file you're editing. Same for Mac and *nix, except that it changes the \r to just \n.

(offtopic) I learned all the control codes when people were using octal to talk to computers, so when I see "0x000A" for example, I have to think "okay, A is ten, so that's 012 octal, yeah, linefeed." (/offtopic)

So U+FFFF would have been 177777 for you back then?

Yup! The computer I learned on (IBM 7094) had a 15-bit address space, so I still remember that 2^15 is 32768. I should also remember 2^18 from the PDP-10, but I'm afraid I don't. (I mean, I know it's about 256K, but not the exact value.)

I memorized 215-1 as 32767 for, of all things, editing my MCPE inventory. It's also the limit of /fill.

Edit: 218 is 262144.

Yeah, I have a calculator, too. :~P

I remember 2^9=512 because at the Stanford AI Lab we had special keyboards that generated nine-bit characters; the Control key added 128 to the character value and the Meta key added 256. (The character codes less than 32, other than the motion control ones from 010 to 015, were math symbols such as λ (of course), π, ∞, ⋃, ⋂, etc., printed on the keycaps and accessed with the ALT key. The motion control ones had their own keys, at the left and right of the ASD... row in the picture below.)

The piece of paper you see taped down at the top of the keyboard was one of my unsung contributions to computer science. :~P It's a cheat sheet for the commands prefixed with ESC or BREAK (top left corner), that did things like let you look at other people's screens, or choose which radio station to play through the speaker in the associated monitor, or instantly crash the timesharing system. (I actually had a good reason to use that, once, in response to a malware attack.)

The picture is from http://xahlee.info/kbd/sail_keyboard.html.

Do I see German double-s on that keyboard?

No, sorry, I think that's a lower case beta.

So it's an English/Greek keyboard? (Or something like that)

No, we didn't have the entire Greek alphabet (look up "space cadet keyboard" if you want that). It's more an English/Math keyboard, with an emphasis on logic and set theory because that's how AI was done in those days.

The hardest thing was switching between these keyboards and the normal keyboards most of us had at home because of the position of the zero key!

I don't see one on the keyboard here. Unless it's that null symbol.

Yeah, that's the zero.

Did you know that the "!" is in a place where it annoys me? (On our modern keyboards)