First Draft

Introducing Euphoria

A suggested replacement for the first page of the Euphoria documentation.


The forum topic is for discussing this Euphoria introduction.

ToDo List

  • hyperlinks, connect all statements to a reference that justifies any claims (speed, easy, power, ...)
  • hyperlinks for gui libraries, and other resources
  • png screen grabs
  • copy png images to Euphoria wiki?
  • indentation within <eucode> when placed within a table
  • add benchmark programs to Euphoria distribution in the "demo" section
  • pre-processor
  • A few examples needed to showcase Euphoria
  • I am not sure how this is laid out on the page, but i suggest two columns here, your multiply in one and a foreach in the other, then below those with your "while" in one, and an equally good "case" demo in the other. I'd then mention the interesting way you can jump into a while loop to emulate "repeat-until" loops, and the controlled "goto" to get you out of loops of any depth or complexity. Some mention should be made of tasks.e multitasking.
  • remove words to make reading easier!
Anyone can add items to this ToDo list.
and edit the wiki.

My Replies

  • Thanks for the help I am getting.
  • "Accomodate your needs"
    your needs are "fast | flexible | friendly"
    ok, some artistic leeway for an enthusiastic introduction?
  • mouseover
    I don't think that is a feature of the wiki.

Objective: An enthusiastic introduction to OpenEuphoria. Provide verifiable support for the enthusiasm. Provide links for all major ideas presented.


OpenEuphoria* | flexible | friendly...the programming language with great features. The mongoose is our adopted animal friend. Rudyard Kipling, in the Jungle Book*, describes the "–snake’s blow against mongoose’s jump–". A mongoose is curious and friendly but no poisonous snake will win a battle between the two.

Accelerate your programming.
Euphoria programs just run faster*. The eui interpreter--likely the fastest you will encounter--provides rapid program development. Then if you want to, euc compiles your programs into self-contained executables that are faster again. Euphoria speed does not compromise subscript checking, uninitialized variable checking, garbage collection, and numerous other run-time checks.
Accommodate your needs.
Euphoria gives you flexibility and power.
Euphoria is a general purpose, versatile, multi-gui, multi-platform, and portable. Write at a high level and yet interface to C, DLL's and SO's. Unique simplified data handling requires only atoms/sequences. The standard library provides plenty of utility.

web.png The OpenEuphoria website is powered by Euphoria.
win.png Native Windows GUI and IDE.
tinewg.png Simple Windows GUI and IDE.
wx.png WxWidegets for multi-platform programming.
gtk.png Native GTK GUI for Linux.

Accomplish more.
Euphoria is small and friendly: easy to read, easy to learn, and easy to use. Atoms/sequences are higher level and easier to use than conventional data-types. Write code the way you want with simple English words and freeform layout. Euphoria is responsive and gives useful error messages when you need them. Euphoria is supported with GUI libraries, tracing, testing, documentation tools, editing choices, sample programs, and a helpful forum. Euphoria is free, open source, and actively being developed.

.. .. ..
Euphoria is powerful

Apply operators and functions
to every element of a sequence
at once.

-- power
sequence nums = { 5, 6, 7 }
? nums * 2
-- Output: { 10, 12, 14 }
? nums * { 2, 3, 4 }
-- Output: { 10, 18, 28 } 
Euphoria is flexible

Make loops and conditionals
do exactly what you want
them do to.

-- flexibility
while 1 label "families" do
while 1 do -- labels are optional
while 1 label "children" do
exit "families" -- exit top level while
end while
end while
end while 
Euphoria is innovative

Write numbers using
convenient notation

-- inovation
integer easy = 1_923_993, hard = 1923993
printf(1, "%d = %d\n", { easy, hard })
-- Output: 1923993 = 1923993
.. .. ..

A one-of-a-kind language.
Euphoria has a unique* data-type design. Three easy to learn built-in data-types achieve what in a conventional language requires many, harder to learn, concepts. Imagine our mongoose having a meal. An atom is just a bite: a single number, integer, or character. A sequence is the complete meal or entire the entire buffet: mixed values, list, array, tree, string, nested, or flat. An object is universal and dynamic; you can taste just one bite, have the buffet, or anything in-between.

