Caret

Source: Wikipedia, the free encyclopedia.

^
Caret
In UnicodeU+005E ^ CIRCUMFLEX ACCENT (^)
Different from
Different fromU+2038 CARET
U+02C6 ˆ MODIFIER LETTER CIRCUMFLEX ACCENT
U+028C ʌ LATIN SMALL LETTER TURNED V
U+2227 LOGICAL AND
U+039B Λ GREEK CAPITAL LETTER LAMDA
Related
See alsoU+FF3E FULLWIDTH CIRCUMFLEX ACCENT

Caret is the name used familiarly for the character ^ (the circumflex and a circumflex accent) provided on most QWERTY keyboards by typing ⇧ Shift+6. The symbol has a variety of uses in programming and mathematics. The name "caret" arose from its visual similarity to the original proofreader's caret, a mark used in proofreading to indicate where a punctuation mark, word, or phrase should be inserted into a document. The formal ASCII standard (X3.64.1977) calls it a "circumflex".[1]

History

Typewriters

Typewriter with French (AZERTY) keyboard: à, è, é, ç ù have dedicated keys; the circumflex and diaeresis accents have dead keys

On typewriters designed for languages that routinely use diacritics (accent marks), there are two possible ways to type these: keys can be dedicated to precomposed characters (with the diacritic included); alternatively a dead key mechanism can be provided. With the latter, a mark is made when a dead key is typed but, unlike normal keys, the paper carriage does not move on and thus the next letter to be typed is printed under the accent. The ^ symbol was originally provided in typewriters and computer printers so that circumflex accents could be overprinted on letters (as in ô or ŵ).

Transposition into ISO/IEC 646 and ASCII

The incorporation of the circumflex symbol into ASCII is a consequence of this prior existence on typewriters: this symbol did not exist independently as a type or hot-lead printing character. The original 1963 version of the ASCII standard used the code point x5E for an up-arrow . However, the 1965 ISO/IEC 646 standard defined code point x5E as one of five available for national variation,[a] with the circumflex ^ diacritic as the default and the up-arrow as one of the alternative uses.[2] In 1967, the second revision of ASCII followed suit.[3]

Caret compared to lower-case circumflex accent

Overprinting to add an accent mark was not always supported well by printers, and was almost never possible on video terminals. Instead, precomposed characters were eventually created to show the accented letters.[b] The freestanding circumflex (which had come to be called a caret) quickly became reused for many other purposes, such as in computer languages and mathematical notation. As the mark did not need to fit above a letter any more, it became larger in appearance such that it can no longer be used to overprint an accent.[4][c]

In Unicode, it is encoded as U+005E ^ CIRCUMFLEX ACCENT; in HTML, it may be inserted with ^.

This caret is not to be confused with other chevron-shaped characters, such as the

logical AND, which may occasionally be called carets.[5][6]

Uses

Programming languages

The symbol ^ has many uses in

, the caret is used to match the beginning of a string or line; if it begins a character class, then the inverse of the class is to be matched.

trigraph
??', as the character was originally not available in all character sets and keyboards.
C++ additionally supports tokens like xor (for ^) and xor_eq (for ^=) to avoid the character altogether.
digraph '> when required.[7]

Pascal uses the caret for declaring and dereferencing pointers. In Smalltalk, the caret is the method return statement. In C++/CLI, .NET reference types are accessed through a handle using the ClassName^ syntax. In Apple's C extensions for Mac OS X and iOS, carets are used to create blocks and to denote block types.

bitwise NOT
operator.

semver.[8]

Surrogate symbol for superscript and exponentiation

In mathematics, the caret can signify exponentiation (e.g. 3^5 for 35) where the usual superscript is not readily usable (as on some graphing calculators). It is also used to indicate a superscript in TeX typesetting. As Isaac Asimov described it in his 1974 "Skewered!" essay (on Skewes's number), "I make the exponent a figure of normal size and it is as though it is being held up by a lever, and its added weight when its size grows bends the lever down."[9]

The use of the caret for exponentiation can be traced back to

hyperoperations in Knuth's up-arrow notation
.

Escape character

It is often seen in caret notation to show control characters: for instance, ^A means the control character with value 1.

The Windows command-line interpreter (cmd.exe) uses the caret to escape reserved characters (most other shells use the backslash). For example, to pass a 'less-than' sign as an argument to a program, one would type ^<.

Upward-pointing arrow

In

social networking sites such as Facebook, or in online chats, one or more carets may be used beneath the text of another post, representing an upward-pointing arrow to that post;[10]
in addition to the arrow usage, it can also mean that the user who posted the ^ agrees with the above post. Multiple carets may be used to indicate that the comment is replying to, or relating to, the post above that correlates with the number of carets used, or to "underscore" the correct portion of the previous post, or simply for emphasis.

A similar use has been adopted by programming language compilers, such as the Java compiler, to point out where a compilation error has occurred.[citation needed] The compiler prints out the faulty line of code and uses a single caret on the next line, padded by spaces, to give a visual indication of the error location.

See also

Notes

  1. code points
    that are available for national variation.
  2. ISO Latin-1
    .
  3. ^ Its actual shape, positioning and relative dimensions vary by font.

References

  1. ^ "American National Standard for Information Interchange" (PDF). National Institute for Standards. 1977. (facsimile, not machine readable)
  2. ^ "Character histories: notes on some ASCII code positions (5E)".
  3. ^ Tom Jennings. "ASCII: American Standard Code for Information Infiltration". Archived from the original on 21 August 2014. Retrieved 14 September 2010.
  4. ^ Jukka K. Korpela (18 January 2010). "Kirjainten tarinoita" (PDF) (in Finnish). pp. 132–133. Retrieved 14 September 2010.
  5. ^ Unicode (1991–2012). "IPA Extensions" (PDF). Retrieved 20 August 2012.
  6. ^ Eric W. Weisstein. "Caret". MathWorld. Wolfram. Retrieved 20 August 2012.
  7. ^ Simonsen, Keld (June 1992). "RFC 1345 – Character Mnemonics and Character Sets". Internet Engineering Task Force. Retrieved 7 March 2022.
  8. ^ "Caret ranges in node.js". Archived from the original on 3 December 2016. Retrieved 1 October 2019.
  9. ^ "What is Caret?". Computer Hope. Retrieved 14 August 2012.
This page is based on the copyrighted Wikipedia article: Caret. Articles is available under the CC BY-SA 3.0 license; additional terms may apply.Privacy Policy