diff --git a/module/language/elisp/runtime/function-slot.scm b/module/language/elisp/runtime/function-slot.scm index 805f22a38..e2838b543 100644 --- a/module/language/elisp/runtime/function-slot.scm +++ b/module/language/elisp/runtime/function-slot.scm @@ -179,6 +179,8 @@ ((zero? i) tail) (else (iterate (prim 1- i) (prim cdr tail)))))))) +(built-in-func length (@ (guile) length)) + ; Building lists. diff --git a/test-suite/tests/elisp-compiler.test b/test-suite/tests/elisp-compiler.test index e8bb46c88..7b879996c 100644 --- a/test-suite/tests/elisp-compiler.test +++ b/test-suite/tests/elisp-compiler.test @@ -553,6 +553,11 @@ (equal (nthcdr 1 '(1 2 3)) '(2 3)) (equal (nthcdr 2 '(1 2 3)) '(3)))) + (pass-if "length" + (and (= (length '()) 0) + (= (length '(1 2 3 4 5)) 5) + (= (length '(1 2 (3 4 (5)) 6)) 4))) + (pass-if "cons, list and make-list" (and (equal (cons 1 2) '(1 . 2)) (equal (cons 1 '(2 3)) '(1 2 3)) (equal (cons 1 '()) '(1))