Yes, it is true.
Euphoria users are understandably enthusiastic. With little effort you can confirm, for yourself, that Euphoria is an exceptional programming language. To learn more about Euphoria just try it out--download* one 12MB file, install quickly on Windows, Unix (Linux, BSD, ...), or OS X, and get a ready to use programming environment with documentation and sample programs.
* Power Explained: object, atom and sequence.

* Speed Benchmarked: Euphoria is faster than Python, Perl, ...

* Examples Illustrate: flexibility of Euphoria.

* Easy Defined: a language that is simple, small, consistent, and predictable.

Power Explained: object, atom and sequence.

"essay in progress"
An atom is any single datum (number, integer, character, boolean). In a conventional language that would be four separate data-types, but one is enough and much simpler.

In Euphoria you always introduce a variable before you can use it. This looks like:

atom x = 3.14159 
atom test = 1 
atom letter = 'a' 

Then, you can use the variable in your programming. Any line starting with a double dash ( - -) is a comment; comments are for documentation only and are ignored when programs run. To display an atom--as a number--you print . To display an atom--as a character--you puts . The atom data-type itself always remains the same; you simply choose how an atom will be displayed; no data-type conversions are needed for this to happen.

print(1, x + test ) 
	-- 4.14159 
puts(1, letter) 
	-- a 

Requiring an introduction for each variable ensures that the data-type is explicit and a value has been assigned. Spontaneous creation of variables (typical in some conventional interpreted languages) is fun as you type new code but can result in subtle bugs and becomes hard to read latter on.

Euphoria now dynamically takes care of messy details for you. Euphoria uses less memory for small integers, provides extra memory for large real numbers, promotes oversize integers into exponential form, seamlessly allows mixed calculations between integers and floats, recognizes 0 as false and others as true, and stores characters as simple integer values.

A sequence is any collective data (atom, sequence, object, nested sequence, string, list, array, stack, tree, ... ). This is were Euphoria becomes truly remarkable. A conventional language will have many data-types, each with specialized rules, dedicated to arranging and manipulating data--Euphoria only needs one.

