Commit f16ad0ef authored by Philipp Marek's avatar Philipp Marek

Added SUBSEQ* to ALEXANDRIA-2.

parent 521e9a0e
......@@ -8,5 +8,6 @@
#:delete-from-plist*
#:line-up-first
#:line-up-last
#:subseq*
. #. (let (res) (do-external-symbols (sym :alexandria.1.0.0) (push sym res)) res)
))
(in-package :alexandria-2)
(defun subseq* (sequence start &optional end)
"Like SUBSEQ, but limits END to the length."
(subseq sequence start
(if end
(min end (length sequence)))))
......@@ -124,3 +124,14 @@
t
t
t)
(deftest subseq*.1
(values (subseq* "abcdef" 0 3)
(subseq* "abcdef" 1 3)
(subseq* "abcdef" 1)
(subseq* "abcdef" 1 9))
"abc"
"bc"
"bcdef"
"bcdef")
......@@ -64,5 +64,6 @@ the following constraints:
:components ((:static-file "tests.lisp")
(:file "package")
(:file "control-flow" :depends-on ("package"))
(:file "sequences" :depends-on ("package"))
(:file "lists" :depends-on ("package")))))
:in-order-to ((test-op (test-op "alexandria-tests"))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment