Bracket
From Wikipedia, the free encyclopedia
( )
|
---|
apostrophe ( ’ ' ) |
Interword separation |
spaces ( ) ( ) ( ) |
General typography |
ampersand ( & ) |
Uncommon typography |
asterism ( ⁂ ) |
Brackets are punctuation marks used in pairs to set apart or interject text within other text. In computer science, the term is sometimes said to strictly apply to the square or box type.[1]
There are four main types of brackets:
- round brackets or parentheses: ( )
- square brackets or box brackets: [ ]
- curly brackets or braces: { }
- angle brackets or chevrons: < > or ⟨ ⟩
All these forms may be used according to typographical conventions that may vary from publication to publication and may vary even more from language to language. Some typical uses in English texts follow.
Contents |
[edit] History
The angle bracket was the earliest type to appear in English. Desiderius Erasmus coined the term lunula to refer to the rounded parentheses (), recalling the round shape of the moon. [2]
Please help improve this section by expanding it. Further information might be found on the talk page or at requests for expansion. |
[edit] Usage
In addition to referring to the class of all types of brackets the unqualified word bracket is most commonly used to refer to a specific type of bracket. In modern American usage this is usually the square bracket whereas in modern British usage it is usually the parenthesis (round bracket).
In American usage parentheses are usually considered separately from other brackets, and calling them “brackets” at all is unusual even though they serve a similar function. In more formal usage “parenthesis” may refer to the entire bracketed text, not just to the punctuation marks used (so all the text in this set of round brackets may be said to be a parenthesis).
[edit] Types
[edit] Parentheses ( )
Parentheses (singular parenthesis)—sometimes called round brackets, curved brackets, oval brackets, or just brackets; or, colloquially, parens, or fingernails— contain material that could be omitted without destroying or altering the meaning of a sentence.
Parentheses may be used in formal writing to add supplementary information, such as “Sen. Edward Kennedy (D., Massachusetts) spoke at length.” They can also indicate shorthand for “either singular or plural” for nouns—e.g., “the claim(s)”.
Parenthetical phrases have been used extensively in informal writing and stream of consciousness literature. Of particular note is the southern American author William Faulkner (see Absalom, Absalom! and the Quentin section of The Sound and the Fury). In most writing overuse of parentheses is usually a sign of a badly structured text. A milder effect may be obtained by using a pair of commas as the delimiter. If the sentence contains commas for other purposes visual confusion may result.
Parentheses have historically been used where the dash is currently used—that is, in order to depict alternatives, such as “parenthesis)(parentheses”. Examples of this usage can be seen in editions of Fowler’s.
Parentheses may also be nested (with one set (such as this) inside another set). This is not commonly used in formal writing (though sometimes other brackets [especially square brackets] will be used for one or more inner set of parentheses [in other words, secondary {or even tertiary} phrases can be found within the main sentence]).
Any punctuation inside parentheses or other brackets is independent of the rest of the text: “Mrs. Pennyfarthing (What? Yes, that was her name!) was my landlady.” In this usage the explanatory text in the parentheses is a parenthesis. (It is most common for the parenthesized text to be within a single sentence but also common for an entire sentence, or even several sentences, of supplemental material to be in parenthesis. In this case even the final full stop would be within the parentheses. Again, the parenthesis implies that the meaning and flow of the text as a whole would be unchanged were the parenthesized sentences removed.)
Parentheses in mathematics signify a different precedence of operators. 2 + 3 × 4 would be 14, for example, since the multiplication is done before the addition. (2 + 3) × 4 is 20, on the other hand, because the parentheses override normal precedence, causing the addition to be done first. They are also used to set apart the arguments in mathematical functions. f(x), for example, is the function f applied to the variable x. Parentheses denote a set of coordinates in the coordinate system. (4,7), for example, may represent the point located at 4 on the x-axis and 7 on the y-axis. Parentheses may also represent intervals. (0,5), for example, is the interval between 0 and 5, not including 0 or 5. Parentheses can also represent multiplication, as in the instance of 2 (3) = 6. Some authors follow the convention in mathematical equations that, when parentheses have one level of nesting, the inner pair are parentheses and the outer pair are square brackets. Ex: [5−(7+3)]+4=x. Parentheses may also be used to represent a binomial coefficient.
Parentheses are used in computer programming, especially in the C programming language and similar languages, to pass parameters or arguments to functions or methods such as in the example below:
getAverage(2,7,5);
[edit] Box brackets or square brackets [ ]
Square brackets enclose explanatory or missing material, especially in quoted text. “I appreciate it [the honor], but I must refuse”, for example. Or, “the future of psionics [see definition] is in doubt”.
The bracketed expression [sic] is used to indicate errors that are “thus in the original”; a bracketed ellipsis […] is often used to indicate deleted material; bracketed comments indicate when original text has been modified for clarity: “I’d like to thank [several unimportant people] and my parentals [sic] for their love, tolerance […] and assistance [emphasis added]”.[3]
Square brackets are used in mathematics in a variety of notations, including standard notations for intervals, commutators, the Lie bracket, and the Iverson bracket.
Square brackets are also used as parentheses within parentheses (alternating between parentheses and square brackets as nesting gets deeper [despite the alternative use of curly braces for this purpose (as mentioned earlier)]).
In the International Phonetic Alphabet square brackets indicate a phonetic transcription (as opposed to a phonemic one).
Square brackets can also be used in chemistry to represent the concentration of a chemical substance or to denote a complex ion.
Square brackets can be used in computer programming to access array elements, especially in C-like languages. They are used In programming manuals to denote missing or optional parameters.
They can be used in architecture to emphasize cool words such as [metaliving] or [cityscape].
Square brackets (called move-left symbols or move right symbols) are added to the sides of text in proofreading to indicate changes in indentation:
Move left | [To Fate I sue, of other means bereft, the only refuge for the wretched left. |
---|---|
Center | ]Paradise Lost[ |
Move up |
Square brackets are used to denote parts of the text that need to be checked when preparing drafts prior to finalizing a document. They often denote points that have not yet been agreed to in legal drafts and the year in which a report was made for certain case law decisions.
The html entities for the square brackets are [ and ]
[edit] Curly brackets or braces { }
Curly brackets (also called braces) are sometimes used in prose to indicate a series of equal choices: “Select your animal {goat, sheep, cow, horse} and follow me”. They are used in specialized ways in poetry and music (to mark repeats or joined lines). The musical terms for this mark joining staves are “accolade” and “brace.” In mathematics they delimit sets. In many programming languages, they enclose groups of statements. Such languages are therefore called curly bracket languages.
Presumably due to the similarity of the words brace and bracket (although they do not share an etymology), many people casually treat brace as a synonym for bracket. Therefore, when it is necessary to avoid any possibility of confusion, such as in computer programming, it may be best to use the term curly bracket rather than brace. However, general usage in North American English favours the latter form.[citation needed] The term curly braces is redundant since no other type of brace exists. Indian programmers often use the name “flower bracket”.[citation needed]
Curly brackets are often used in internet communities and through instant messaging to indicate hugging.[4]
[edit] Angle brackets or chevrons 〈 〉
Angle brackets (⟨ ⟩[5]; Unicode U+27E8 and U+27E9; and others, see below) are often used to enclose highlighted material. Some dictionaries use angle brackets to enclose short excerpts illustrating the usage of words. In physical sciences, angle brackets are used to denote an average over time or another continuous parameter. For example,
In linguistics, angle brackets indicate orthography, as in “The English word /kæt/ is spelled ⟨cat⟩.”
In textual criticism, and hence in many editions of poorly transmitted works, angle brackets denote sections of the text which are illegible or otherwise lost; the editor will often insert his own reconstruction where possible within them.
Angle brackets are infrequently used to denote dialogue that is thought instead of spoken, such as:
- ⟨What a beautiful flower!⟩
Single and double angle brackets or pairs of comparison operators (<<, >>) are sometimes used instead of guillemets («, ») (used as quotation marks in many languages) when the proper glyphs are not available.
The mathematical or logical symbols for greater-than (>) and less-than (<) are inequality operators, and are not punctuation marks when so used. Nevertheless, since true angle brackets are not available on a typical computer keyboard, the “less than” and “greater than” symbols are often used instead. These are often loosely referred to as angle brackets when used in this way. For example, the symbols < and > are often used to set apart URLs in text, such as “I found it on Example.com <http://www.example.com/>”. It may also often be found to indicate an e-mail address, such as “This photo is copyrighted by John Smith <john@smith.com>”, and is the computer-readable form for such in message headers as specified by RFC 2822.
Chevrons are part of standard Chinese, and Korean punctuation, where they generally enclose the titles of books: ︿ and ﹀ or ︽ and ︾ for traditional vertical printing, and 〈 and 〉 or 《 and 》 for horizontal printing.
In comic books, angle brackets are often used to mark dialogue that has been translated notionally from another language; in other words, if a character is speaking another language, instead of writing in the other language and providing a translation, one writes the translated text within angle brackets. Of course, since no foreign language is actually written, this is only notionally translated.
Angle brackets can also be used to indicate an action or status (eg. <Waves> or <Offline>), particularly in online, real-time text-based discussions (instant messaging, bulletin boards, etc). (Here, asterisks can also be used to signify an action.)
[edit] Computing
- Opening and closing parentheses correspond to ASCII and Unicode characters 40 and 41, or U+0028 and U+0029, respectively.
- For square brackets corresponding values are 91 and 93, or U+005B and U+005D.
- For curly brackets, 123 and 125, or U+007B and U+007D.
- True angle brackets are available in Unicode at code points U+27E8 and U+27E9 (for mathematical use) and or U+3008 and U+3008 (for East Asian languages). A third set of angle brackets are encoded at U+2329 and U+232A, but officially "discouraged for mathematical use"[6] because they are canonically equivalent to the CJK code points U+300x and thus likely to render as double-width symbols.
- The less-than and greater-than symbols can be found in both Unicode and ASCII at code points 60 and 62, or U+003C and U+003E.
These various bracket characters are frequently used in many computer languages as operators or for other syntax markup. The more common uses follow.
[edit] Uses of “(” and “)”
- are often used to define the syntactic structure of expressions, overriding operator precedence:
a*(b+c)
has subexpressionsa
andb+c
, whereasa*b+c
has subexpressionsa*b
andc
- contain the parameters or arguments to functions, or may denote the invocation of a function or function-like construct:
substring($val,10,1)
- in Lisp they open and close s-expressions and therefore function applications:
(cons a b)
- in Fortran-family languages, they are also used for array references
- in the Perl programming language, they are used to define lists, static array-like structures; this idiom is extended to their use as containers of subroutine (function) arguments
- in Python they are used to define tuples (immutable ordered lists)
- in Tcl they are used to enclose the name of an element of an associative array variable
[edit] Uses of “[” and “]”
- refer to elements of an array or associative array, and sometimes to define the number of elements in an array:
queue[3]
- may be used to define a literal anonymous array or list:
[5, 10, 15]
- in most regular expression syntaxes square brackets denote a character class: a set of possible characters to choose from
- in Tcl, they enclose a subscript to be evaluated and the result substituted
[edit] Uses of “{” and “}”
- are used in some programming languages to define the beginning and ending of blocks of code or data. Languages which use this convention are said to belong to the curly bracket family of programming languages
- are used to represent certain type definitions or literal data values, such as a composite structure or associative array
- in math they enclose elements of a set and denote a set
- in Pascal they define the beginning and ending of comments
- in most regular expression syntaxes, they are used as quantifiers, matching n repetitions of the previous group
- in Perl they are also used to refer to elements of an associative array
- in Tcl they enclose a string to be substituted without any internal substitutions being performed
- in mIRC slang, two braces with the enclosing one first represent a kiss: }{
[edit] Uses of “<” and “>”
In computing, the less-than and greater-than symbols are sometimes used with a bracket-like function. When these symbols are used in pairs as if they are brackets,
- in SGML (and its applications and variants such as HTML and XML), used to enclose code tags:
<div>
- in C++, C#, and Java they delimit generic arguments and preprocessor directives
- when writing text that contains e-mail addresses or URIs they delimit the canonical address part from any surrounding textual content, especially when ambiguities may otherwise arise.
- in Perl they are used to read a line from an input source.
- in ABAP they denote field symbols - placeholders or symbolic names for other fields, which can point to any data object.
When not used in pairs to delimit text (not acting as brackets),
- the less-than and greater-than signs (possibly in combination with other punctuation marks) are common relational operators; in some languages the pair together as
<>
denotes an inequality comparison - when doubled as
<<
or>>
they may represent bit shift operators, or in C++ also as stream input/output operators - are operators for indicating the redirection of input/output in Unix and similar operating systems’ shells.
[edit] Layout styles
In normal writing (prose) an opening bracket is rarely left hanging at the end of a line of text nor is a closing bracket permitted to start one. However, in computer code this is often done intentionally to aid readability. For example, a bracketed list of items separated by semicolons may be written with the brackets on separate lines, and the items, followed by the semicolon, each on one line.
For example, the CSS code
h1 { font-weight: bold; font-size: 12pt; line-height: 14pt }
may also be written
h1 { font-weight: bold; font-size: 12pt; line-height: 14pt }
A common error in programming is mismatching braces; accordingly, many IDEs have braces matching to highlight matching pairs.
[edit] Mathematics
In addition to the use of parentheses to specify the order of operations, both parentheses and square brackets are used to denote an interval. The notation [a, c) is used to indicate an interval from a to c that is inclusive of a but exclusive of c. That is, [5, 12) would be the set of all real numbers between 5 and 12, including 5 but not 12. The numbers may come as close as they like to 12, including 11.999 and so forth (with any finite number of 9s), but 12.0 is not included. In Europe, the notation [5,12[ is also used for this. The endpoint adjoining the square bracket is known as closed, while the endpoint adjoining the parenthesis is known as open. If both types of brackets are the same, the entire interval may be referred to as closed or open as appropriate. Whenever infinity or negative infinity is used as an endpoint, it is normally considered open and adjoined to a parenthesis. See Interval (mathematics) for a more complete treatment.
In quantum mechanics, angle brackets are also used as part of Dirac’s formalism, bra-ket notation, to note vectors from the dual spaces of the Bra <A| and the Ket |B>. Mathematicians will also commonly write <a,b> for the inner product of two vectors. In statistical mechanics, angle brackets denote ensemble or time average. Angle brackets are used in group theory to write group presentations, and to denote the subgroup generated by a collection of elements.
In group theory and ring theory, square brackets denote the commutator. In group theory, the commutator [g,h] is commonly defined as g−1h−1gh. In ring theory, the commutator [a,b] is defined as ab − ba. Furthermore, in ring theory, braces denote the anticommutator where {a,b} is defined as ab + ba. The square bracket is also used to denote the Lie derivative, or more generally the Lie bracket in any Lie algebra.
Various notations, like the vinculum have a similar effect to brackets in specifying order of operations, or otherwise grouping several characters together for a common purpose.
In the Z formal specification language, curly braces define a set and angle brackets define a sequence.
[edit] Accounting
Traditionally in accounting, negative amounts are placed in parentheses.[7]
[edit] Law
Brackets are used in the citation of law reports to identify parallel citations to non-official reporters. For example: Chronicle Pub. Co. v. Superior Court, (1998) 54 Cal.2d 548, [7 Cal.Rptr. 109]. Likewise, when quoted material is in any way altered, the alterations are enclosed in brackets within the quotation. For example: Plaintiff asserts his cause is just, stating, “[m]y causes is [sic] just.” While in the original quoted sentence the word “my” was capitalized, it has been modified in the quotation and the change signalled with brackets. Similarly, where the quotation contained a grammatical error, the quoting author signalled that the error was in the original with “[sic]” (Latin for “thus”). (California Style Manual, section 4:59 (4th ed.))
[edit] Sports
Tournament brackets, the diagrammatic representation of the series of games played during a tournament usually leading to a single winner, are so named for their resemblance to square or curly brackets.
[edit] Typing
In roleplaying, and writing, brackets are used for out-of-speech sentences(otherwise know as OOC, Out-Of-Character). Example
(What's your name?)
[edit] See also
[edit] References
- ^ Free Online Dictionary of Computing
- ^ Truss, Lynne. Eats, Shoots & Leaves, 2003. p. 161. ISBN 1-592-40087-6.
- ^ The Columbia Guide to Standard American English
- ^ Messenger Emoticons See Left hug and Right hug
- ^ Some fonts don't display these characters correctly. Please refer to the image on the right instead.
- ^ http://www.unicode.org/charts/PDF/U2300.pdf
- ^ IBM Information Management Software for z/OS Solutions Information Center
[edit] Bibliography
- Bryant, Randal E. & David, O’Hallaron (2003), Computer Systems: A Programmer’s Perspective (2003 ed.), Upper Saddle River, NJ: Pearson Education, pp. 794, ISBN 0-13-034074-X, <http://csapp.cs.cmu.edu/>
- Lennard, John (1991). But I Digress: The Exploitation of Parentheses in English Printed Verse. ISBN 0-19-811247-5.
- Turnbull; et al. (1964). The Graphics of Communication. New York: Holt. States that what are depicted as square brackets above are called braces and curly brackets are called brackets. This was the terminology in US printing prior to computers.