The bug is found out. But there is another phenonmenon can not be explaint well. We have not the reality environment, so we can
not know what happen.
There is an interesting scheme program.
(define-syntax p.car
(identifier-syntax
(_ (car p))
((set! _ e) (set-car! p e))))
(define p (cons 4 5))
(set! p.car 15)
p.car => 15
p => (15 5)
There is a prolog program.
parent(bob,mary).
parent(jane,mary).
parent(mary,peter).
parent(paul,peter).
parent(peter,john).
anc(X,Y):-
parent(X,Y).
%anc(X,Z):-
%parent(X,Y),
%anc(Y,Z).
anc --> parent, anc. % --> is alike the "p1 . p1" in scheme.
not know what happen.
There is an interesting scheme program.
(define-syntax p.car
(identifier-syntax
(_ (car p))
((set! _ e) (set-car! p e))))
(define p (cons 4 5))
(set! p.car 15)
p.car => 15
p => (15 5)
There is a prolog program.
parent(bob,mary).
parent(jane,mary).
parent(mary,peter).
parent(paul,peter).
parent(peter,john).
anc(X,Y):-
parent(X,Y).
%anc(X,Z):-
%parent(X,Y),
%anc(Y,Z).
anc --> parent, anc. % --> is alike the "p1 . p1" in scheme.
本文探讨了Scheme语言中一个有趣的语法程序,并展示了如何通过特定的语法定义改变数据结构的表现形式。此外,还介绍了一个Prolog程序,用于展示家族成员间的关系及祖先查询的基本逻辑。
1335

被折叠的 条评论
为什么被折叠?



