I have a problem in matching the patterns of two functions.<div>I want to match two function whether they are following the same pattern or not?</div><div>e.g.</div><div>The "sum" function that computes the sum of all the elements of the list and "length" function that computes the length of the list.</div>
<div>Here, we see that both the functions have same pattern.</div><div><br></div><div><div>(define (sum l)</div><div> (cond[(empty? l)0]</div><div> [else (+ (car l)(sum (cdr l)))]))</div><div><br></div><div>(define (length l)</div>
<div> (cond[(empty? l)0]</div><div> [else (+ 1(length (cdr l)))]))</div></div><div><br></div><div>How can we determine that both has same pattern or not?</div><div>I want to write a function that takes these functions as input and tells whether they have same pattern or not.</div>