cons

An implementation of Lisp/Scheme-like cons in Python

https://github.com/pythological/python-cons

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

algebraic-data-types cons lisp-like python scheme-like
Last synced: 6 months ago · JSON representation

Repository

An implementation of Lisp/Scheme-like cons in Python

Basic Info
  • Host: GitHub
  • Owner: pythological
  • License: lgpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 82 KB
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 4
  • Open Issues: 1
  • Releases: 4
Topics
algebraic-data-types cons lisp-like python scheme-like
Created over 6 years ago · Last pushed 8 months ago
Metadata Files
Readme Funding License

README.md

Build Status Coverage Status PyPI

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

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

All Time
  • Total Commits: 31
  • Total Committers: 2
  • Avg Commits per committer: 15.5
  • Development Distribution Score (DDS): 0.032
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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
enhancement (1) help wanted (1) good first issue (1)
Pull Request Labels
enhancement (3) bug (2) dependencies (2)

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.

  • Versions: 18
  • Dependent Packages: 6
  • Dependent Repositories: 131
  • Downloads: 360,295 Last month
  • Docker Downloads: 1,274
Rankings
Downloads: 0.6%
Dependent packages count: 1.3%
Dependent repos count: 1.3%
Docker downloads count: 3.3%
Average: 7.3%
Forks count: 17.0%
Stargazers count: 20.4%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/pythological/python-cons
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.6%
Forks count: 9.8%
Average: 10.5%
Dependent repos count: 10.8%
Stargazers count: 11.7%
Last synced: 6 months ago
conda-forge.org: cons
  • Versions: 2
  • Dependent Packages: 6
  • Dependent Repositories: 19
Rankings
Dependent repos count: 8.1%
Dependent packages count: 9.0%
Average: 33.8%
Forks count: 58.8%
Stargazers count: 59.2%
Last synced: 6 months ago
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.

  • Versions: 1
  • Dependent Packages: 3
  • Dependent Repositories: 19
Rankings
Dependent repos count: 32.1%
Dependent packages count: 41.0%
Average: 46.1%
Stargazers count: 55.5%
Forks count: 56.0%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • 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 *
setup.py pypi
  • logical-unification >=0.4.0
.github/workflows/pypi.yml actions
  • 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
.github/workflows/tests.yml actions
  • 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