词条 | K (programming language) |
释义 |
|name = K |logo = |paradigm = array, functional |year = {{Start date and age|1993 }} |designer = Arthur Whitney |developer = Kx Systems |latest release version = |latest release date = |typing = dynamic, strong |website = {{URL|kx.com}} |implementations = |dialects = |influenced by = A+, APL, Scheme |influenced = Q, AntLang{{citation needed|date=March 2017}} }}K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by Kx Systems. Since then, an open-source implementation named Kona has also been developed.[1] The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products.[2] The language, originally developed in 1993, is a variant of APL and contains elements of Scheme. Advocates of the language emphasize its speed, facility in handling arrays, and expressive syntax.[3] HistoryBefore developing K, Arthur Whitney had worked extensively with APL, first at I. P. Sharp Associates alongside Ken Iverson and Roger Hui, and later at Morgan Stanley developing financial applications. At Morgan Stanley, Whitney helped to develop A+, a variant of APL, to facilitate migrating APL applications from IBM mainframe computers to a network of Sun workstations. A+ had a smaller set of primitive functions and was designed for speed and to handle large sets of time series data.[4] In 1993, Whitney left Morgan Stanley and developed the first version of the K language. At the same time he formed Kx Systems to commercialize the product and signed an exclusive contract with Union Bank of Switzerland (UBS). For the next four years he developed various financial and trading applications using K for UBS. The contract ended in 1997 when UBS merged with Swiss Bank. In 1998, Kx Systems released kdb+, a database built on K. kdb was an in-memory, column-oriented database and included ksql, a query language with an SQL-like syntax. Since then, several financial products have been developed with K and kdb+. kdb+/tick and kdb+/taq were developed in 2001. kdb+, a 64-bit version of kdb+ was released in 2003 and kdb+/tick and kdb+/taq were released in 2004. kdb+ included Q, a language that merged the functions of the underlying K language and ksql.[5] OverviewK shares key features with APL. They are both interpreted, interactive languages noted for concise and expressive syntax. They have simple rules of precedence based on right to left evaluation. The languages contain a rich set of primitive functions designed for processing arrays. These primitive functions include mathematical operations that work on arrays as whole data objects, and array operations, such as sorting or reversing the order of an array. In addition, the language contains special operators that combine with primitive functions to perform types of iteration and recursion. As a result, complex and extended transformations of a dataset can be expressed as a chain of sub-expressions, with each link performing a segment of the calculation and passing the results to the next link in the chain. Like APL, the primitive functions and operators are represented by single or double characters; however, unlike APL, K restricts itself to the ASCII character set (as does another APL variant, J). To allow for this, the set of primitive functions for K is smaller and heavily overloaded, with each of the ASCII symbols representing two or more distinct functions or operations. In a given expression, the actual function referenced is determined by the context. As a result, K expressions can be opaque and difficult to parse for humans. For example, in the following contrived expression the exclamation point 2!!7!4 Reading from right to left the first The second core distinction of K is that functions are first-class objects, a concept borrowed from Scheme. First-class functions can be used in the same contexts where a data value can be used. Functions can be specified as anonymous expressions and used directly with other expressions. Function expressions are specified in K using curly brackets. For example, in the following expression a quadratic expression is defined as a function and applied to the values 0 1 2 and 3: In K, named functions are simply function expressions stored to a variable in the same way any data value is stored to a variable. f:{(x^2)-1} Functions can be passed as an argument to another function or returned as a result from a function. ExamplesK is an interpreted language where every statement is evaluated and its results displayed immediately. Literal expressions such as strings evaluate to themselves. Consequently, the Hello world-program is trivial: "Hello world!" The following expression sorts a list of strings by their lengths: The expression is evaluated from right to left as follows:
A function to determine if a number is prime can be written as: The function is evaluated from right to left:
If x is not prime then one of the values returned by the modulo operation will be 0 and consequently the minimal value of the list. If x is prime then the minimal value will be 1, because x mod 2 is 1 for any prime greater than 2. The function below can be used to list all of the prime numbers between 1 and R with: The expression is evaluated from right to left
K financial productsK is the foundation for a family of financial products. Kdb+ is an in-memory, column-based database with much of the same functions of a relational database management system. The database supports SQL, SQL-92 and ksql, a query language with a syntax similar to SQL and designed for column based queries and array analysis. Kdb+ is available for several operating systems, including Solaris, Linux, macOS, and Windows (32-bit or 64-bit). See also
References1. ^{{citation|last=Lawler|first=Kevin|url=https://github.com/kevinlawler/kona/wiki|title=Kona: an Open-Source K3 Implementation}} 2. ^{{cite web|url=https://kx.com/| title=Kx Systems}} 3. ^{{cite web|title=Kenneth Iverson on j, q, k|url=http://www.jsoftware.com/papers/tot.htm}} 4. ^{{cite web|title=arthur bio and interview|url=http://queue.acm.org/detail.cfm?id=1531242}} 5. ^{{citation|last=Garland|first=Simon|url=http://vector.org.uk/weblog/archive/000036.html|title=Q Language Widening the Appeal of Vectors|publisher=Vector UK|date=December 28, 2004|dead-url=yes|archive-url=https://web.archive.org/web/20070101213150/http://vector.org.uk/weblog/archive/000036.html|archive-date=January 1, 2007}} External links
11 : APL programming language family|Array programming languages|Data-centric programming languages|Dynamic programming languages|Function-level languages|Proprietary database management systems|Programming languages|Dynamically typed programming languages|High-level programming languages|1993 software|Programming languages created in 1993 |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。