Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
5 user(s) are online (4 user(s) are browsing encyclopedia)

Members: 0
Guests: 5

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Q programming language

Q (which stands for equational programming language) is an interpreted, interactive functional programming language created by Albert Gräf at the University of Mainz in Germany. Q programs are just collections of equations which are used to evaluate expressions in a symbolic fashion. Q has many similarities with other modern functional programming languages like Haskell programming language and ML programming language, but is based on general term rewriting (a method of computation also used in Computer algebra system) instead of the lambda calculus.

Despite its conceptual simplicity, Q is a full-featured functional programming language with a modern syntax, currying, dynamic typing using an object-oriented type system, exception handling, POSIX Thread (computer science), a comprehensive standard library, and an interface to the C programming language. Q is an impure functional language (i.e., operations with Side-effect (computer science) are permitted) with a default eager evaluation strategy; special forms can be used to implement data structures and operations featuring lazy evaluation. Q has been ported to a variety of operating systems, including BeOS, FreeBSD, Linux, Mac OS X, Solaris Operating Environment and Microsoft Windows. The interpreter is free software distributed under the GNU General Public License.

Various add-on modules are provided for interfacing, e.g., to GNU Octave, OpenDX (IBM s scientific visualization software), Tcl/Tk and Open Database Connectivity. A Graph theory editor and library is also available. This turns the language into a practical tool for scientific and other advanced applications. Q also comes with an extensive system interface (though not as comprehensive as the facilities provided by other Scripting programming language such as Perl and Python programming language). Moreover, computer music applications are supported via portable interfaces for MIDI and digital audio programming.

=Examples=

The infamous hello world example:

hello = writes Hello, world! ;

The following function generates the stream (a.k.a. infinite list) of all prime numbers:

primes = sieve (ints 2); ints N = bin N (ints (N+1)); sieve (bin X Xs) = bin X (sieve (filter (ndivby X) Xs)); ndivby M N = N mod M 0;

An algorithm to solve the Eight queens puzzle, using backtracking:

queens N = search N 1 1 []; search N I J P = write P || writes if I>N; = search N (I+1) 1 (P++[(I,J)]) || fail if safe (I,J) P; = search N I (J+1) P if J0 where T:ByteStr = recv FD MSG_WAITALL (64*1024); = S otherwise;

=External links=

  • [http://q-lang.sourceforge.net/ Q-lang homepage]