April 4th Wednesday (四月 四日 水曜日)

  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. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值