How lucid is Lucid?

In 1976, a language appeared from the University of Waterloo named Lucid. What is interesting about this unconventional “data flow” programming language is that the order of the statements in the language is irrelevant, and assignment statements are equations. It seemed to be primarily designed to carry out mathematical proofs, describing an algorithm in terms of assignments and loops. Here is a simple Lucid program to calculate the square root of a number N:

1  N = first input
2  first I = 0
3  first J = 1
4  next J = J + 2×I + 3
5  next I = I + 1
6  output = I as soon as J>N

Now let’s look at how it works:

  1. inputs N
  2. initialize the loop variable I
  3. initialize the loop variable J
  4. repeated, generates successive value of J
  5. repeated, generates successive value of I
  6. terminates the loop and outputs the result

Of course to the average programmer, this seems kind-of intuitive, not completely left of field like some languages (Lisp anyone?). The authors describe this language as being spartan – containing NO procedures (as differentiated from functions), data structures, control structures or I/O. They go on to remark that “not having to worry about control flow is remarkably liberating” [1].

I doubt there is still a compiler anywhere, but it is a cool language to at least explore on paper.

[1] Ashcroft, E., Wadge, B., “Some common misconceptions about Lucid”, ACM SIGPLAN Notices, 15(10), pp.15-26 (1980).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s