FACTOID # 72: There are 22 countries where more than half the population is illiterate. Fifteen of them are in Africa.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > HQ9
The title given to this article is incorrect due to technical limitations. The correct title is HQ9+.

HQ9+ is a joke programming language that consists of only four commands, each represented by a single character: H, Q, 9, and +. It is not Turing-complete, but it is highly efficient at certain types of programs.

An example HQ9+ program would be: "HHQ+HQ++"


This program would output "Hello, world! Hello, world! HHQ+HQ++ Hello, world! HHQ+HQ++" as well as incrementing the accumulator three times.


It is claimed that all useful programs written in HQ9+ run over twice as fast as the same programs written in any other language. Since no useful programs can be written in HQ9+, this is likely to be vacuously true.


HQ9+ is a joke; each command represents a common task that beginners are given when learning a new programming language. A common exercise, for example, is to write a computer program that prints "Hello, world!". There are some programming languages in which this is actually quite difficult; however, in HQ9+ the task is elementary, since the program "H" will accomplish the task. One of the hardest tasks in many programming languages is to write a quine, that is, a program which prints its own source code. However, in HQ9+, this is also trivial.


HQ9+ interpreters are extremely simple to write, so there have been many written. For example, this HQ9+ interpreter was written (in Python) in around five minutes and is only 18 lines long. And, this HQ9+ compiler written in C compiles HQ9+ programs to C code and is only about 40 lines long.


Since HQ9+ programs do not accept input, it is not possible to write an HQ9+ interpreter or compiler in HQ9+.


There is also another joke language called HQ9++, an object-oriented language backward compatible with HQ9+. This adds a new command, ++, which increments the accumulator twice and instantiates an object. Following the principle of information hiding, it is not possible to access this object.


External links



 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m