diff --git a/doc/Doc.md b/doc/Doc.md index 82892ae..7f19e1a 100644 --- a/doc/Doc.md +++ b/doc/Doc.md @@ -76,7 +76,7 @@ |`(find-val-in-list lst name)`|Returns tail od sublist which first element is name|`>>> (find-val-in-list '(("a" ("av" "avv")) ("b" "bv") (31 32 33) (41 42 43)) "b") => "bv" >>> `|List manipulation| |`(map ..)`|Returns list that is the result of executing lambda on its elements|`(map (lambda (x) (+ x 10)) '(1 2 3 4 5 6)) => (11 12 13 14 15 16)`|List manipulation| |`(filter lambda list)`|Returns list with elements for which passed lambda returns true|`(filter (lambda (x) (> x 2)) '(1 2 3 4 5)) => (3 4 5)`|List manipulation| -|`(reduce lambda acumulator list)`|Reduces list|`>>> (reduce (lambda (x y) (+ (* x 10) y)) 0 '(1 2 3 4)) => 1234`|List manipulation| +|`(reduce lambda acumulator list)`|Reduces list|`>>> (reduce (lambda (acc e) (+ (* acc 10) e)) 0 '(1 2 3 4)) => 1234`|List manipulation| |`(exit code)`|Exit the program with an integer code||System| |`(quit code)`|Same as (exit ..)||System| |`(print ..)`|Print one or several values separated by space and return the last one|`>>> (print "pi" "is" 3.14)\npi is 3.140000 => 3.140000`|IO| diff --git a/tests/test.lsp b/tests/test.lsp index 82f93ea..f54cd3e 100644 --- a/tests/test.lsp +++ b/tests/test.lsp @@ -47,6 +47,8 @@ (ut::define-test "result of (member '(1 2 3) 3)" '(ut::assert-true (member '(1 2 3) 3))) (ut::define-test "result of (member '(1 2 3) 4)" '(ut::assert-false (member '(1 2 3) 4))) +(ut::define-test "result of (reduce (lambda (acc e) (+ acc (string (+ \"