Wednesday, February 6, 2013

Euphoria

I am a software engineer and I enjoy using a variety of languages for my work and my play. Some of my favorites are the old-time imperative languages like Fortran or Pascal or even BASIC (extended versions). I also enjoy some functional languages, like IO, and "almost" OO languages like Ada and C++. I say almost because they don't REALLY fit the bill as true OO languages, but have OO features.

I also enjoy byte interpreted languages like Python, Groovy, and a few others... but perhaps my favorite language that embraces the imperative with the interpreted is Euphoria. There are two flavors of Euphoria available: original and opensource-continued. The original version of Euphoria is simplicity itself, lacking many advanced features. It ended at version 3.1 when the creator of the (commercial) language open sourced it. The open version of the language at 4.x now, has added some more modern features to the language but they are also doing their best to maintain a level of simplicity by maintaining the core of the language which consists of two basic data types, the atom and the sequence.

An atom is basically a numeric value. A sequence is a group of atoms or other sequences.

Some Atoms:

1
3.14
'A' (or the numeric value 65... it becomes a letter when you output it using something like puts())

Some Sequences:

{1}
{1, 2, {'3', '4'}, 5}
{'A', 'B', 'C'} which is the same as "ABC", a string is a sequence.

In addition to the two data types two other variable containers are defined: integer and object.

An integer is an atom that is limited in its nature to an unsigned numeric value. An object can be whatever you assign to it. For example:

object my_var

my_var = 1
my_var = "this is acceptable too"
my_var = {2.1, 'V', "something else"}

With these simple data types you can create just about anything you can think of.

Another fine feature of Euphoria is that it has in-built vector processing for sequences. Some more examples:

{1, 2, 3} + {4, 5, 6} => {5, 7, 9}
{1, 2, 3} + 1 => {2, 3, 4}

You can add/subtract/etc. two sequences with the same number of items, or a sequence with an atom.

It is a fun and fast language. The original version was estimated to execute 6 times faster than the equivalent java code. It is not the most popular language but there is a small following and a variety of packages have been and continue to be created by the fans of Euphoria.

Check out:

The original website (v3.1) http://www.rapideuphoria.com/
The open source version (4.0.5) http://openeuphoria.org/index.wc

Enjoy.

Tuesday, February 5, 2013

Lazy Repost

I haven't posted much lately...  so I am reposting here something I wrote elsewhere:


-=-=-=-=-=-=-=-=-=-

Most of what God gave the Israelites are what we would consider to be common sense, today.  But it wasn't to them.  Also, I might add that when you encounter laws that you disagree with for some reason while reading exodus, deuteronomy, etc. think to yourself, "most of these laws just make sense..." and give the other laws the benefit of the doubt.  Not everything recorded applies to all of us today because society has changed and our situations have changed (ie. not wandering around in a wilderness with a large population for 40 years).  But the BASIS of the laws still apply, the reasoning behind them, and are right and just.

Some laws laid out by God
==============================
You must not exploit a foreign resident or oppress him, since you were foreigners in the land of Egypt.
You must not mistreat any widow or fatherless child.
If you lend money to My people-to the poor person among you, you must not be like a moneylender to him; you must not charge him interest.
If you ever take your neighbor's cloak as collateral, return it to him before sunset.  For it is his only covering; it is the clothing for his body. What will he sleep in? 
You must not spread a false report.
Do not show favoritism to a poor person in his lawsuit.
You must not deny justice to the poor among you in his lawsuit.
If you come across your enemy's stray ox or donkey, you must return it to him.
If you see the donkey of someone who hates you lying [helpless] under its load, and you want to refrain from helping it, you must help with it.
Do not kill the innocent and the just.
You must not take a bribe.
You must not oppress a foreign resident.
Sow your land for six years and gather its produce.  But during the seventh year you are to let it rest and leave it uncultivated, so that the poor among your people may eat [from it] and the wild animals may consume what they leave. Do the same with your vineyard and your olive grove.
------------------------------------------------

...and they go on and on like this.  These are some of the "minor" laws listed after the 10 commandments.  What do you see in this?  I see a desire for justice (fairness) and compassion... even for your enemy.

People who do not want to believe tend to focus on some of the more difficult passages of war/destruction, despite the context of being harassed and attacked by many of the same groups during their jaunt through the wilderness.  But you see from the laws God lays out that He is just and compassionate... we assume innocence on those peoples' part but that is not the case.  We are not offered the whole picture, just what we need to learn about the relationship God has with Israelites (and later with us all).

And of course there are the 10 commandments:

Do not have other gods besides Me.
Do not make an idol for yourself, whether in the shape of anything in the heavens above or on the earth below or in the waters under the earth.
Do not misuse the name of the Lord your God.
Remember to dedicate the Sabbath day (ie. remember to take a break, and even if you don't, let those who live in your household or work for you have a break).
Honor your father and your mother.
Do not murder.
Do not commit adultery.
Do not steal.
Do not give false testimony against your neighbor.
Do not covet your neighbor's house. Do not covet your neighbor's wife ... or anything that belongs to your neighbor.

Most of the minor laws are based off the 10 commandments... but ALL of the law (including the 10 commandments) is dependent on and based off of the top 2 commandments:

Love God with all your heart and mind and soul.
Love your neighbor as you love yourself.

Jesus expounded on these two laws and noted that we should love one another as HE loved us (he gave up everything for us, even his life and served us).

Yeah, there are some tough parts in the Bible that we find difficult to accept or to understand... but based on this, you have to at least stop and think if THIS is SO RIGHT, why shouldn't the parts we DON'T like be also right?

Finally, it should be noted that the Israelites were to be God's HIGH PRIESTS to the world.  Often their laws required a punishment of death, which shocks some people, but these people were supposed to rise above and beyond the common people of the world in their relationship with God and one another.  Hence the punishments for breaking some of the laws were pretty tough.  And yet there were often caveats on the punishments, like the law on murder states that if a death was accidental, then the punishment would not be death but recompense to the family.   Or if your ox gores someone, pay recompense, but if the owner knows the ox is a mean one and has gored people in the past and allows it roam free to gore again... well... the punishment is much more severe.  So you can see the punishments often will fit the ATTITUDE of the person committing the crime.  Even among God's High Priests...