Today I downloaded the "EasyPHP" -- a distrbution for Apach, MySQL, PHP. I installed it. However,
there are some problem. PHPMyAdmin can not be launched. I do not know what happen.
Today I read a article on Lua. The Lua is alike a parasite. In a sense, the design purpose of Lua
may be used to embed it into other developing language. About one year ago, I know some people have
embeded Lua into TeX. However, I known what is Lua language, in my viewpoint, it can like perl, python,
etc.
(define (counter n)
(letrec ((gen (lambda (yk)
(let loop ((x n))
(call/cc (lambda (bk)
(set! gen (lambda (k)
(set! yk k)
(bk x)))
(yk x)))
(loop (+ x 1))))))
(lambda () (call/cc (lambda (yield)
(gen yield))))))
(define nx (counter 5))
(nx) => 5
(nx) => 6
...
The above is a implementation in scheme. Its behaviour likes the following Python code.
def counter(i):
while true:
yield i
i = i + 1
c = counter(5)
c.next() => 5
c.next() => 6
...
Yes. It is so complicated for simulate the generator in Python. Its scheme implementation
is so alike the "amb" implementation. The "(amb)" is just a "c.next()". For separating a "next"
lambda express out, the code was adjusted.