## Lisp, Logo, LaTeX and Lua

**L** is for Lisp, Logo, LaTeX and Lua.

Lisp lovers are rarely non-clever people, but not all clever people are Lisp lovers (declaration of self-interest: I am not a Lisp lover). Many of the Lisp lovers I know really enjoy playing Dungeons and Dragons and the common connection is surely getting joy from traversing labyrinthine structures. Lisp lovers must be the go to subjects for any PhD project looking for neurological predispositions for programming.

All those brackets were never intended to be, the early Lisp implementations just got left in a prerelease state and the world has been going cross-eyed ever since.

Lisp’s big selling point was being able to treat data and code interchangeably. Figuring out what to do and creating the code to do it is a surprisingly common requirement in a dynamically changing world and many Lisp applications involve real world interaction (just like Javascript does).

Logo is the original Scratch, or whatever computer language people think children should be learning these days. It was created 20 years before computers were cheap enough to allow children to touch them, so its primary use was in media related activities pontificating about what children will be doing in the future. Turtle graphics grew out of Logo and has proved to be a very intuitive way, for many people, of creating useful line drawings.

LaTeX is probably used by lots of developers without them ever thinking about the fact that it is a programming language (i.e., it is Turing complete). But then it is the kind of language that would make you want to run away screaming rather than use it to write ‘code’.

Lua might be the first language that received its starting impetus from a trade barrier (Brazil wanted to foster a home computer industry; I have no idea what has been going on with programming language in China, but I have encountered lots of Soviet fans of Algol 68). Lua has carved out a niche as an embedded scripting language and a major LaTeX system is now being migrated to a Lua framework.

**Things to read**

LISP 1.5 Programmer’s Manual by John McCarthy, Paul W. Abrahams, Daniel J. Edwards, Timothy P. Hart and Michael I. Levin.

The Computer Science of TeX and LaTeX by Victor Eijkhout.

I will probably gets lots of emails unless the following gets a mention: Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman and Julie Sussman. If you have not read it yet and love playing Dungeons and Dragons, then you have a treat in store. MIT don’t use it as THE undergraduate CS book anymore, where its purpose was once to train MIT students in extracting information from high noise environments.

You have me sandwiched there between some big names. I hope you’ll enjoy the book.

It would be nice if you’d fix the captcha input box. MOST OF THE RESPONSES REQUIRE 3 DIGITS.

@Robert Young

Thanks for the problem report. I have just tried to duplicate it and all the responses required two digits. I will have a look at the code. Do you remember any of the questions you were given that required three digits?

Whew. I’m glad it’s not just me. I was trying to submit the other day and couldn’t solve the captcha. I could have solved it if it allowed 3 digits, but it would only allow two. In 2 out of 3 times I’ve tried to submit, the captcha was seemingly unsolvable.

The problem was something like:

thirty + [ ] = 20 (0b000l)

@Alan Eliasen

Thanks for the the reply: thirty + [ ] = 20 (0b000l)

So the rhs is read as 201 rather than 20 and 1. Will give a hint to read as two digits.

@Derek Jones

Sorry, I guess I still don’t understand. When you say “is read as” does that mean “is intended to be read as” 201? In that case, what 2-character answer would work? (And what 3-character answer would work?) I don’t think any of these would work.

I also don’t understand the hint to read as two digits, even if you’re trying to parse it as standard mathematical notation where an implicit multiplication would be indicated when two values are juxtaposed (even with one in parentheses). In that case, it would be 20 * 1 = 20, again, for which no two-character answer would work.

Requesting the user to read it as two digits doesn’t help. Does that mean implicit multiplication as would be implied by standard mathematical notation or concatenation or addition or lambda functor application or what?

Also, in the current captcha and that one, there are multiple problems. It says:

“50 + (minus 0b0l0l ) = [ ]”

The biggest problem being that those are lowercase L characters, *not* the number one! They look very different on my screen, which repeatedly led me to believe that you didn’t mean the 0b prefix notation for binary. (I tried interpreting it as that anyway in the previous example, but that didn’t work.) It’s confusing, if not outright wrong and offensive for coders to whom recognizing distinctions between 1 and l are their lifeblood.

The secondary problem is that negative numbers should be more correctly written “negative 3″ and not “minus 3″.

Not authoritative, but an explanation:

http://mathforum.org/library/drmath/view/61346.html

A tertiary problem in this pseudo-binary representation would note that you specify a limited number of bits (say, 4 in both examples) in your pseudo-binary value, and a two’s complement version (i.e. its negative in most modern architectures) of that value would have no more bits than than your representation (nobody knows how big your word size is unless you tell them, and your representation of 4 bits is the only guess we have) The two’s complement (i.e. negative) version of the (correctly-written with ones instead of L) 0b0101, limited to 4 bits, would thus be 0b1011. If extrapolated to arbitrary precision, it would have an infinite number of 1s to the left of the MSB. None of your captchas should have a one (or an L) in the leftmost digit of any binary number, or it implies negative numbers in two’s complement.

