diff --git a/sample.llm b/sample.llm index 1a460e7..8c72a49 100644 --- a/sample.llm +++ b/sample.llm @@ -1,19 +1,10 @@ + +(def cons (lm (a b) (lm (x) (if (eq x 0) a b)))) ;; ------------ Boolean Logic ---------------------------------- -(def and - (lm (a b) - (nand (nand a b) (nand a b)))) - -(def or - (lm (a b) - (nand (nand a a) (nand b b)))) - -(def not - (lm (a) - (nand a a))) - -(def nor - (lm (a b) - (not (or a b)))) +(def and (lm (a b) (nand (nand a b) (nand a b)))) +(def or (lm (a b) (nand (nand a a) (nand b b)))) +(def not (lm (a) (nand a a))) +(def nor (lm (a b) (not (or a b)))) ;; ------------ Boolean Logic ---------------------------------- @@ -25,8 +16,7 @@ (def eq (lm (a b) (and (not (lt a b)) (not (lt b a))))) ;; not equal: -(def neq (lm (a b) - (not (eq a b)))) +(def neq (lm (a b) (not (eq a b)))) ;; great equal: (def geq (lm (a b) (or (eq a b) (gt a b)))) @@ -64,13 +54,11 @@ ;; ------------ Open TODO's ---------------------------------- -(def dispatch (lm (a b which) - (if (eq which 0) a b))) +(def dispatch (lm (a b which) (if (eq which 0) a b))) ;; (def cons (lm (a b) ;; (lm (x) (dispatch a b x)))) -(def cons (lm (a b) - (lm (x) (if (eq x 0) a b)))) +(def cons (lm (a b) (lm (x) (if (eq x 0) a b)))) (def car (lm (cell) (cell 0))) (def cdr (lm (cell) (cell 1)))