LoginSignup
53

More than 3 years have passed since last update.

括弧について

Last updated at Posted at 2015-07-29

プログラムでよく使われる下記の3種類の括弧について調べた。

  • ()
  • []
  • {}

日本での扱い

そもそも、個人的な経験では ()=小括弧、{}=中括弧、[]=大括弧 と聞いていたし、そう信じていた。

Wikipedia

Wikipediaの 注釈 を引用するとこういうことになってるらしい。

日本などの一部の国では、数式における括弧の入れ子は [{()}] の順で用いられてきた。しかし、世界的には {[()]} の順で用いられる方式が多数派である。

JIS Z 8201-1981 においても「小括弧」・「中括弧」・「大括弧」という名称は廃止され、現在は「丸括弧」・「角括弧」・「波括弧」と表記されている。
なお、この日本工業規格 (JIS) の解説文において、丸括弧・角括弧・波括弧を入れ子にする際の順序については「特に規定しない」としたうえで、{[()]} が大多数(世界中の学術誌のうち約90%)であることが付記されている。

JIS Z 8201-1981

JIS Z 8201-1981 では確かに小中大括弧という記述はなかった。
番号 1.36, 1.37, 1.38 に ()=丸括弧、[]=角括弧、{}=波括弧 の順に記載されている。

工業標準化法

そもそもJISは工業標準化法によると鉱工業のためのものなので数学者がこれに従う必要はない、というご意見をいただいた。
そうですか、としかいいようがないがプログラマとしてはどうでもいいかな・・・

海外の反応

国際標準といえばISO。
ISO 31-11:1992 というものがあった。ISO 80000-2:2009 が最新らしい。

差分についてはこちらのQAが参考になった。
What are the main changes between ISO 31-11 and ISO 80000-2? (math notation standards)

40ページの資料に160ドル払った回答者フランクに対するコメントも念のため転載しておく。

"What a complete waste of money, Frank!" - Pedro Tamaroff
"I am upvoting this just because you paid that much money for the document" - naslundx

ISO 80000-2:2009

ISO 80000-2:2009 についてはPDFが公開されていた。
INTERNATIONAL ISO STANDARD 80000-2

15ページの Item No. 2-7.19 (1-5.14) に括弧の記述があった。
記載順序は (),[],{} になっているが、そもそも入れ子やめろ()使え的な事が書いてある。
読み方としては下記のようになるらしい。

  • () : parentheses
  • [] : square brackets
  • {} : braces

Science Editors’ Handbook (EASE)

ここで読者の方から貴重なカッコ情報が届いた。
"The European Association of Science Editors (EASE)"という団体が出版する"Science Editors’ Handbook"にカッコの順序が定義されているという。
http://www.ease.org.uk/wp-content/uploads/1-4.pdf

If more than one set of parentheses is needed in a mathematical expression, use (), [] and {} consecutively from inward to outward: {[()]}.

たしかに {[()]} の順って書いてある。

If more than three levels of enclosures are necessary, use the same sets in the same order again, but in a bold type.

しかもさらにネストさせたい場合は {[({[()]})]} って書いてある。太字である。

Wikipedia

一般的な話としてWikipediaも調べてみた。

  • () — parentheses, brackets (UK, Canada, New Zealand, and Australia), parens, round brackets, soft brackets, or circle brackets
  • [] — square brackets, closed brackets, hard brackets, or brackets (US)
  • {} — braces are "two connecting marks used in printing"; and in music "to connect staves to be performed at the same time" 2, flower brackets (India), French brackets, curly brackets, definite brackets, swirly brackets, curly braces, birdie brackets, Scottish brackets, squirrelly brackets, gullwings, seagulls, squiggly brackets, twirly brackets, Tuborg brackets (DK), accolades (NL), pointy brackets, or fancy brackets

Bracket

記載順序は (),[],{} だが、読み方は国によってバラバラらしい。
インドにいたっては{}=花括弧(flower brackets)とも言うそうで。
言われてみれば蓮の花っぽい。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
53