[racket] Matching patterns of two function

From: Mohammad Mustaqeem (mustaqeem.cs at gmail.com)
Date: Fri Nov 30 03:23:55 EST 2012

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
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>

Posted on the users mailing list.