Lisp-no-yama
programming as self-expression
meetings blogs news home
<< Secret Alien Technology FTW! | Home | (((earthquake!))) >>

What if Lisp was invented by the Japanese?

It's fun to speculate the cultural influence on a programming language design.  One of the notable characteristics of Japanese language is that a verb always comes at the end of a sentence.  For example, when you say "I ate an apple" we actually say in Japanese "I apple ate." I heard a couple of times people complaining about Japanese grammar forcing you to think everything in a reversed way, but hey, to Japanese speakers like me, it's English that have got everything upside down! From a programmer's point of view, though, this must be a tricky situation for our brain. Because we don't know how many / what kind of arguments a verb will take until reaching the end of a sentence, doesn't this cause a stack overflow on Japanese speakers? (To be fair, it's relatively easy to construct such a sentence in English too, see Garden path sentence)

Anyhow, let's talk about Lisp. What if it was invented by the Japanese? I imagine it would look like this:

 (((4 5 +) 3 *) print)
 ((((make-hash-table) table)) let ((table "one" gethash) 1 setf) table)

Oh no! This seems a major screwup. But wait, doesn't this look familiar?  It's a Forth with parentheses! Years ago, I've seen someone actually arguing that Forth is a great language for Japanese people to learn because of its grammatical acquaintance. Of course, it is ridiculous to think of programming languages with its syntactic feature only. But since computer languages are becoming almost a second nature to us, I guess a language syntax can make a profound (yet unmeasurable) impact on our thought pattern.  Ruby is notably invented by Japanese people and it still has a strong community in Japan, but in this respect it doesn't seem very Japanese to me.  Since most other notable languages are developed by English speakers (C, Java, Perl, ...except Python), I can't go on with this thinking any longer.

Tags : ,


Re: What if Lisp was invented by the Japanese?

Begin not however English sentences with a verb, love anyway Kenny Lisp. 

Re: What if Lisp was invented by the Japanese?

So Lisp was invented by Yoda?

Re: What if Lisp was invented by the Japanese?

 Actually I think Yoda speaks Japanese but with English words.

?????????????????????

(sorry for the awful Japanese attempt, I'm not even a begginer yet).

Re: What if Lisp was invented by the Japanese?

you can omit the parentheses with that syntax :) 

Re: What if Lisp was invented by the Japanese?

Not with optional args (same reason as in regular Lisp).

Re: What if Lisp was invented by the Japanese?

In RPN, you can omit the parens even with optional arguments; all that needs to happen is that the procedures consume and produce the appropriate number of symbols from the stack.

Parens merely help enable code validation; they're not required for your code to work.

Re: What if Lisp was invented by the Japanese?

Almost all languages of India are based on Sanskrit, which has a similar structure, with the verb coming at end of the sentence.

Please take a look at the following article --

Knowledge Representation in Sanskrit and Artificial Intelligence | Briggs | AI Magazine

 

Re: What if Lisp was invented by the Japanese?

Actually, about 46% of the world's languages are Subject-Object-Verb.  It's the most common configuration for the world's languages, followed by Subject-Verb-Object (like English and Chinese) at about 44%.

I read somewhere (I can't remember where) that Verb-Subject-Object languages are in some way better (or more convenient?) from a logical perspective (and thus, I imagine, for machine languages).  It's too bad I can't remember where I read that (it may not have been online).

Re: What if Lisp was invented by the Japanese?

So we have assembly in Verb-Subject-Object pattern isn't it?

I personally only fluent in languages that are Subject-Verb-Object (well, Chinese and English) and also know some Japanese (which is argueablly, not all the time Subject-Object-Verb) and found that not as hard to grasp once you have heard enough in the other pattern.

Re: What if Lisp was invented by the Japanese?

From a programming perspective this is just switching to postfix. Postfix is brilliant at cleanly expressing an algorithin and is very easy to parse and process. It also removes any requirment for parentheses.

(((4 5 +) 3 *) print)

becomes:

45+ 3* print

The original infix version of this would be:

print ( ( 4+5 ) *3 )

As pointed out by previous commenter postfix was the syntax used by Forth although what really distinguished Forth was that it was primarily a stack machine and a threaded interpreter (whole other topics). Using a stack machine to proces postfix expressions is simple and efficent.

 


Add a comment Send a TrackBack