Backshift



The changing of a present tense in direct speech to a past tense in reported speech (or a past tense to pluperfect). ‘We now have fine tuned our secondary set-up and have a solid backshift in all conditions.’. A period of work that begins in the afternoon and usually ends before 12 o'clock at night, or the people who work at this time: After that, they worked five weeks on the back shift. The back shift usually went. Backshift (2009) 23min Short, Comedy Two loser buddies attempt a late-night armed robbery at a donut shop and find very little money in the till, so they decide to lock up the employees and work the shift themselves until the money rolls in. Reported speech: indirect speech - English Grammar Today - a reference to written and spoken English grammar and usage - Cambridge Dictionary.

Backshift is another sorting algorithm that aims to implement sorting in clean code invented by User:A. It is less efficient than any other sorting algorithm; in its worst case, its algorithmic complexity is O(∞). However, it was best known as an esoteric programming language after people started to abuse the buggy algorithm to write useful programs.

Algorithm

Take 4321 as an example.

So, 1 will be moved left 4-1=3 times, which makes the item list 1432.

Then, 2 will be moved left 4-2=2 times, which makes the item list 1243.

Finally, 3 will be moved left 4-3=1 times, which makes the item list 1234.

Backshift rule

Backshift English

4 cannot be moved, so the sorting halts.

Note that negative moving left results in moving right.

Backshift in other bases

Since Backshift struggles with sorting some digits in base 10, it was possible it did better in sorting lower bases. Unfortunately not.

Unary

Backshift is able to successfully sort the digits of a unary number N iff the unary unit symbol itself is N. However, in the (9) cases where it is successful, it is still less effective than wikipedia:Bogosort by a factor of two in terms of end condition checks using the specified algorithm. Backshift performs twice as many end condition checks before successful termination than Bogosort.

Binary

Backshift

Backshift can successfully sort 0b1 in binary. Every other number (including 0) results in an non-terminating state where the final number may or may not be sorted. Obviously Backshift is just as capable of sorting these digits interpreted as base 10, so, as you would expect, Backshift-sorting the digits of 100 gives the same result whether interpreted as base 2 or 10. As with unary sorts, Bogosort is more effective at sorting 0b1.

Hexadecimal

Treating the name of this language as hex digits (ignoring those that aren't), backshift('backshift') => 'fbackshit' as backshift(0xbacf) => 0xfbac. Backshift seems about as capable of sorting digits in this base as base10, but there are more digits, so

Backshift provides an example to computer scientists of a sort algorithm less effective than wikipedia:Bogosort. However, in some cases (first example on this page), in some bases, Backshift outperforms wikipedia:Bogosort considerably, so a thorough analysis of the specific conditions where and why this occurs could conceivably be undertaken.

Examples

Perhaps ironically Backshift is as computationally capable as many other entries on this wiki (which is not necessarily very capable at all), and could be considered a language that takes a program as a string representation of a number, the digits of which are in a radix greater than the program length if the program is to ever terminate.

Infinite loop

In base 36:

or simply(under base 0):

Hello, World!

In base 36:

where the d represents 13 and is at position 13 to cleanly terminate.

is slightly more interesting, but outputs Hello Worlde. Note the whitespace padding and non-digit characters are significant in these examples for setting the length of the string.

Inverse Truth-machine

1 = 0 , 0 = 1

Here is a slightly more elegant version:

Backshift

Where x is the input; 2=0, 1=1.

Cat program

Here, Q is the input for the cat program, and l is the length of Q plus 1.

Backshift Operator Example

Quine

99 bottles of beer

Steps through the verses of the song, with final output on iteration 297:

100-len(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) bottles of beer on the wall, 100-len(*ʢʡʠʟʞʝʜʛʚʙʘʗʖʕʔʓʒʑʐʏʎʍʌʋʊʉʈʇʆʅʄʃʂʁʀɿɾɽɼɻɺɹɸɷɶɵɴɳɲɱɰɯɮɭɬɫɪɩɨɧɦɥɤɣɢɡɠɟɞɝɜɛɚəɘɗɖɕɔɓɒɑɐɏɎɍɌɋɊɉɈɇɆɅɄɃɂɁ) bottles of beer. Take one down and pass it around, 100-len(**ƋƉƇƅƃƁſŽŻŹŷŵųűůŭūũŧťţšşŝśřŗŕœőŏōŋʼnŇŅŃŁĿĽĻĹķĵijıįĭīĩħĥģġğĝěęėĕēđďčċĉćąăāÿýûù÷õóñïíëéçåãáßÝÛÙ×ÕÓÑÏÍËÉ) 𝖭𝝤 bottles of beer on the wall.Ȏ

The program is to be interpreted as digits extending base 36 to all following Unicode characters as an open-ended base, which works because Backshift only cares about assigning values to each symbol. Any character following 'z'(=36) is a converted to a value by subtracting 86 from its code point. '{' = 37, and so on. Numbers in the lyrics are to be read by subtracting unary values from 100.

External resources

  • Bogobogosort Another sort algorithm than sometimes outperforms, and sometimes doesn't, Backshift

Define Shifting

Retrieved from 'https://esolangs.org/w/index.php?title=Backshift&oldid=73613'