# [plt-scheme] Check for function equality?

So your conjecture is
forall (x natural-number?) (equal? (g-fives-closed-test x) (g-
fives-closed x))
Look for the QuickCheck package on planet, require it, and translate
the above into a formal conjecture for QuickCheck.
Then try another conjecture for which you know it is false. See what
happens there.
Otherwise, do look at Matthew's reply
On Feb 19, 2009, at 4:43 PM, dave yrueta wrote:
>* Hi All --
*>*
*>* Is there a Scheme function similar to "check-expect" that tests for
*>* equality between functions?
*>*
*>* Example:
*>*
*>* ;23.3.2
*>* ;g-fives-closed : N -> number
*>* ;non-recursive version of g-fives
*>* ;(check-expect (g-fives-closed 3) 375)
*>* (define (g-fives-closed n)
*>* (* 3 (expt 5 n)))
*>*
*>* ;23.3.4
*>* ;geometric-series : number number -> (number -> number)
*>* ;consumes two numbers start and s, produces a function representing
*>* the geometric series whose starting point is start and whose factor is
*>* s
*>* (define (geometric-series start s)
*>* (local ((define (local-g-series n)
*>* (* start (expt s n))))
*>* local-g-series))
*>*
*>* (define g-fives-closed-test (geometric-series 3 5))
*>*
*>* ;test 1 = test passes
*>* (check-expect (g-fives-closed-test 3) (g-fives-closed 3))
*>*
*>* ;test 2 = test fails
*>* (check-expect g-fives-closed-test g-fives-closed)
*>*
*>* As far as I can tell, "g-fives-closed-test" and "g-fives-closed"
*>* differ in name only. I ran the same test with eq? and equal? and
*>* received the same results. Any way to test for this kind of equality?
*>*
*>* Thanks,
*>* Dave Yrueta
*>* _________________________________________________
*>* For list-related administrative tasks:
*>* http://list.cs.brown.edu/mailman/listinfo/plt-scheme
*