archives

the Chinese natual language

Years ago, I once felt that there are some commonness between Chinese and Lisp. They both lack syntax, but expressing the same idea will need less words/time/space than other languages. What's more, they are both old languages but still used today.

Today, I just read an article (in Chinese) saying that "Thinking in Chinese is faster than that in English". The main argument is that Chinese has more voices than English. Chinese has 21 consonants, 35 vowels and 4 scales/tunes (音调, 四声 in Chinese but no counterpoint in English), so there can be totally 2900 voices, although only 1200 in use. English only has 20 consonants and 20 vowels, so there are only 400 voices at most (not to mention some unused voices). The time needed to think/pronounce one voice is relatively constant, which means that thinking in Chinese other than in English is somewhat like using a 64bit CPU other than a 32bit one. The author also mentions the example of 'pork,mutton,beef, and donkey meat' and the corresponding words in Chinese.

Since I have read several posters here about natual language, I post it here for more discussion.

Coroutines in Lua

Link: The Lua folks discuss their implementation of coroutines, using Create, Resume and Yield methods.

Lua implements the concept of asymmetric coroutines, which are commonly denoted as semi-symmetric or semi-coroutines. Asymmetric coroutine facilities are so called because they involve two types of control transfer operations: one for (re)invoking a coroutine and one for suspending it, the latter returning control to the coroutine invoker. An asymmetric coroutine can be regarded as subordinate to its caller, the relationship between them being similar to that between a called and a calling routine.


Lua coroutine facilities provide three basic operations: create, resume and yield... Function coroutine.create creates a new coroutine, and allocates a separate stack for its execution... Function coroutine.resume (re)activates a coroutine, and receives as its required first argument the coroutine reference... A coroutine suspends by calling function coroutine.yield in this case, the coroutine’s execution state is saved and the corresponding call to coroutine.resume returns immediately.

The main difference with typical thread implementations is that (a). the caller is suspended until completion and (b). a coroutine can return values like a function call. I suppose I'd summarize it as functions that retain state between calls.

reading SICP for fun and profit

Adrian Colyer, the lead of the AspectJ project, discusses the beauty of Lisp and SICP in his latest blog post.

So at the end of the day, this is the thing that really impresses me about Lisp (and about the approach to teaching programming taken in the book). The language is so simple, and yet constructed in such an elegant way that it just doesn't get in your way - whatever abstraction you need to build, Lisp lets you do it in a very direct manner. Java just feels plain clunky when you put it alongside :- lacking in power, ease of expression, and beauty.

Alice Through the Looking Glass

Link: Alice is an extension to ML to support Open Programming, described as ML meets Oz. Alice Version 1.0 has been released.

Alice [is] a conservative extension of Standard ML. It adds only few simple, orthogonal high-level concepts that together form a coherent framework supporting all aspects of typed open programming.... Our understanding of open programming includes the following main characteristics:

  • Modularity, to flexibly combine software blocks that were created separately.
  • Dynamicity, to import and export software blocks in running programs.
  • Safety, to safely deal with unknown or untrusted software blocks.
  • Distribution, to communicate data and software blocks over networks.
  • Concurrency, to deal with asynchronous events and non-sequential tasks.

(via Chris Double)

(also Previous discussion on LtU)