BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 20 definitions for Qi.

Qi (programming language)

Print-Friendly
About 2 pages (539 words)

Bookmark and Share Questions on this topic? Just ask!

Qi is a functional programming language developed by Dr Mark Tarver and introduced in its current form in April 2005 under the GNU GPL license. Although Qi is written in Lisp, it includes most of the features common to modern functional programming languages such as pattern-matching, currying, partial applications and (optional) static type checking. The combination of all these features within the Lisp environment makes Qi in many senses a rationalization and modernization of Lisp. Qi won its creator a Promising Invention Award from the State University of New York in 2003.

Contents

Notable Features

Though Qi shares the afore-mentioned features with modern functional programming languages like Standard ML and Haskell, Qi includes features which are quite specific to the language. Qi's most significant divergence from ML and Haskell is the use of sequent calculus notation to define types. Qi incorporates an efficient compiler for compiling sequent calculus notation into an extended Prolog that incorporates embedded function calls. Since Prolog is itself a programming language, the type specification language of Qi is Turing-equivalent, which in practice means that type checking in Qi is not guaranteed to terminate. This fact initially generated some controversy, but the author defended this feature by arguing that non-termination was an inevitable by-product of increased expressiveness and that a preference for a less expressive terminating type system represented a value judgment. In the absence of user-defined types, the Qi type checker will in fact terminate in all cases.

Development

As of October 2007, Qi has been updated several times since the first release (6.1) in April 2005 and the current release, 9.1, released September 2007, runs under both Windows and Linux on the CLisp, CMU Common Lisp, Allegro Common Lisp and SBCL platforms. 9.0 incorporated an optional factorising code compiler (Turbo-E) for optimising pattern-matching. In a comparative shoot-out against several Lisp programs and OCaml, Qi 9.0 performed at the speed of the fastest and most heavily hand-optimised Lisp version. A release (Qi/Tk) incorporating a type secure version of Tcl/Tk embedded into Qi is scheduled to appear later in 2007.

Examples

The traditional Hello world program in Qi:

(output "Hello, world~%")

A factorial function using pattern matching:

(define factorial
  0 -> 1
  N -> (* N (factorial (- N 1))))

This is a basic example of Qi-Prolog:

(defprolog
  "dog(snoopy).
   man(socrates).
   man(plato).
   mortal(X) :- man(X).")

And this is how to ask questions to the Prolog database:

(ask [ man plato ] )
(ask [ man snoopy ] )
(ask [ dog X ] )
(ask [ man M ] )

External links

View More Summaries on Qi (programming language)
 
Ask any question on Qi (programming language) and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Qi (programming language) from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy