Skip to main content

The ultimate programming language ?

After many years of thought and many years of using many languages, I am now more and more convinced that the “perfect” combination, if such a thing exists, is going to be a mix of Haskell, LISP and Prolog.
Exactly what “combination” means in terms of the different programming paradigms each presents is completely unknown to me at this point! Haskell is functional, Prolog is logical and LISP is everything.

LISP

First of all, the uniform s-expression shape of LISP is so absolutely pure, clean and simple that I feel it’s the true shape of expressing thoughts as code. If you work in LISP long enough you don’t even see the parens any more. Really. And the implied return value being the last thing you did is also useful.

Haskell

Haskell is incredibly clean in its form. The use of a space character as the argument separator is cool. The functional aspect is also very very nice. What I don’t like about Haskell is the IO / monad thing, Sometimes it feels incredibly hard work to do things within the context of other things, pardon the pun but sometimes there’s just too much heavy lifting!

Prolog

Finally, Prolog. We all know about predicate logic, true or false. There is something so clear and obvious about Prolog rules… that the rule is true if and only if every single sub-rule is true. The first version of Erlang was written in Prolog, and when I learned that I suddenly realised why the syntax of Erlang is like it is, it made Erlang much more readable for me.

Commonality

Haskell and Prolog both offer pattern matching; once you understand and get used to the idea of extracting “if” tests out of the code and making them separate clauses, your code becomes much clearer and easier to read and reason about. LISP doesn’t have pattern matching per se but it does have multi-methods, something I am sure no other language yet offers at all (I could be wrong) and this from a language created back in the 1950-s! John McCarthy and his students did something truly amazing indeed.


So, what’s the ideal? The future is on highly concurrent and scalable systems. So functional programming is more than likely the way forward for lots of reasons to do with not passing around state and the ability to perform map-reduce optimisations on functions just by deductive reasoning on what it does, or more importantly, doesn’t do: rely on external state.

Compilers are getting smarter, we need to keep up!

I am going to think about this more actually, and maybe design an “ivory tower” conceptual language and throw it out there…

Comments

Popular posts from this blog

AndroidStudio and a RAM Disk

Ok, my iMac is late 2012 and only has 8GB of RAM. I decided to see if it would be possible to speed up my development cycle, especially for running unit tests and the like but just as much for an improved build time as well. After much fiddling in the dark and reading some great pages, I eventually came up with the following solution that works for me but bear this in mind: Danger Will Robinson RAM is volatile so everything you do is gone forever when you unmount it or shutdown so don't forget to copy your changes elsewhere. If you have Git integrated properly then get into the habit of committing frequently. I have considered writing a small bash script to run `rsync` from a custom menu option  (and thus a shortcut key binding) or look into using the Apple Automator to transfer any changed files across to the hard drive. Whatever... you have been warned! Step one: Create the RAM disk, I do it like this: diskutil erasevolume HFS + "RAMBO" `hdiutil attac

Prime Peace

I think prime numbers are the numerical expression of peace. Restful nodes in the vibration of everything. Prime factorisation has always struck me as something truly astounding and it is reassuring to know that awsesome minds are hard at work trying to solve the Riemann hypothesis right now. There are some truly wonderful professional and amateur (in the nicest sense of the word) explorations I have watched recently and the ones that moved me the most, in order of cool factor were: This guy,Carlos Paris, has put in some serious work with AutoCAD and made some interesting observations. I truly enjoyed watching all of his four videos. Awesome work Carlos. As an interested amateur I found his work and thoughts to be very compelling. I am sure the professionals would groan or moan but to me this video is most excellent and informative. Speaking of the professionals, this video is also very interesting to watch as it goes some way to visually explaining the Riemann hypothesis in

Handling multipart/form-data with NanoHTTPD

I am in the process of reviving an old project from 2014 that I never finished because of other work commitments. In that time, bitrot has set in, the Android API has moved on and all in all, the home-brewed HTTP server I wrote using SocketServer and the org.apache libraries had to go! I looked around, found a couple of contenders and after much time decided to go with NanoHTTPD because it is lean, small and fits in exactly two files. The main server is in one file `NanoHTTPD.java`and there is another file called `ServerRunner.java` which manages instances of running servers. The others The other project I looked at is this one:  https://github.com/koush/AndroidAsync which led me a merry dance and I just couldn't figure out how get the POST data I had uploaded. I spent a few days really digging at it with Wire Shark too to make sure the data was going up. It was. Whatever... I had used it via a gradle dependency entry but I dropped it and went back to NanoHTTPD. For m