Caret
^ | |
---|---|
Caret | |
InUnicode | U+005E^CIRCUMFLEX ACCENT(^) |
Different from | |
Different from | U+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 also | U+FF3E^FULLWIDTH CIRCUMFLEX ACCENT |
![](https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Wiktionary-logo-en-v2.svg/40px-Wiktionary-logo-en-v2.svg.png)
Caretis the name used familiarly for thecharacter^provided on mostQWERTYkeyboards 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 originalproofreader's caret,‸,a mark used inproofreadingto indicate where a punctuation mark, word, or phrase should be inserted into a document. TheASCIIstandard (X3.64.1977) calls it a "circumflex";[3]the Unicode standard calls it a "circumflex accent", although it is no longer practicable for that purpose.
History
[edit]Typewriters
[edit]![](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Write_machine.jpg/220px-Write_machine.jpg)
On typewriters designed for languages that routinely usediacritics(accent marks), there are two possible ways to type these: keys can be dedicated toprecomposed characters(with the diacritic included); alternatively adead keymechanism 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 thatcircumflex accentscould be overprinted on letters (as inôorŵ).
Transposition into ISO/IEC 646 and ASCII
[edit]The incorporation of the circumflex symbol into ASCII is a consequence of this prior existence on typewriters: this symbol did not exist independently as atypeorhot-leadprinting character. The original1963 version of the ASCII standardused the code point0x5Efor anup-arrow↑.However, the 1965ISO/IEC 646standard defined code point0x5Eas 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.[4]In 1967, the second revision of ASCII followed suit.[5]
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 incomputer languagesand 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 in most fonts.[6]
InUnicodethe symbol is encoded asU+005E^CIRCUMFLEX ACCENT;inHTMLit may be used directly or inserted with^
.Thecombining characterfor use as a diacritic isU+0302◌̂COMBINING CIRCUMFLEX ACCENT,althoughprecomposed characters(likeU+00E2âLATIN SMALL LETTER A WITH CIRCUMFLEX) are available for most European languages.
Uses
[edit]Programming languages
[edit]The symbol^has many uses inprogramming languages,where it is typically called a caret. It can signifyexponentiation,the bitwiseXORoperator,string concatenation[citation needed],andcontrol charactersincaret notation,among other uses. Inregular expressions,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.
ANSI Ccan transcribe the caret in the form of thetrigraph??'
,as the character was originally not available in all character sets and keyboards.
C++additionally supports tokens likexor
(for^
) andxor_eq
(for^=
) to avoid the character altogether.
RFC1345recommends that the character be transcribed asdigraph'>
when required.[7]
Pascaluses the caret for declaring and dereferencingpointers.
InSmalltalk,the caret is the method return statement.
InC++/CLI,.NET reference types are accessed through a handle using theClassName^
syntax.
In Apple'sC extensionsfor Mac OS X and iOS, carets are used to createblocksand to denote block types.
Gouses it as abitwise NOToperator.
Node.jsuses the caret inpackage.jsonfiles to signify dependency resolution behavior being used for each particular dependency. In the case of Node.js, a caret allows any kind of update, unless it is seen as a "major" update as defined bysemver.[8]
Surrogate symbol for superscript and exponentiation
[edit]Inmathematics,the caret can signifyexponentiation(e.g.3^5
for35) where the usualsuperscriptis not readily usable (as on somegraphing calculators). It is also used to indicate a superscript inTeXtypesetting. AsIsaac Asimovdescribed it in his 1974 "Skewered!" essay (onSkewes'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 toALGOL 60,[citation needed]which expressed the exponentiation operator as an upward-pointing arrow, intended to evoke the superscript notation common in mathematics. The upward-pointing arrow is now used to signifyhyperoperationsinKnuth's up-arrow notation.
Escape character
[edit]It is often seen incaret notationto show control characters: for instance,^A
means the control character with value 1.
The Windows command-line interpreter (cmd.exe) uses the caret toescapereserved characters (most other shells use thebackslash). For example, to pass a 'less-than' sign as an argument to a program, one would type^<
.
Upward-pointing arrow
[edit]Ininternet forums,onsocial networking sitessuch as Facebook, or inonline 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 languagecompilers,such as the Java compiler, to point out where acompilation errorhas 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
[edit]- Caretas used inproofreadingandtypography
- Hat operator,a notation used in mathematics and statistics, is sometimes called a caret
Notes
[edit]- ^ISO646 (and ASCII, which it includes) is a standard for 7-bit encoding, providing just 96 printable characters (and 32control characters). This was insufficient to meet the needs of Western European languages and so the standard specifies certaincode pointsthat are available for national variation.
- ^For instance inISO Latin-1.
References
[edit]- ^Unicode (1991–2012)."IPA Extensions"(PDF).Retrieved20 August2012.
- ^Eric W. Weisstein."Caret".MathWorld.Wolfram.Retrieved20 August2012.
- ^"American National Standard for Information Interchange"(PDF).National Institute for Standards. 1977.(facsimile, not machine readable)
- ^"Character histories: notes on some ASCII code positions (5E)".
- ^Tom Jennings."ASCII: American Standard Code for Information Infiltration".Archived fromthe originalon 21 August 2014.Retrieved14 September2010.
- ^Jukka K. Korpela (18 January 2010)."Kirjainten tarinoita"(PDF)(in Finnish). pp. 132–133.Retrieved14 September2010.
- ^Simonsen, Keld (June 1992)."RFC 1345 – Character Mnemonics and Character Sets".Internet Engineering Task Force.Retrieved7 March2022.
- ^"Caret ranges in node.js".Archived fromthe originalon 3 December 2016.Retrieved1 October2019.
- ^Isaac Asimov(1974), "Skewered",Of Matters Great and Small,Doubleday,ISBN978-0385022255
- ^"What is Caret?".Computer Hope.Retrieved14 August2012.