Reading List

The Selfish Gene
The Psychopath Test: A Journey Through the Madness Industry
Bad Science
The Feynman Lectures on Physics
The Theory of Everything: The Origin and Fate of the Universe


ifknot's favorite books »

Friday 13 December 2019

The Joy Programming Language #1

Functional Programming in Joy #1
Just because something is obscure does not make it unworthy of study.


What is Joy?

Joy is a pure, concatenative, functional, scalar programming language.
Joy is pure because it does not contain assignment.
Joy is functional because computation consists of the evaluation of expressions.
Joy is concatenative (and not applicative) because
  • The elementary well-formed expressions of Joy are monadic functions of a nameless data stack.
  • If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed.
  • If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y.
Sadly, the official website is no longer hosted by La Trobe University however there is a reasonably complete mirror hosted by Kevin Albrecht and the Wikipedia page is helpful.

Hello World in Joy?

"Hello, world!\n" putchars .

Quicksort in Joy?

DEFINE qsort ==
  [small]            # termination condition: 0 or 1 element
  []                 # do nothing
  [uncons [>] split] # pivot and two lists
  [enconcat]         # insert the pivot after the recursion
  binrec.            # recursion on the two lists (full-stop ends the define)

Who invented Joy?

Manfred von Thun was the inventor of the Joy programming language.

According to the LaTrobe University Alumni news:

"Alumni and staff will be saddened to hear of the death of Manfred von Thun on 23 October after a long illness. Manfred was a member of the philosophy department from early 1972 until his retirement in 2003, but remained an honorary associate until 2009. Manfred specialized in logic, philosophy of science, philosophy of mind, computer programming and cybernetics. He was also renowned for developing the computer programming language, Joy. He will be sadly missed."


Joy’s inventor, Manfred von Thun 


Sunday 8 December 2019

Enable CGI Apache2 (Debian et al)

C++ Server Side Web Development

CGI, the Common Gateway Interface is a simple way to write web applications. It is by no means the fastest and some may say that:

"If you're planning to write your web application in C++, it would be total waste to then interface it as CGI.

My suggestion would be to build it asynchronous using ASIO (Asynchronous I/O). With that you can build blazing fast web service (combine with nginx as a reverse-proxy and statics server for best effects); Combine that with template library like Wt and you're ready to serve tens of thousands request per second from a single server.

Whether this is practical alternative to dynamic language web framework is another issue." vartec 2013 

However, it is a simple way of demonstrating server side web development with a number of programming languages, including C++.

Install Apache2

To support websites built with C++ using the CGI requires webserver software capable of (which is all of them) and configured to enable (not all of them) execute code in a cgi directory.