cons
An implementation of Lisp/Scheme-like cons in Python
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords
Repository
An implementation of Lisp/Scheme-like cons in Python
Basic Info
Statistics
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 1
- Releases: 4
Topics
Metadata Files
README.md
Python cons
An implementation of cons in Python.
Usage and Design
The cons package attempts to emulate the semantics of Lisp/Scheme's cons as closely as possible while incorporating all the built-in Python sequence types:
```python
from cons import cons, car, cdr cons(1, []) [1]
cons(1, ()) (1,)
cons(1, [2, 3]) [1, 2, 3] ```
In general, cons is designed to work with collections.abc.Sequence types.
According to the cons package, None corresponds to the empty built-in list, as nil does in some Lisps:
```python
cons(1, None) [1] ```
The cons package follows Scheme-like semantics for empty sequences:
```python
car([]) Traceback (most recent call last): File "
", line 1, in ConsError: Not a cons pair cdr([]) Traceback (most recent call last): File "
", line 1, in ConsError: Not a cons pair
```
By default, str types are not considered cons-pairs, although they are sequences:
```python
cons("a", "string") ConsPair('a' 'a string') ```
This setting can be overridden and other types can be similarly excluded from consideration by registering classes with the abc-based classes MaybeCons and NonCons.
Features
- Built-in support for the standard Python ordered sequence types: i.e.
list,tuple,Iterator,OrderedDict. ```python >>> from collections import OrderedDict >>> cons(('a', 1), OrderedDict()) OrderedDict([('a', 1)])
* Existing `cons` behavior can be changed and support for new collections can be added through the generic functions `cons.core._car` and `cons.core._cdr`.
* Built-in support for [`unification`][un].
python
from unification import unify, reify, var unify([1, 2], cons(var('car'), var('cdr')), {}) {~car: 1, ~cdr: [2]}
reify(cons(1, var('cdr')), {var('cdr'): [2, 3]}) [1, 2, 3]
reify(cons(1, var('cdr')), {var('cdr'): None}) [1]
```
Installation
python
pip install cons
Development
First obtain the project source:
bash
git clone git@github.com:pythological/python-cons.git
Create a virtual environment and install the development dependencies:
bash
$ pip install -r requirements.txt
Set up pre-commit hooks:
bash
$ pre-commit install --install-hooks
Owner
- Name: Pythological
- Login: pythological
- Kind: organization
- Repositories: 4
- Profile: https://github.com/pythological
Adding more symbolic computation and logic programming to Python
GitHub Events
Total
- Create event: 1
- Release event: 1
- Issues event: 2
- Watch event: 1
- Issue comment event: 2
- Pull request review event: 1
- Pull request event: 1
- Fork event: 1
Last Year
- Create event: 1
- Release event: 1
- Issues event: 2
- Watch event: 1
- Issue comment event: 2
- Pull request review event: 1
- Pull request event: 1
- Fork event: 1
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Brandon T. Willard | b****d@g****m | 30 |
| Oscar Gustafsson | o****n@g****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 15
- Average time to close issues: 6 months
- Average time to close pull requests: 1 day
- Total issue authors: 4
- Total pull request authors: 4
- Average comments per issue: 1.4
- Average comments per pull request: 0.2
- Merged pull requests: 14
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 1
- Pull requests: 2
- Average time to close issues: about 1 month
- Average time to close pull requests: 8 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 1.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- yurivict (2)
- rndubs (1)
- sanmai-NL (1)
- brandonwillard (1)
Pull Request Authors
- brandonwillard (12)
- rndubs (2)
- dependabot[bot] (2)
- oscargus (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 4
-
Total downloads:
- pypi 360,295 last-month
- Total docker downloads: 1,274
-
Total dependent packages: 15
(may contain duplicates) -
Total dependent repositories: 169
(may contain duplicates) - Total versions: 35
- Total maintainers: 1
pypi.org: cons
An implementation of Lisp/Scheme-like cons in Python.
- Homepage: https://github.com/pythological/python-cons
- Documentation: https://cons.readthedocs.io/
- License: lgpl-3.0
-
Latest release: 0.4.7
published 8 months ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/pythological/python-cons
- Documentation: https://pkg.go.dev/github.com/pythological/python-cons#section-documentation
- License: lgpl-3.0
-
Latest release: v0.4.7
published 8 months ago
Rankings
conda-forge.org: cons
- Homepage: https://github.com/pythological/python-cons
- License: LGPL-3.0-only
-
Latest release: 0.4.5
published about 4 years ago
Rankings
anaconda.org: cons
The cons package attempts to emulate the semantics of Lisp/Scheme's cons as closely as possible while incorporating all the built-in Python sequence types.
- Homepage: https://github.com/pythological/python-cons
- License: LGPL-3.0-only
-
Latest release: 0.4.6
published over 2 years ago
Rankings
Dependencies
- black >=19.3b0
- coverage >=5.1
- coveralls *
- diff-cover *
- isort *
- pre-commit *
- pydocstyle >=3.0.0
- pylint >=2.3.1
- pytest >=5.0.0
- pytest-cov >=2.6.1
- pytest-html >=1.20.0
- versioneer *
- logical-unification >=0.4.0
- actions/checkout v2 composite
- actions/download-artifact v2 composite
- actions/setup-python v2 composite
- actions/upload-artifact v2 composite
- pypa/gh-action-pypi-publish master composite
- AndreMiras/coveralls-python-action develop composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- dorny/paths-filter v2 composite
- pre-commit/action v2.0.0 composite