K (programming language)
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by KX Systems. The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products. 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.
K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by KX Systems. The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products. 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*x^2)+(2*x)+1}'!4 In K, named functions are simply function expressions stored to a variable in the same way any data value is stored to a variable. a:25 f:{(x^2)-1} Functions can be passed as an argument to another function or returned as a result from a function. x@>#:'x The expression is evaluated from right to left as follows: #:'x returns the length of each word in the list x. > returns the indices that would sort a list of values in descending order. @ uses the integer values on the right to index into the original list of strings. A function to determine if a number is prime can be written as: {&/x!/:2_!x} The function is evaluated from right to left: !x enumerate the positive integers less than x. 2_ drops the first two elements of the enumeration (0 and 1). x!/: performs modulo division between the original integer and each value in the truncated list. &/ find the minimum value of the list of modulo result. 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: 2_&{&/x!/:2_!x}'!R The expression is evaluated from right to left !R enumerate the integers less than R. ' apply each value of the enumeration to the prime number function on the left. This will return a list of 0's and 1's. & return the indices of the list where the value is 1. 2_ drop the first two elements of the enumeration (0 and 1) ==K financial products== K 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== J, another APL-inspired language Q, the language of kdb+ and a new merged version of K and ksql. ==References== ==External links== , KX Systems , kdb+ Overview of K (with a link to K reference card) Dennis Shasha - K as a Prototyping Language K by Arthur Whitney (2005) oK REPL for a K clone Kona an open-source K3 implementation Amber an open-source K6 implementation with q/kdb+ vocabulary.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1368851611 under CC BY-SA 4.0; modifications have been made.