1. Introduction
  2. Usage
  3. Documentation
    1. group/key
    2. make-</key
  4. Examples
  5. Notes
  6. Bugs and Limitations
  7. Author
  8. License
  9. Requirements
  10. Version history

Introduction

Combinators grab-bag.

Usage

(require-extension combinators)

Documentation

group/key

[procedure] (group/key KEYPROC LYST [EQUALITY equal?])

Groups a LYST of elements by some key attribute. Uses the single-argument KEYPROC to retrieve key values & the EQUALITY procedure to compare them.

Returns a list of grouped elements.

make-</key

[procedure] (make-</key KEYPROC [LESS-THAN <])

Returns a two-argument procedure that uses the single-argument KEYPROC to retrieve key values & the two-argument LESS-THAN procedure to compare them.

Examples

(group/key identity '(1 2 3 3 4 4 4)) ;=> ((1) (2) (3 3) (4 4 4))

(group/key car '((a 1) (a 2) (b 1)))  ;=> '(((a 1) (a 2)) ((b 1)))

(sort '(("a" . 1) ("z" . 3) ("b" . 2)) (make-</key first string-ci<?))
;=> (("a" . 1) ("b" . 2) ("z" . 3))

Notes

Bugs and Limitations

Author

License

Public Domain.

Requirements

Version history

1.0
Hello