select
2024-10-12
DSL for array and data-frame slices
Upstream URL
Author
License
Select
Selecting subsets of data from arrays, vectors and data-frames
Explore the docs »
Report Bug
·
Request Feature
·
Reference Manual
Table of Contents
About the Project
This library provides:
- An API for taking slices (elements selected by the Cartesian product of vectors of subscripts for each axis) of array-like objects. The most important function is
select
. Unless you want to define additional methods forselect
, this is pretty much all you need from this library. See the documentation for a tutorial. - An extensible DSL for selecting a subset of valid subscripts. This is useful if, for example, you want to resolve column names in a data frame in your implementation of select.
- A set of utility functions for traversing selections in array-like objects.
Built With
Getting Started
To get a local copy up and running follow these steps:
Prerequisites
An ANSI Common Lisp implementation. Developed and tested with SBCL and CCL.
Installation
- Clone the repository
cd ~/quicklisp/local-projects && git clone https://github.com/Lisp-Stat/select.git
- Reset the ASDF source-registry to find the new system (from the REPL)
(asdf:clear-source-registry)
- Load the system
(ql:quickload :select)
Documentation
The API documentation is in the docs/
directory and is available in
emacs info format, PDF and HTML. You can also view the documentation
online.
Usage
The most frequently used form is:
(select object selection1 selection2 ...)
where each selection specifies a set of subscripts along the corresponding axis. The selection specifications are found in the documentation.
For more examples, please refer to the Reference Manual
Roadmap
See the open issues for a list of proposed features (and known issues).
Known Issues
Select
is known to pass all tests on SBCL and ACL (Allegro Common Lisp), and fails two tests on CCL related to vector/array representations. The specifics are described in issue #3. I suspect this to be a bug somewhere in CCL. Version 1.12 of CCL doesn't run on MS Windows, so the obvious next step is not available (install 1.12 and try). It could also be specific to MS Windows. If someone successfully gets this to run on another platform, I'd appreciate hearing about it.
Changes from cl-slice
Documentation Improvements
- Move to HTML based documentation system
- Reference docs now on github.io
- Documented selection iteration
- Improved examples and explanations
Test Improvements
- Ported to FiveAM and refactored
- Improved test coverage
- Added failure messages to aid debugging
- Added tests for selection iteration
Enhancements
- Renamed 'cons' to 'range'
- Range now handles (range x x) => nil
- Selections work identically on sequences; previously differed between lists and vectors
- Vector selections may be specified using a list; previously could only be a vector. See also issue #2
- Sequence selections now honor fill-pointer (fixes first issue on Papp's issue 3)
Bug Fixes
- Range now handles END = (length SEQUENCE)
- Selecting from a list no longer drops dimension
Resources
This system is part of the Lisp-Stat project; that should be your first stop for information. Also see the resources and community pages for more information.
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. Please see CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
License
Distributed under the MS-PL License. See LICENSE
for more information.
Contact
Project Link: https://github.com/lisp-stat/select