From de3a062bfc206bf0373f96f4f6cc8c74ffcbab48 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 25 Aug 2024 17:33:40 +0300 Subject: lambda tested and if added --- files/test-cons.l | 17 +++++++++++++++++ files/test-lambda.l | 23 +++++++++++++++++++++++ files/test.l | 5 ----- files/test1.l | 16 ---------------- 4 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 files/test-cons.l create mode 100644 files/test-lambda.l delete mode 100644 files/test.l delete mode 100644 files/test1.l (limited to 'files') diff --git a/files/test-cons.l b/files/test-cons.l new file mode 100644 index 0000000..7a4de7d --- /dev/null +++ b/files/test-cons.l @@ -0,0 +1,17 @@ +(define a 3) +'(sn ,(+ a 1)) + +'(1 2 (lol . test) 3 4 ,(+ 1 2) test) +(cons 1 (cons 2 (cons 3 ()))) +(car '(1 2 3)) +'(1 2 3) +(+ 1 2) +(car (cdr (cdr (cdr '(1 2 3 (4 5) (6 . 7) ,(+ 1 2)))))) +'(1 . 2) +(+ 1 2) +'(1 2 3 4) +'(1 . (2 . 3)) +'(3 . 2) +'(1 2 3) +'(test . (,(+ 1 2) . 5)) + diff --git a/files/test-lambda.l b/files/test-lambda.l new file mode 100644 index 0000000..e088ad6 --- /dev/null +++ b/files/test-lambda.l @@ -0,0 +1,23 @@ +(define make-add (lambda (a) (lambda (b) (+ a b)))) +(define add4 (make-add 4)) +(add4 5) + +'(a b ,((lambda (a) '(test . ,a)) 69) c d) + +(define fib (lambda (c) (fib-rec 0 1 0 c))) +(define fib-rec (lambda (a b n c) + (if (= n c) + b + (fib-rec b (+ a b) (+ n 1) c)))) + +(define do (lambda (c f) (do-rec f 0 0 c))) + +(define do-rec (lambda (f r n c) + (if (= n c) r + (do-rec f (f n) (+ n 1) c)))) + +;; comment +;; another comment +;; fib(13) +(do 10 (lambda (n) (display (fib n)))) ; comment + diff --git a/files/test.l b/files/test.l deleted file mode 100644 index d9e9acc..0000000 --- a/files/test.l +++ /dev/null @@ -1,5 +0,0 @@ -(define make-add (lambda (a) (lambda (b) (+ a b)))) -(define add4 (make-add 4)) -(add4 5) - -'(a b ,((lambda (a) '(test . ,a)) 69) c d) diff --git a/files/test1.l b/files/test1.l deleted file mode 100644 index b7e4749..0000000 --- a/files/test1.l +++ /dev/null @@ -1,16 +0,0 @@ -'(sn ,(+ a 1)) - -'(1 2 (lol . test) 3 4 ,(+ 1 2) test) -(cons 1 (cons 2 (cons 3 ()))) -(car '(1 2 3)) -'(1 2 3) -(+ 1 2) -(car (cdr (cdr (cdr '(1 2 3 (4 5) (6 . 7) ,(+ 1 2)))))) -'(1 . 2) -(+ 1 2) -'(1 2 3 4) -'(1 . (2 . 3)) -'(3 . 2) -'(1 2 3) -'(test . (,(+ 1 2) . 5)) - -- cgit v1.2.3