【SICP练习】111 练习3.24

练习3-24原文

Exercise 3.24. In the table implementations above, the keys are tested for equality using equal? (called by assoc). This is not always the appropriate test. For instance, we might have a table with numeric keys in which we don’t need an exact match to the number we’re looking up, but only a number within some tolerance of it. Design a table constructor make-table that takes as an argument a same-key? procedure that will be used to test “equality” of keys. Make-table should return a dispatch procedure that can be used to access appropriate lookup and insert! procedures for a local table.

代码 key-1 key-2) key-1 (cdr local-table))))(if subtable key-2 (cdr subtable)))(if record))) subtable key-2 (cdr subtable))))(if record(set-cdr! record value)(set-cdr! subtablesubtable)))))(set-cdr! local-table(cons (list key-1(cons key-2 value))(cdr local-table)))))’ok) key key m)m ‘insert-proc!) insert!)m))))dispatch))

为使本文得到斧正和提问,,转载请注明出处:

邮箱及Skype:nomasp@outlook.com Facebook:https://www.facebook.com/yuwang.ke CSDN博客: 新浪微博:

怠惰是贫穷的制造厂。

【SICP练习】111 练习3.24

相关文章:

你感兴趣的文章:

标签云: