File: collect

package info (click to toggle)
scheme9 2025.08.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,080 kB
  • sloc: lisp: 16,752; ansic: 11,869; sh: 806; makefile: 237; sed: 6
file content (9 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
S9 LIB  (collect procedure list)  ==>  list

Collect elements from LIST as long as two subsequent elements
E1 and E2 satisfy the predicate (PROCEDURE E1 E2). When two
subsequent elements do not satisfy the predicate, start a new
output list. Concatenate all output lists in the result.

(collect eq? '(a a a b c c))  ==>  ((a a a) (b) (c c))
(collect < '(1 2 3 3 4 5 4))  ==>  ((1 2 3) (3 4 5) (4))