Lambda the Ultimate

inactiveTopic A Clockwork Orange: Nadsat
started 12/6/2003; 2:15:51 PM - last post 12/12/2003; 2:02:02 PM
Ehud Lamm - A Clockwork Orange: Nadsat  blueArrow
12/6/2003; 2:15:51 PM (reads: 9746, responses: 28)
A Clockwork Orange: Nadsat
Readers of this blog know that I try to relate programming languages and natural languages, tenuous as these comparisons sometimes are.

I've been reading the excellent introduction written by Blake Morrison to Anthony Burgess's A Clockwork Orange (Penguin Classics edition) in which he discusses Burgess's fictional language Nadsat at some length, and decided that this discussion is somewhat relevant to our discussion of scripting using domain-specific objects (i.e., domain specific vocabulary). And even if not, invented languages are something worth mentioning on LtU from time to time.

As far as I can tell Nadsat is mainly about vocabulary. Burgess used words inspired by German, Russian, and Cockney Slang, while also coining a few original words. You can find a Nadsat dictionary here.

Interestingly enough one can read the novel without a Nadsat dictionary, since the meaning of most words can be understood from context. However, reading the novel can be a bit of a challenge because of the unfamiliar voacabulary - a challenge Burgess obviously knew about, but may still offer a lesson or two about domain specific concepts and abstractions inside computer programs.

There's quite a lot more to say about Nadsat (see here and here) but I'll resist the temptation for the moment. Let me leave you with this insightful explanation of Nadsat from Burgess:

The Vocabulary of my space-age hooligans could be a mixture of Russian and demotic English, seasoned with rhyming slang and the gypsy's bolo. The Russian suffix for -teen was nadsat, and that would be the name of the teenage dialect, spoken by drugi or droogs or friends of violence.


Posted to DSL by Ehud Lamm on 12/6/03; 2:18:35 PM

Andris Birkmanis - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 6:20:51 AM (reads: 825, responses: 17)
Probably an excelent example when more knowledge means less satisfaction. For many people having Russian as a mother language (me including) A Clockwork Orange is more silly, than eye-opening. Can we map this phenomenon to programming languages? Does Haskell appear as beautiful to Categories Theoritician as to an average LtU reader?

Another remotely related irritation rises in me, when I watch/read movies/books that try to represent "hackers" and their culture to wide masses... Should better finish my post now :-)

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 6:23:13 AM (reads: 831, responses: 3)
Interesting. Anyone else had the same experience?

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 6:50:05 AM (reads: 831, responses: 12)
For many people having Russian as a mother language (me including) A Clockwork Orange is more silly, than eye-opening.

I'm not sure why this would be a problem. If you read the book carefully, it is explained how Russian words ended up in teenage slang.

As a bit of a cold-war joke, it is explained that teenagers have been exposed to subliminal Soviet propaganda and have unwittingly incorporated some of the words from it into their vocabulary.

My own theory (with a gratuitous connection back to PLs ;-)) is that Burgess, a dedicated polyglot, just wanted an excuse to incorporate a language he was interested in at the time into his work, sort of like a Lisper who insists upon seeing Lisp in every other language (or large program) he comes across. ;-)

Andris Birkmanis - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 7:01:30 AM (reads: 833, responses: 11)
The Tenth Rule of Burgess? :-)

For me, the problem was subconcious, I just could not enjoy the book in the same way I would if I did not know the words.

By the way, if we are on the natural cultures track, I always wondered, what would be computers like if they were initially developed by Eastern culture (think China or Japan, not Russia ;-) ).

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 7:20:26 AM (reads: 838, responses: 0)
I guess Top-Down Programming would have meant something quite different then...

andrew cooke - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 7:51:17 AM (reads: 828, responses: 2)
Anyone else had the same experience?

Silly slogans in English on Japanese products.

You're (at least) bilingual - haven't you noticed this kind of thing? Here (S America) English is "cool", so shops/products have pseudo-English names that just don't "sound right".