Or did you have a one’s complement architecture or sign-magnitude in mind? We dunno; it’s equally valid in computer science but unspecified in the captcha.

Having users have to infer the behavior of a non-specified, non-standard, potentially unsolvable pseudo-language with unspecified number sizes is more likely to drive programmers off than encourage their thoughtful contribution. As I mentioned before, almost all of the captchas I’ve seen have been problematic if not provably invalid (in most mathematical models) syntax.

If you have an unambiguous parser specification in mind that would handle all of these nonstandard cases (e.g. does putting a number next to another mean implicit multiplication or addition or concatenation? Does it mean something different if one number is in parentheses?) then thoughtful programmers might actually *enjoy* solving a captcha if you put the grammar and syntax rules into EBNF form (or the like) that you could pop up and scrutinize. Otherwise, you might just consider making the captchas closer to some actual language’s unambiguous syntax.

Summary: I enjoy the blog but the captcha system is provably broken and probably invalid in any programming paradigm you could mention.

After posting this, the captcha was:

40 − [] = forty 0b0l00

Seriously, what does “forty 0b0l00″ mean? Addition? Multiplication? Concatenation? There is a letter L in what should be a binary number. That makes no sense.

Let me try.

Let’s pretend that “0b0L00″ means “0b0100″ and that number equals 4 when parsed as binary.

What does the “forty 0b0100″ mean? Multiplication? Any time two numbers are juxtaposed in standard mathematical notation, you multiply them. Let’s try.

40 times 4 is 160, which is what we’re trying to get to on the right-hand-side.

Okay, 40 – x gives you 160. So what is x?

x has to equal -120.

We can solve that in my programming language Frink:

http://futureboy.us/fsp/solve.fsp?eq=40+-+x+%3D+160&solveFor=x&w=on

However, we can only enter 2 digits. Hardly enough for “-120″. Sigh. Fail.

One would think that “40 – x = forty” would mean that x = 0. But there’s that weird “0b0L00″ at the end. What does it mean? Is it relevant, or, as I thought earlier, a following line that wasn’t separated by newlines?

Let’s try 0. If it works, this will submit. Why, I dunno.

Of course it didn’t submit. 40 does not equal forty (if “forty” is followed by the non-binary 0b0L00 for some reason).

You figure it out.

Let’s see. What could “forty 0b0LOO” mean? Did they mean forty times the binary value 4? Sorry, that won’t fit into 2 characters.

Judging from earlier mysterious mentions in this thread, should we guess that it’s concatenation? No language nor mathematical standard works this way, but nothing else logical works. Should “forty 0b0L00″ mean “40” PLUS “4” which makes no sense but let’s try it. Never mind that addition was never mentioned, but multiplication was implied.

If this means “-4″ then this will succeed and you’ll see it. And you will sigh, as I did.

Sigh.

@Alan Eliasen

The intent is that forty 0b0l00 is read a forty four (the l is to stop automatic number recognition; bots are amazingly clever these days).

Like all people who have ‘great’ ideas, it is obvious to me (I wanted it to be non-obvious to non-developers). This thread contains two people for whom it was not obvious and I suspect there are many more.

I either need to do something very different or give a good clue.

Suggestions welcome.

— Suggestions welcome.

Wow. Let’s follow Sherlock Holmes, and recognize that, once we have eliminated the impossible, whatever remains, however improbable, must be the truth.

I didn’t get a response to my e-mail address from Mr. Jones, so I assumed that he didn’t care about the problem.

The problem: I read the (at the time) latest post on R, composed a thoughtful comment, and attempted to post. Reading the captcha led to a Negative Two Digit answer, thus 3 characters. The box will accept only 2 characters. The fix: accept 3 characters, as my SHOUTED sentence asked for. What could be simpler? And what could it hurt, even if some have issue with the interpretation of the calculation? If Mr. Jones asserts that all his captcha’s can be done correctly with 2 characters, he need only do what I did: follow the post history to find that this is the only (or, at least, first in reverse chrono order) post which yields a 2 character input. And thus has comments. The captcha is doable, and the answer fits the input box. Thus we can have a conversation. D’oh!!!

In attempting to get my R comment posted, I tried Chrome to see whether it was a browser issue. I’m here because I’m in Chrome for other reasons, and this was my last page. Deja Vu.

Make a 3 character input box, OK?

@Robert Young

Your problem report (I try to respond to all reports promptly) was in this thread and cited the need to give three digits. This problem baffled me until I saw Alan Eliasen’s comment containing an example of a ‘problem question’. I hope the hint that is now displayed will help commenters switch to my frame of mind.

You are right, there is another problem in that boxes were accepting a maximum of two characters, when sometimes three characters are required (i.e., minus sign and two digits). This should now be fixed.

Thanks for your patience and do please continue to report problems. I do want readers to comment.