5 old Programming Languages you might want to be aware of

blag

Alvaro (Blag) Tejada Galindo

Posted on January 25, 2022

5 old Programming Languages you might want to be aware of

Learning from the past can help you look into the future.

As my post 5 old Programming Languages you should know about was successful so I decided to keep going...

This time I want to share some old programming languages that might not be so "well known" but that are still important pieces of the history of programming...

To illustrate how those programming languages work, we're to use a very basic app called "Fibonacci List" which will simply output a list of requested Fibonacci numbers, for example if we ask for 5, it should return 0, 1, 1, 2, 3, 5.
We used before, so why not used it here again...

We're not going in order this time...

Miranda (1985)

Miranda Logo

Lazy, purely functional programming language.

fib :: (num, num, num) ->  [char]
fib(num,a,b) = show(a+b) ++ " " ++ 
               fib((num - 1),(a+b),a), if(a > 0 & num > 1)
             = show(a) ++ " " ++ show(b) ++         
               " " ++ show(a+b) ++ " " ++                
               fib((num - 1),(a+b),b), if(a == 0)
             = [], otherwise

showFib :: num -> [char]
showFib num = "\n" ++  fib(num, 0, 1) ++ "\n"
Enter fullscreen mode Exit fullscreen mode

Let's see...Miranda doesn't have variables, arrays, tables or dictionaries...so lists are your best friends...doesn't have loops so recursion is a must...
It was a major inspiration for Haskell.

Compilers are available here.
To run it we do...

mira name_of_file.m
Enter fullscreen mode Exit fullscreen mode

And then call the main function with its corresponding parameter

showFib 5
Enter fullscreen mode Exit fullscreen mode

Miranda Exec

You can read my Miranda introduction here.

Rexx (Restructured Extended Executor - 1979)

Rexx Logo

Multiparadigm, procedural, structured and interpreted programming language, but also scripting and macro.
It is considered the very first Scripting Language.

say "Enter a number: "
pull number .
say ""
call fibo number, 0, 1
say
exit 0

if a = 0 then
    do
        a_b = a + b
        call charout, (a b a_b)
        call charout, " "
        call fibo num - 1, a + b, b
    end
else if a > 0 & num > 1 then
   do
        a_b = a + b
        call charout, a_b
        call charout, " "
        call fibo num - 1, a + b, a
    end
return
Enter fullscreen mode Exit fullscreen mode

There are no arrays in Rexx...we call them compounds. We have functions and subroutines, as well as some sort of stack. It's actually pretty fun to use...

On Linux, we can get the compiler as easy as doing this...

sudo apt-get install -y regina-rexx
Enter fullscreen mode Exit fullscreen mode

For other platforms, go here.

To run we simply do this

regina name_of_file.rexx
Enter fullscreen mode Exit fullscreen mode

Rexx exec

You can read my Rexx introduction here.

Icon (1977)

Icon Logo

Very high-level programming language featuring goal-directed execution.

procedure fib(num, a, b)
    local result
    result := ""    
    if a > 0 & num > 1 then    
        result := result || " " || (a + b) ||         
                  fib(num - 1, a + b, a)        
    else if a = 0 then    
        result := a || " " || b || " " ||         
                  (a + b) || fib(num - 1, a + b, b)        
    return result    
end

procedure main()
    local num 
    write("Enter a number: ") 
    num := read() 
    write(" ") 
    write(fib(num, 0, 1))
end
Enter fullscreen mode Exit fullscreen mode

There's not data type declaration...as it changes according to its value. An operations can success or fail...which prevents crashes. Icon doesn't have arrays, but lists, records and tables and list can be composed of different data types.

You can download Icon from here.

And follow these instructions to compile it.

To run our app we simply need to call it like this

icon name_of_file.icn
Enter fullscreen mode Exit fullscreen mode

Icon Exec

You can read my Icon introduction here.

Prolog (Programming Logic - 1972)

Prolog Logo

General purpose logic programming language associated with artificial intelligence and computational linguistics.

fibo(NUM,A,B,[H|T]) :- (NUM > 1 -> H is A + B, X is NUM - 1, 
                        (A =:= 0 -> fibo(X,H,B,T); fibo(X,H,A,T))).
fibo(_,_,_,[]).

fibonacci(NUM,R) :- fibo(NUM,0,1,X), !, append([0,1], X, R).
Enter fullscreen mode Exit fullscreen mode

Prolog is declarative and the program logic is expressed in terms of relations, represented as facts and rules. Recursion is a key component of Prolog.

For this I'm using swi-prolog because it's free and widely used.

To run this example, simply do this

swipl
Enter fullscreen mode Exit fullscreen mode

And the call our filename like this...

[fibonacci].
Enter fullscreen mode Exit fullscreen mode

Then, call the main function like this...

fibonacci(5,X).
Enter fullscreen mode Exit fullscreen mode

Prolog Exec

You can read my Prolog introduction here.

And least but not last...

Forth (1970)

Imperative stack-based programming language and programming environment.

Forth Logo

: FIBO 
   1 SWAP 
   0 DUP . 
   ?DO 
      DUP . OVER OVER + ROT DROP 
   LOOP 
   DROP DEPTH 
   DEPTH 2 = IF 2DROP 0 THEN ; 
Enter fullscreen mode Exit fullscreen mode

As we manipulate the stack, we use LIFO (Last In, First Out). There's a lot of functions to help us with the stack, like duplicate, rotate, swap and so on...

If you're using Linux, simply do this...

sudo apt-get install pforth
Enter fullscreen mode Exit fullscreen mode

If you're using Windows then go here.

In order to run this example simply call

pforth
Enter fullscreen mode Exit fullscreen mode

And once inside the environment

INCLUDE name_of_file.fth
Enter fullscreen mode Exit fullscreen mode

Forth Exec

You can read my Forth introduction here.

That's it...I hope you like this post and next one coming should be 5 not well known Programming Language that are worth exploring.

Blag.

💖 💪 🙅 🚩
blag
Alvaro (Blag) Tejada Galindo

Posted on January 25, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related