by Jeremy Cowgar, Robert Craig (original), Matt Lewis, Derek Parnell
Powerful but easy-to-learn language with simple syntax and structure with consistent rules.

Euphoria is a powerful but easy-to-learn programming language. It has a simple syntax and structure with consistent rules, and is also easy to read. You can quickly, and with little effort, develop applications, big and small, for Windows, Unix variants (Linux, FreeBSD, ...) and OS X.

Euphoria was first released as shareware way back in 1993. Nowadays, it is being developed as an open source project that is community driven and maintained. The language has evolved into a sophisticated tool for programmers.

Surprising to many, Euphoria is one of the fastest interpreted languages around however for more speed and ease of distribution Euphoria also includes an integrated Euphoria to C translator. Euphoria provides subscript checking, uninitialized variable checking, garbage collection, and numerous other run-time checks, and is still extremely fast.

Euphoria is a general purpose programming language with a large library base making it usable for a variety of tasks. Its use of simple English words rather than punctuation enables you to quickly read the source code and understand it.

include std/console.e
sequence original_list

function merge_sort(sequence x)
-- put x into ascending order using a recursive merge sort
    integer n, mid
    sequence merged, a, b

    n = length(x)
    if n = 0 or n = 1 then
        return x  -- trivial case
    end if

    mid = floor(n/2)
    a = merge_sort(x[1..mid])       -- sort first half of x
    b = merge_sort(x[mid+1..n])     -- sort second half of x

    -- merge the two sorted halves into one
    merged = {}
    while length(a) > 0 and length(b) > 0 do
        if compare(a[1], b[1]) < 0 then
            merged = append(merged, a[1])
            a = a[2..length(a)]
            merged = append(merged, b[1])
            b = b[2..length(b)]
        end if
    end while
    return merged & a & b  -- merged data plus leftovers
end function

procedure print_sorted_list()
-- generate sorted_list from original_list
    sequence sorted_list
    original_list = {19, 10, 23, 41, 84, 55, 98, 67, 76, 32}
    sorted_list = merge_sort(original_list)
    for i = 1 to length(sorted_list) do
    	display("Number [] was at position [:2], now at [:2]", 
    	        {sorted_list[i], find(sorted_list[i], original_list), i}
    end for
end procedure

print_sorted_list()     -- this command starts the program
Information updated 04/04/16
View Comments