andrew cooke - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 7:53:46 AM (reads: 831, responses: 0)
Weren't early Soviet computers base 3? (I know that's not Oriental, but it always struck me as nice that you could have "don't know" along with True and False (I have no idea if they had gates that supported that kind of logic)).

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 7:57:38 AM (reads: 832, responses: 1)
I was asking about A Clockwork Orange.

But you are right: mixing languages often produces strange results.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 8:37:47 AM (reads: 824, responses: 7)
think China...

Well Perlis's money was on APL-like languages.

andrew cooke - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 9:11:00 AM (reads: 837, responses: 0)
You might be interested in this discussion, as it develops. The user "languagehat" is a linguist, I think.

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 12:32:49 PM (reads: 802, responses: 0)
I just could not enjoy the book in the same way I would if I did not know the words.

When I read the book, I had already seen the movie, but by a strange coincidence, I got it out from the library at the same time as a Teach Yourself Russian book.

A short way in, I noticed the correspondence for some common words (drug in particular) and figured out what Burgess had done.

This actually added to my enjoyment of the book, since I got the pleasure of solving the puzzle at the same time. ;-)

I always wondered, what would be computers like if they were initially developed by Eastern culture

I find this somewhat strange. What if we ask instead what, say, chopsticks would be like if they had been invented by a Western culture? Or the abacus? Or noodles?

There are two odd premises behind these questions: - that any technology necessarily expresses something unique about its native culture - that a technology could somehow be completely different than it is and still be itself

I guess I'm not convinced either of these things are really true.

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 12:44:52 PM (reads: 803, responses: 6)
Well Perlis's money was on APL-like languages.

Whether Perlis was being serious or (as I think more likely) having a joke at APLs expense, there is an unspoken assumption that Chinese culture (and especially its writing system) is particularly arcane and convoluted.

As a Westerner who spent a couple years learning Mandarin, I can vouch that it is a least as coherent a system as English spelling. (Some of our non-native English speaking colleagues may think even more so ;-))

Would C really be a different language if int or char were written with a hanzi?

Thinking that APL should seem more natural to the Chinese is a bit like thinking that Perl should be more natural to a reader of Hebrew because the latter is used to implicit vowels, and so should be used to implicit variables.

(Besides, we all know that Hebrew-readers prefer Ada ;-) )

Peter Van Roy - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 12:50:49 PM (reads: 774, responses: 2)
I find that one of the crucial differences between programming languages and natural languages is redundancy (giving the same information in two or more different ways). A (spoken) natural language is redundant so that it can be understood even if there is a lot of "noise" on the "channel" from speaker to listener. A programming language uses a little redundancy for 'sanity checks' (e.g., declared variable names must match used variable names), but in general, redundancy is frowned upon because it makes development and maintenance harder (and it makes programs more verbose).

Maybe a written natural language could have less redundancy, more like a programming language, but since the written language is so closely tied to its spoken counterpart, this does not seem to happen.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 1:32:56 PM (reads: 811, responses: 5)
I think you are being unfair to APL. The way I read Perlis's epigram was that Chinese writing represents complicated ideas using (to simplify) one symbol, in the same way APL does. This is, of course, not exactly what happens in either, but gives a sense of what ideograms might mean from a programming languages perspective.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 1:34:36 PM (reads: 770, responses: 0)
That's an interesting angle. Maybe more redundancy could actually help maintenance, provided we have tools to ensure consistency?

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 1:50:11 PM (reads: 771, responses: 0)
I find that one of the crucial differences between programming languages and natural languages is redundancy

Do you have some examples of this phenomenon? I've heard this claim before, but my own study of both types of language doesn't really bear this out consistently.

The only sure distinction I have found between the two (though a pretty major one) is that a PL must be interpretable by both people and machines, whereas a human language is currently only interpretable (in any full sense) by humans.

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:07:59 PM (reads: 816, responses: 4)
This is, of course, not exactly what happens in either, but gives a sense of what ideograms might mean from a programming languages perspective.