sequence word_example = "hello" 
sequence list_example = { 1, 2, 3 } 
sequence mixed_example = { "red", 10e3, { 2, 4, 6}, { 1 { 2 { 3 }} } 
sequence empty_example = {} 

After introducing a variable as a sequence data-type Euphoria lets you dynamically do anything. You are only limited by your imagination and the memory available on your computer. For example any variable could be the contents of a book, completely empty, or the contents of a spreadsheet; at one moment it could be full of string data and in the next line it could be full of numbers. All classical computer science arrangements--lists, queues, arrays, structures, trees, ..., and more--can be represented by the sequence type.

Euphoria data-types hide a lot of messy details. If you are new to programming this reduces what you have to learn and use. If you are an expert then you will appreciate how Euphoria lets you rapidly develop programs.

Speed Benchmarked: Euphoria is Faster than Python, Perl, ...

"essay in progress"

No-one has ever complained that a program executes too quickly. Rapid program development is achieved with a fast interpreter and all of the extras that Euphoria provides.

Illustrative results comparing Euphoria (4.0.5) against Python and Perl on Linux Mint14. Testing on a netbook with an i5 processor. The Python and Perl programs were taken from the Bench Marks Game*.

Euphoria Python Perl
Benchmark(argument) euc eui
ackermann(10) 0.35 5.51 10.85 19.0
binary(18) 12.23 16.9 64.4 129
fannkuch(10) 0.91 3.25 10.6 17.3
nbody(500000) 0.01 0.02 8.46 13.1
Time in seconds fast slow

Rigorous testing is not needed to appreciate that Euphoria is fast.

Convinced yourself by running these benchmarks on your own computer. All of the programs used in this demonstration are included in the Euphoria distribution.

Euphoria finishes; Python crashes. In the binary benchmark keep increasing the size of the argument. On my computer Python crashes at 24 while Euphoria continues to provide results.

I don't know how to benchmark convenience, but you can recognize it the expressive power of atoms/sequences, simple syntax, and readable code. The standard library, meaningful error messages, tracing tool, unit tests, and documentation tools all contribute to productivity and the speed with which you can create programs. Euphoria lets you write code and test it in rapid succession; incremental code writing lets you test ideas and find bugs quickly.

Examples Illustrate: The Flexibility of Euphoria.

"essay in progress"
Consider* adding values of corresponding elements from two lists; using Euphoria only one statement is needed:

? list1 + list2 

For example:

sequence list1 = { 1, 2, 3 }, list2 = { 10, 20, 30 } 
? list1 + list1 
--> { 11, 22, 33 } 

Python* requires more work. Notice the syntax based on invisible punctuation (don't confuse a space with a tab); consistency is broken by the need for extra punctuation.

# Python version. 
def pairwise_sum(list1, list2): 
	result = [] 
	for i in range(len(list1)): 
		result.append(list1[i] + list2[i]) 
	return result 

Perl* tends to be difficult to read.

# Perl version. 
sub pairwise_sum { 
	my($arg1, $arg2) = @_; 
	my(@result) = (); 
	@list1 = @$arg1; 
	@list2 = @$arg2; 
	for($i=0; $i < length(@list1); $i++) { 
		push(@result, $list1[$i] + $list2[$i]); 

The Euphoria function is short and easy to read.

function pairwise_sum( sequence list1, sequence list2 ) 
	return list1 + list2 
end function 

A Euphoria GUI program to minimally display a window:

                    -- example: base.ex 
include GtkEngine.e 
                    -- Set up the window and the button within. 
constant window = create(GtkWindow) 
constant button = create(GtkButton, "Hello World" ) 
                    -- Show the GUI 

In Python the same program looks like:

#!/usr/bin/env python 
# example 
import pygtk 
import gtk 
class Base: 
    def __init__(self): 
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) 
    def main(self): 
print __name__ 
if __name__ == "__main__": 
    base = Base() 

base.png Minimal GUI window.

Easy Defined: a Language that is Simple, Small, Consistent, and Predictable.

"essay in progress"

  • ideas supporting "Euphoria is easy to learn, easy to use"
  • unsorted

imperative, natural for most programmers, results in fast efficient execution

OOP is intrinsically more complicated

small (less to learn and remember)

easy to read (English keywords, begin something end something, freeform, no exceptions, pseudocode, visible syntax )


speed, clean, powerful

free-form syntax is easier than lockstep syntax

syntax without irregularities is easier than syntax with exceptions to the rule

four built-in types is easier than having many data-types

consistent syntax is easier than syntax with operator and syntax overloading

a "teaching language" is good for teachers, not so good for learners

one based indexing is easier than zero based indexing

mutable data-types are easier to use

oEu functions do not have to be introduced before they can be used

aliased variables are harder to program

the requirement that variables be introduced reduces programming errors

oEu variables can not be changed without an explicit assignment (no surprises)

simple error messages are easier than technical jargon based error messages

oversimplification comes at the cost of power ( for example:

puts(1, "hello" )
is not as simple as
puts "hello",

but puts can output to a screen, file, or device)


  2. Rudyard Kipling The Jungle Book. Rikki-Tikki-Tavi is a mongoose in a classic story by Rudyard Kipling.
  3. Rikki-tikki-tavi,
  4. Run your own benchmarks to confirm Euphoria is fast. Sample benchmark programs are included with Euphoria. More information on benchmarking:
  5. Euphoria as invented by Robert Craig. He released Euphoria V1.0 in July 1993 as shareware by Rapid Deployment Software (RDS). We are now an open source project working at version V4 with many people contributing to its development.
  6. Examples to show Python is simpler than Perl: The Quick Python Book, Second Edition Revised edition of The Quick Python Book by Daryl K. Harms and Kenneth M. McDonald. Naomi R. Ceder January, 2010 ISBN: 9781935182207
  7. PyGTK 2.0 Tutorial by John Finlay Published April 13, 2005 This tutorial describes the use of the Python PyGTK module.


Additional Resources

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu