added gcd,lcm to library
[lambda.git] / lambda_library.mdwn
index 5623b9f..bdd0168 100644 (file)
@@ -236,6 +236,11 @@ and all sorts of other places. Others of them are our own handiwork.
        let Theta = (\u f. f (u u f)) (\u f. f (u u f))  in
 
 
+       ; now you can search for primes, do encryption :-)
+       let gcd = Y (\gcd m n. iszero n m (gcd n (mod m n))) in
+       let lcm = \m n. or (iszero m) (iszero n) 0 (mul (div m (gcd m n)) n) in
+
+
        ; length for version 1 lists
        let length = Y (\self lst. isempty lst 0 (succ (self (tail lst))))  in
 
@@ -314,7 +319,7 @@ let list_equal =
                 ; (might_for_all_i_know_still_be_equal?, tail_of_reversed_right)
                 ; when left is empty, the lists are equal if right is empty
                 (make_pair
-                    (not (isempty right))
+                    true ; for all we know so far, they might still be equal
                     (reverse right)
                 )
                 ; when fold is finished, check sofar-pair