SEQUENCE FUNCTIONS


These functions work on sequences -- lists, arrays, or strings.


CONCATENATE SEQUENCES

(concatenate <type> <expr> ...)

If result type is string, sequences must contain only characters.


GET THE NTH ELEMENT OF A SEQUENCE

(
elt <expr> <n>)


APPLY FUNCTION TO SUCCESSIVE ELEMENTS

(
map <type> <fcn> <expr> ...)

(map-into <target> <fcn> [<expr> ...])


APPLY FUNCTION TO ELEMENTS UNTIL FALSE

(every <fcn> <expr> ...)

(notevery <fcn> <expr> ...)

notevery returns T if there is a NIL function result, else NIL


APPLY FUNCTION TO ELEMENTS UNTIL TRUE

(some <fcn> <expr> ...)

(notany <fcn> <expr> ...)

notany returns NIL if there is a non-NIL function result, else T


FIND THE LENGTH OF A SEQUENCE

(length <expr>)

Note that a circular list causes an error. To detect a circular list, use LIST-LENGTH.


REVERSE A SEQUENCE

(reverse <expr>)

DESTRUCTIVELY REVERSE A SEQUENCE

(nreverse <expr>)


EXTRACT A SUBSEQUENCE

(subseq <seq> <start> [<end>])


DESTRUCTIVELY SORT A SEQUENCE

(sort <seq> <test> &key :key)


SEARCH FOR SEQUENCE

(
search <seq1> <seq2> &key :test :test-not :key :start1 :end1 :start2 :end2)


REMOVE ELEMENTS FROM A SEQUENCE

(remove <expr> <seq> &key :test :test-not :key :start :end)


REMOVE ELEMENTS THAT PASS TEST

(remove-if <test> <seq> &key :key :start :end)

REMOVE ELEMENTS THAT FAIL TEST

(remove-if-not <test> <seq> &key :key :start :end)


COUNT MATCHING ELEMENTS IN A SEQUENCE

(
count <expr> <seq> &key :test :test-not :key :start :end)


COUNT ELEMENTS THAT PASS TEST

(
count-if <test> <seq> &key :key :start :end)

COUNT ELEMENTS THAT FAIL TEST

(count-if-not <test> <seq> &key :key :start :end)


FIND FIRST MATCHING ELEMENT IN SEQUENCE

(
find <expr> <seq> &key :test :test-not :key :start :end)


FIND FIRST ELEMENT THAT PASSES TEST

(
find-if <test> <seq> &key :key :start :end)

FIND FIRST ELEMENT THAT FAILS TEST

(find-if-not <test> <seq> &key :key :start :end)


FIND POSITION OF FIRST MATCHING ELEMENT IN SEQUENCE

(position <expr> <seq> &key :test :test-not :key :start :end)



FIND POSITION OF FIRST ELEMENT THAT PASSES TEST

(
position-if <test> <seq> &key :key :start :end)


FIND POSITION OF FIRST ELEMENT THAT FAILS TEST

(
position-if-not <test> <seq> &key :key :start :end)


DELETE ELEMENTS FROM A SEQUENCE

(delete <expr> <seq> &key :key :test :test-not :start :end)


DELETE ELEMENTS THAT PASS TEST

(
delete-if <test> <seq> &key :key :start :end)

DELETE ELEMENTS THAT FAIL TEST

(delete-if-not <test> <seq> &key :key :start :end)


REDUCE SEQUENCE TO SINGLE VALUE

(
reduce <fcn> <seq> &key :initial-value :start :end)



REMOVE DUPLICATES FROM SEQUENCE

(
remove-duplicates <seq> &key :test :test-not :key :start :end)


REPLACE ITEMS IN SEQUENCE

(
fill <seq> <expr> &key :start :end)

Defined in common.lsp


REPLACE ITEMS IN SEQUENCE FROM SEQUENCE

(
replace <seq1> <seq2> &key :start1 :end1 :start2 :end2)

Defined in common.lsp


XLISP-PLUS - Version 2.1g - Tom Almy tom.almy@tek.com - 18 JUL 94
Generated with
WebMaker