Schools of Buddhism
This article has multiple issues. Early Buddhist schools and Nikaya Buddhism. The example function "depth" above pattern-matches its argument with three patterns. The terminology for the major divisions of Buddhism can be confusing, as Buddhism is variously divided by scholars and practitioners according to geographic, historical, and philosophical criteria, with different terms often being used in different contexts.
The Schools of Buddhism are the various institutional and doctrinal divisions of Buddhism that have existed from ancient times up to the present.
The classification and nature of various doctrinal , philosophical or cultural facets of the schools of Buddhism is vague and has been interpreted in many different ways, often due to the sheer number perhaps thousands of different sects, subsects, movements, etc. The sectarian and conceptual divisions of Buddhist thought are part of the modern framework of Buddhist studies , as well as comparative religion in Asia.
From a largely English-language standpoint, and to some extent in most of Western academia , Buddhism is separated into two groups at its foundation: The terminology for the major divisions of Buddhism can be confusing, as Buddhism is variously divided by scholars and practitioners according to geographic, historical, and philosophical criteria, with different terms often being used in different contexts.
The following terms may be encountered in descriptions of the major Buddhist divisions:. The following later schools used the vinaya of the Dharmaguptaka:. There are also significant differences in strictness or interpretation of the vinaya. From Wikipedia, the free encyclopedia. Four Stages Arhat Buddha Bodhisattva. Early Buddhist schools and Nikaya Buddhism.
Buddhism portal Religion portal. It involves matching the data with a series of patterns. The example function "depth" above pattern-matches its argument with three patterns. When the function is called, it finds the first pattern that matches its argument, performs any variable bindings that are found in the pattern, and evaluates the expression corresponding to the pattern.
Each pattern above has a form that resembles the structure of some possible value of this datatype. The first pattern simply matches values of the constructor Empty. The second pattern matches values of the constructor Leaf. Patterns are recursive, so then the data that is associated with that constructor is matched with the pattern "n". The recursion in patterns in this example are trivial, but a possible more complex recursive pattern would be something like Node Node Leaf 4 x Node y Node Empty z.
Recursive patterns several layers deep are used for example in balancing red-black trees , which involve cases that require looking at colors several layers deep. The comparison of this with pattern matching will point out some of the advantages of algebraic data types and pattern matching. First it is type safety. The pseudocode above relies on the diligence of the programmer to not access field2 when the constructor is a Leaf, for example. Also, the type of field1 is different for Leaf and Node for Leaf it is Int ; for Node it is Tree , so the type system would have difficulties assigning a static type to it in a safe way in a traditional record data structure.
However, in pattern matching, the type of each extracted value is checked based on the types declared by the relevant constructor, and how many values can be extracted is known based on the constructor, so it does not face these problems. Second, in pattern matching, the compiler statically checks that all cases are handled.
If one of the cases of the depth function above were missing, the compiler would issue a warning, indicating that a case is not handled. This task may seem easy for the simple patterns above, but with many complex recursive patterns, the task becomes difficult for the average human or compiler, if it must check arbitrary nested if-else constructs to handle. Similarly, there may be patterns which never match i.
Do not confuse these patterns with regular expression patterns used in string pattern matching. The purpose is similar: However, the mechanism is very different.
This kind of pattern matching on algebraic data types matches on the structural properties of an object rather than on the character sequence of strings. A general algebraic data type is a possibly recursive sum type of product types. Each constructor tags a product type to separate it from others, or if there is only one constructor, the data type is a product type.
Further, the parameter types of a constructor are the factors of the product type. A parameterless constructor corresponds to the empty product. If a datatype is recursive, the entire sum of products is wrapped in a recursive type , and each constructor also rolls the datatype into the recursive type. The Haskell List datatype can also be represented in type theory in a slightly different form, thus: The original formation specified a type function which body was a recursive type.
The revised version specifies a recursive function on types. For the purposes of the List example, these two formulations are not significantly different; but the second form allows expressing so-called nested data types , i. In set theory the equivalent of a sum type is a disjoint union , a set which elements are pairs consisting of a tag equivalent to a constructor and an object of a type corresponding to the tag equivalent to the constructor arguments.
This article is based on material taken from algebraic data type at the Free On-line Dictionary of Computing prior to 1 November and incorporated under the "relicensing" terms of the GFDL , version 1.
From Wikipedia, the free encyclopedia. This article has multiple issues. Please help improve it or discuss these issues on the talk page. Learn how and when to remove these template messages.
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources.
Unsourced material may be challenged and removed. October Learn how and when to remove this template message. This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts , without removing the technical details. September Learn how and when to remove this template message.
Ben Deane "Using Types Effectively " ".