0001 嘿嘿

来源:互联网 发布:黑马程序员骗了我 编辑:程序博客网 时间:2024/04/29 15:31

-----

Planning a share portfolio

There is no shortage of tipsters around offering 'get-rich-quick' opportunities.

But if you are a serious private investor, leave the Las Vegas mentality to those with money to fritter.

-----

さまざまなぼうがいをおしきって、あくまでもちゅうにちゆうこうをしゅちょうしてきたにほんのかたがたのどりょくはおおいにしょうさんされるにあたいするものであります。

どうじょうにあたいする。

かれのこういはしょうさんにあたいする。

これはじゅうぶんけんきゅうにあたいする。

----- LISP from M.Hiroi's Home Page

今天要睡觉了...本来想抄探索的部分加深印象的...没时间了。

那就回忆个宏的例子来加深之前的印象。

用宏来定义 scheme 里面的 define 函数。

第一种写法对多个执行语句不适用的样子。

(defmacro define (args body)`(defun ,(car args) ,(cdr args) ,body)) 

=> (define (aaa) (print 1) (print 2)) 不过

=> (define (fact n) (if (= n 1) 1 (* n (fact (- n 1))))) 过

(defmacro define2 (args &rest body)`(defun ,(car args) ,(cdr args) ,@body))

=> (define2 (aaa) (print 1) (print 2)) 过

=> (define2 (fact n) (if (= n 1) 1 (* n (fact (- n 1))))) 过


0 0
原创粉丝点击