🎯 Try Euphoria 3 Online Powered by TIO

😴 Introduction by Shian

So - What is so special about this programming language, Euphoria 3.1.1, after all?

First, it has never become a mainstream language. Destiny. Some may say that it's good - other may say that it's bad. Lately, I say that it's good... it kept this language pure. As simple and powerful as it was 12+ years ago.

I used to program in the legendary QuickBASIC 4.5 for DOS. I used to think faster in QuickBASIC then in my own language. I was sure that I'll never find something more simple and practical then that. But I was wrong. Small parts of my QuickBASIC projects I used to code in MASM 5 (Assembly) - at the time speed and efficiency were important.

First I found Euphoria in 2011, more or less, out of frustration. I was extremely bored and frustrated from the modern programming languages. Especially from OOP, Object Oriented Programming. I was looking for something better.

I found Euphoria 3.1.1 a minimalist language, with a very short learning curve. Euphoria was 1000 times more simple then the legendary QuickBASIC 4.5 - I don't exaggerate. At least 1000 times more simple. Ridiculously more simple. And at the same time offered unlimited power. So I decided to give it a try, after all I hate programming, but programming it's a therapy for my mind because I think too much, and too fast.

So - What is so special about Euphoria 3.1.1?

If you like to program, but you fed up with the unstoppable epidemic - the modern technology - learn how to use a "sequence", that's all you need to create a small or large, mature and sane project, in Euphoria 3.1.1.

📜 What is Euphoria?

Euphoria is a simple, flexible, and easy-to-learn programming language. It lets you quickly and easily develop programs for Windows, DOS, Linux and FreeBSD. Euphoria was first released in 1993. Since then Rapid Deployment Software has been steadily improving it with the help of a growing number of enthusiastic users. Although Euphoria provides subscript checking, uninitialized variable checking and numerous other run-time checks, it is extremely fast. People use it to develop Windows GUI programs, high-speed DOS games, and Linux/FreeBSD X Windows programs. It is also very useful for CGI (Web-based) programming.

The Euphoria package is now completely free, and the download package even includes the full, open source code.

⏳ Example Program

The following is an example of a complete Euphoria program.

 sequence list, sorted_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 list
     list = {9, 10, 3, 1, 4, 5, 8, 7, 6, 2}
     sorted_list = merge_sort(list)
     ? sorted_list
 end procedure

 print_sorted_list()     -- this command starts the program


The above example contains 4 separate commands that are processed in order. The first declares two variables: list and sorted_list to be sequences (flexible arrays). The second defines a function merge_sort(). The third defines a procedure print_sorted_list(). The final command calls procedure print_sorted_list().

The output from the program will be:
    {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.

merge_sort() will just as easily sort {1.5, -9, 1e6, 100} or {"oranges", "apples", "bananas"} .

This example is stored as euphoria\tutorial\example.ex. This is not the fastest way to sort in Euphoria. Go to the euphoria\demo directory and type "ex allsorts" to see timings on several different sorting algorithms for increasing numbers of objects. For a quick tutorial example of Euphoria programming see euphoria\demo\bench\filesort.ex.

Respect for privacy

🗹 This site does not collect any information about you, the visitor.
you are completely anonymous from my point of view.
Only the
Forum keeps IP address of registered users for the purpose of moderating irrelevant posts. -- Thank you, Shian.
Visitor Hit Counter