I think there is more being made of the difference between the writing systems than is warranted.

If you want to get a sense of what a non-alphabetic writing system would be like for PLs, just take your favorite PL (doesn't matter which) and replace it's ascii encoded lexical items with symbols that have some mnemonic value.

Other than the rules for building lexical symbols, the syntax and semantics would be identical, i.e. once the lexer had run on the source, it would be identical to what you would have at that stage of the original PLs interpretation.

As tempting as it is to think that a different writing system would produce a completely different PL, I don't think it is likely to be so.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:15:09 PM (reads: 822, responses: 3)
Yeah, right. But notation is a tool of thought, you know.

Peter Van Roy - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:20:46 PM (reads: 756, responses: 1)
Do you have some examples of this phenomenon? I've heard this claim before, but my own study of both types of language doesn't really bear this out consistently.

The examples I am thinking of are understanding a speaker over a noisy telephone line (spoken), removing the vowels in a sentence (written), or using a simplified notation for sounds in spelling reform (written). These are at a fine grain. At the level of grammar and sentence structures, there are examples where parts of speech or conjugations are left out without destroying meaning. Some of this is explained in 'The Cambridge Encyclopedia of the English Language' by David Crystal (an excellent book by the way). I don't know about examples at a higher level.

For programming languages, changing even a single character usually changes the meaning drastically. The effect depends on the language. Older languages (like Fortran) tend to be more fragile than newer ones (although explicitly reducing fragility has never been an explicit design goal as far as I know). By "fragility" I mean that a simple change results in a legal program with different behavior. There's a famous error discovered at Nasa that involved changing a single comma to a period in a Fortran program. This particular error was discovered in time, but other similar ones were not.

Peter Van Roy - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:27:55 PM (reads: 757, responses: 1)
That's an interesting angle. Maybe more redundancy could actually help maintenance, provided we have tools to ensure consistency?

An interesting idea! We already have enforced redundancy (like variable declarations and types) such that certain classes of simple errors give illegal programs. Do you have any examples of how more redundancy could be used?

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:33:48 PM (reads: 829, responses: 2)
But notation is a tool of thought, you know.

Sure. But what makes a good notation? Is a good notation a purely subjective "human factor" based on what is familiar (e.g. the writing system you know best)?

Or might there be objective mnemonic criteria that are universal?

I suspect that both are true to some extent.

Sure the Chinese may be at a disadvantage having to programming in ASCII-encoded Roman letters (this may be a sub-optimal notation for them), but once they are past that hurdle, I can't see that they will have any easier time learning APL than Fortran.

Both PLs have their own style of computation that is independent of their encoding, and neither is really like ANY human language.

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/7/2003; 2:45:46 PM (reads: 761, responses: 0)
The examples I am thinking of are understanding a speaker over a noisy telephone line (spoken) <snip> For programming languages, changing even a single character usually changes the meaning drastically.

I would argue that these are not examples of either redundancy or explicit features of the languages per se, but rather the difference between human and machine interpretation.

If I give you a transcription of a single misheard word, say "bwabwa", you will have no idea what it means.

On the other hand if I transcribe the partially misheard sentence: "My bwabwa is nagging me to give her grandchildren", you have a pretty good guess that "bwabwa" is really "mother" misheard.

How do you know this? There is no redundancy in "bwabwa" or the sentence to help you, but rather you understand the social context of my meaning and can interpolate the missing word.

Computers on the other hand are dumb and literal, so if there is an unknown or incorrect symbol in the message, they have no way to realize that I meant something else. (pace the DWIM advocates ;-) )

Dan Shappir - Re: A Clockwork Orange: Nadsat  blueArrow
12/8/2003; 12:30:28 AM (reads: 690, responses: 0)
Some thoughts:

Marc: Computers on the other hand are dumb and literal, so if there is an unknown or incorrect symbol in the message, they have no way to realize that I meant something else.

