X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment3.mdwn;h=8c22dfa4cead672756b7582b230aa570a92e6858;hp=c4d999275defbca34ccbaaa9c397ca7186491b5e;hb=0a3e9b7715490e9edefb87397cad3210e790053f;hpb=b4cb2d9a1499f826d58d8fb3b7265a5eec4eb46f diff --git a/assignment3.mdwn b/assignment3.mdwn index c4d99927..8c22dfa4 100644 --- a/assignment3.mdwn +++ b/assignment3.mdwn @@ -51,15 +51,14 @@ Then `length mylist` evaluates to 3. function, write a function that computes factorials. (Recall that n!, the factorial of n, is n times the factorial of n-1.) -Warning: it takes a long time for my browser to compute factorials larger than 4! + Warning: it takes a long time for my browser to compute factorials larger than 4! 3. (Easy) Write a function `equal_length` that returns true just in case two lists have the same length. That is, - equal_length mylist (make_list junk (make_list junk (make_list junk empty))) - ~~> true + equal_length mylist (make_list junk (make_list junk (make_list junk empty))) ~~> true - equal_length mylist (make_list junk (make_list junk empty))) ~~> false + equal_length mylist (make_list junk (make_list junk empty))) ~~> false 4. (Still easy) Now write the same function, but don't use the length @@ -109,7 +108,8 @@ whether the length of the list is less than or equal to 1. This will be your base case for your recursive functions that operate on these trees. -1. Write a function that sums the number of leaves in a tree. +
    +
  1. Write a function that sums the number of leaves in a tree. Expected behavior: @@ -132,5 +132,7 @@ Expected behavior: sum-leaves tc ~~> 6 -2. Write a function that counts the number of leaves. +
  2. Write a function that counts the number of leaves. + +