我想了解sicp中的模式匹配。 https://www.youtube.com/watch?v=amf5lTZ0UTc&list=PL8FE88AA54363BC46&index=7模式匹配 - 执行?,?c,?v
他在模式规则中创建了这3个过程,但没有实现。
对这些有什么意义吗?
模式匹配 - ???实施的C,V
https://github.com/f03lipe/sicp-code/blob/master/code/4A.scm
foo - matches exactly foo
(f a b) - matches list in which first element if f, second is a, third is b
(? x) - matches anything, call it x
(?c x) - matches constant, call it x
(?v x) - matches variable, call it x
(define deriv-rules
'(
((dd (?c c) (? v)) 0)
((dd (?v v) (? v)) 1)
((dd (?v u) (? v)) 0)
或者没有实现,因为在所有这些都只是正在评估的规则?
我如何理解匹配foo和(f a b)意味着什么? – runners3431 2014-12-08 23:10:59
当教授说foo与foo匹配时 - 他的意思是说像*或+这样的东西究竟意味着什么? – runners3431 2014-12-18 03:24:12