Ticket #14 (closed defect)

Opened 16 years ago

Last modified 16 years ago

eq/equal on multiple args

Reported by: dherman Owned by: dherman
Priority: major Milestone:
Component: dherman/memoize.plt Keywords:
Cc: Version:
Racket Version:


Danny Yoo wrote:

Hi Dave,

I've repaired memoize.ss so that if there are multiple arguments, and should be eq?, then the elements in the arg list are eq-compared. As a quick brush over it, I defined my own assoc/inner-eq and parameterized the four memoizing macros over their respective 'assocs'.

Here's a hastily-written test case:

  (define eq-vs-equal-tests
     "eq-vs-equal for multiple args"
      "simple test"
      (let ([f (memo-lambda (x y)
                            (+ (string-length x) (string-length y)))]
            [hello "hello"]
            [world "world"])
        (parameterize ([number-of-runs 0])
          (f (string-append "h" "ello")
             (string-append "w" "orld"))
          (f (string-append "he" "llo")
             (string-append "wo" "rld"))
          (with-assertion-info (['ran-twice "did not run exactly twice"])
                               (unless (= (number-of-runs) 2)
        (parameterize ([number-of-runs 0])
          (f hello world)
          (f hello world)
          (with-assertion-info (['ran-once "did not run exactly once"])
                               (unless (= (number-of-runs) 1)

My apologies for the test case messiness: I wanted to sleep. *grin*

Best of wishes!


memoize.ss Download (4.5 KB) - added by dherman 16 years ago.

Change History

Changed 16 years ago by dherman

Changed 16 years ago by dherman

  • status changed from new to closed

Fixed in 3:1. Thanks, Danny.

Note: See TracTickets for help on using tickets.