[racket] Matching patterns of two function
I have a problem in matching the patterns of two functions.
I want to match two function whether they are following the same pattern or
not?
e.g.
The "sum" function that computes the sum of all the elements of the list
and "length" function that computes the length of the list.
Here, we see that both the functions have same pattern.
(define (sum l)
(cond[(empty? l)0]
[else (+ (car l)(sum (cdr l)))]))
(define (length l)
(cond[(empty? l)0]
[else (+ 1(length (cdr l)))]))
How can we determine that both has same pattern or not?
I want to write a function that takes these functions as input and tells
whether they have same pattern or not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121130/9bd0ed11/attachment.html>