June 11th Monday (六月 十一日 月曜日)
2007-07-14 11:21
447 查看
(rule (append-to-form () ?y ?y))
(rule (append-to-form (?u . ?v) ?y (?u . ?z))
(append-to-form ?v ?y ?z))
;;; Query input:
(append-to-form (a b) (c d) ?z)
;;; Query results:
(append-to-form (a b) (c d) (a b c d))
This rule had puzzled me. Now I known what happen? Firstly, (append-to-form ?a ?b ?c) means
the result ?c is ?a + ?b. (rule (append-to-form () ?y ?y)) is easy to understand. A empty list
is appended to a list. Let's look at the second sub rule.
(rule (append-to-form (?u . ?v) ?y (?u . ?z))
(append-to-form ?v ?y ?z))
A list can be considered as the 'car' and 'cdr' parts. So, the (?u . ?v) represented that two
parts in a list. The '?u' is the 'car' part and the '?z' is the rest of a new list appended. How
to get the '?z'? Append the 'cdr' part of the first list and a list -- ?y.
It is so easy and intuitive.
(rule (append-to-form (?u . ?v) ?y (?u . ?z))
(append-to-form ?v ?y ?z))
;;; Query input:
(append-to-form (a b) (c d) ?z)
;;; Query results:
(append-to-form (a b) (c d) (a b c d))
This rule had puzzled me. Now I known what happen? Firstly, (append-to-form ?a ?b ?c) means
the result ?c is ?a + ?b. (rule (append-to-form () ?y ?y)) is easy to understand. A empty list
is appended to a list. Let's look at the second sub rule.
(rule (append-to-form (?u . ?v) ?y (?u . ?z))
(append-to-form ?v ?y ?z))
A list can be considered as the 'car' and 'cdr' parts. So, the (?u . ?v) represented that two
parts in a list. The '?u' is the 'car' part and the '?z' is the rest of a new list appended. How
to get the '?z'? Append the 'cdr' part of the first list and a list -- ?y.
It is so easy and intuitive.
相关文章推荐
- June 25th Monday (六月 二十五日 月曜日)
- June 1st Monday (六月 一日 月曜日)
- June 22th Monday (六月 二十二日 月曜日)
- May 11th Monday (五月 十一日 月曜日)
- June 11th Thursday (六月 十一日 木曜日)
- June 15th Monday (六月 十五日 月曜日)
- 2008 August 11th Monday (八月 十一日 月曜日)
- June 8th Monday (六月 八日 月曜日)
- June 29th Monday (六月 二十九日 月曜日)
- June 4th Monday (六月 四日 日曜日)
- July 13th Monday (七月 十一日 月曜日)
- June 11th 模拟赛B T2 翻山越岭 Solution
- Februray 26th Monday (一月 二十六日 月曜日)
- Aprial 11th Wednesday (四月 十一日 水曜日)
- May 14th Monday (五月 十四日 月曜日)
- June 12th Tuesday (六月 十二日 火曜日)
- July 16th Monday (七月 十六日 月曜日)
- 2008 January 14th Monday (一月 十四日 月曜日)
- 2008 March 24th Monday (三月 二十四日 月曜日)
- 2008 July 14th Monday (七月 十四日 月曜日)