I always find it a bit amusing that a C/C++/Pascal compiler is smart enough to tell me I've forgotten to put a in semicolon, but is not smart enough to put it in for me. Obviously I understand why it may not be a good idea for the compiler to automatically modify my code, but still ...

Ehud: That's an interesting angle. Maybe more redundancy could actually help maintenance, provided we have tools to ensure consistency?

I'm currently playing with IntelliJ IDEA, testing it as an alternative to the Java IDE we currently use, and two of its features came to mind when I read this:

  • Its refactoring capabilities which attempt to automatically keep variable names in synch for declaration and use.
  • Its templates feature which takes abbreviations and expands them into code fragments. An example of adding redundancy in order to improve readability. What I mean is that this expansion could have been done invisible at compile time.

Besides, we all know that Hebrew-readers prefer Ada ;-)

Hardly (ask Ehud's students ;-). I seem to recall that there was once an attempt to create a Hebrew PL, based on LOGO if I recall correctly. Went nowhere in any event.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/8/2003; 2:42:42 AM (reads: 681, responses: 0)
Do you have any examples of how more redundancy could be used?

Some examples from Ada's handling of inheritance come to mind:

  • Whenever a type should be exentdable via inheritance it must be declared with the syntax "type X is tagged...", this applies to the parent as well as to any descendant.
  • Whenever a type is abstract you have to say so explicitly in the declaration "type X is abstract tagged", this too applies to derived types. Thus if you will now write "type Y is new X.." and will not implement all the abstract methods, a message should appear saying "type Y must be declared abstract or m1,m2.. overriden"
  • When a type is derived in the visible part of a package, and later implemented in the private part, you must specify the parent type in both placed: "type Y is new X with private" and later "type Y is new X with record..."

There are, of course, more examples of this kind of syntactic redundancy.

Another kind of redundancy is, of course, contracts (a declarative expression of the behaviour of the code) and types.

Ehud Lamm - Re: A Clockwork Orange: Nadsat  blueArrow
12/8/2003; 7:51:41 AM (reads: 722, responses: 1)
Marc, he was just makin an analogy, man. Don't fo reading to much into it...

Is a good notation a purely subjective "human factor"

Yeah.

based on what is familiar (e.g. the writing system you know best)?

I am not sure this is the only factor.

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/8/2003; 10:07:15 AM (reads: 708, responses: 0)
Marc, he was just makin an analogy, man. Don't fo reading to much into it...

When did the motto around here become: "Let fuzzy analogies slip by"?

;-)

Frank Atanassow - Re: A Clockwork Orange: Nadsat  blueArrow
12/12/2003; 11:19:52 AM (reads: 533, responses: 1)
If I give you a transcription of a single misheard word, say "bwabwa", you will have no idea what it means.

On the other hand if I transcribe the partially misheard sentence: "My bwabwa is nagging me to give her grandchildren", you have a pretty good guess that "bwabwa" is really "mother" misheard.

How do you know this? There is no redundancy in "bwabwa" or the sentence to help you, but rather you understand the social context of my meaning and can interpolate the missing word.

If I give you a misspelled identifier, say "bwabwa", you will have no idea what it means.

OTOH, if you know that "2 : int" and "(+) : int * int -> int" and I give you the program phrase "2 + bwabwa", then you have a pretty good guess that "bwabwa" is an integer.

How do you know this? There is no redundancy in "bwabwa" or the sentence to help you, but rather you use the free variable context and can infer the type of "bwabwa".

Marc Hamann - Re: A Clockwork Orange: Nadsat  blueArrow
12/12/2003; 2:02:02 PM (reads: 537, responses: 0)
OTOH, if you know that "2 : int" and "(+) : int * int -> int" and I give you the program phrase "2 + bwabwa", then you have a pretty good guess that "bwabwa" is an integer.

So this is a potential support for my contention that human language do not necessarily have more redundancy than PLs.

The equivalent property in NLs would be that you could identify that "bwabwa" is a noun, but the explicit redundancy is absent, making typed PLs "more redundant" in this instance than NLs.