Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
alexandria
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Fedorov
alexandria
Commits
549dd8e1
Commit
549dd8e1
authored
8 years ago
by
Jan Moringen
Browse files
Options
Downloads
Patches
Plain Diff
make STARTS-WITH-SUBSEQ not cons unnecessarily
parent
5a17c072
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sequences.lisp
+10
-4
10 additions, 4 deletions
sequences.lisp
with
10 additions
and
4 deletions
sequences.lisp
+
10
−
4
View file @
549dd8e1
...
...
@@ -280,16 +280,22 @@ sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE."
:datum
sequence
:expected-type
'
(
and
proper-sequence
(
not
(
satisfies
emptyp
))))))))
(
defun
starts-with-subseq
(
prefix
sequence
&rest
args
&key
(
return-suffix
nil
)
&allow-other-keys
)
(
defun
starts-with-subseq
(
prefix
sequence
&rest
args
&key
(
return-suffix
nil
return-suffix-supplied-p
)
&allow-other-keys
)
"Test whether the first elements of SEQUENCE are the same (as per TEST) as the elements of PREFIX.
If RETURN-SUFFIX is T the function
s
returns, as a second value, a
If RETURN-SUFFIX is T the function returns, as a second value, a
displaced array pointing to the sequence after PREFIX."
(
remove-from-plistf
args
:return-suffix
)
(
declare
(
dynamic-extent
args
)
)
(
let
((
sequence-length
(
length
sequence
))
(
prefix-length
(
length
prefix
)))
(
if
(
<=
prefix-length
sequence-length
)
(
let
((
mismatch
(
apply
#'
mismatch
prefix
sequence
args
)))
(
let
((
mismatch
(
apply
#'
mismatch
prefix
sequence
(
if
return-suffix-supplied-p
(
remove-from-plist
args
:return-suffix
)
args
))))
(
if
mismatch
(
if
(
<
mismatch
prefix-length
)
(
values
nil
nil
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment