coalton
Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.3%) to scientific vocabulary
Keywords
Repository
Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
Basic Info
- Host: GitHub
- Owner: coalton-lang
- License: mit
- Language: Common Lisp
- Default Branch: main
- Homepage: https://coalton-lang.github.io/
- Size: 3.51 MB
Statistics
- Stars: 1,435
- Watchers: 36
- Forks: 81
- Open Issues: 135
- Releases: 0
Topics
Metadata Files
README.md
Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
Coalton integrates directly into Common Lisp:
```lisp (defpackage #:differentiation (:use #:coalton #:coalton-prelude) (:local-nicknames (#:sym #:coalton-library/symbol)) (:export #:Expr #:EConst #:EVar #:E+ #:E*) (:export #:diff #:t #:d/dt))
(in-package #:differentiation)
(named-readtables:in-readtable coalton:coalton)
(coalton-toplevel ;; Define a new parametric algebraic data type for simple ;; mathematical expressions. (define-type (Expr :t) "A symbolic expression of basic arithmetic." (EConst :t) (EVar sym:Symbol) (E+ (Expr :t) (Expr :t)) (E* (Expr :t) (Expr :t)))
;; The classic diff function, in Coalton.
(declare diff (Num :t => sym:Symbol -> Expr :t -> Expr :t))
(define (diff x f)
"Compute the derivative of f with respect to x."
(match f
((EConst _) ; c' = 0
(EConst 0))
((EVar s) ; x' = 1
(if (== s x) (EConst 1) (EConst 0)))
((E+ a b) ; (a+b)' = a' + b'
(E+ (diff x a) (diff x b)))
((E* a b) ; (ab)' = a'b + ab'
(E+ (E* (diff x a) b)
(E* a (diff x b))))))
;; We can use t just fine since Coalton doesn't import cl:t.
(define t (sym:make-symbol "t"))
(declare d/dt (Num :t => Expr :t -> Expr :t)) (define d/dt "The time derivative operator." (diff t))) ```
It also works directly in the REPL:
```lisp CL-USER> (in-package #:differentiation) DIFFERENTIATION> (coalton-toplevel (define (square x) (E* x x))) ;; SQUARE :: ∀ A. ((EXPR A) → (EXPR A))
DIFFERENTIATION> (coalton (d/dt (E+ (square (EVar t)) (EConst 1))))
.(E+ #.(E+ #.(E* #.(ECONST 1) #.(EVAR |t|))
#.(E* #.(EVAR |t|) #.(ECONST 1)))
#.(ECONST 0))
```
Type errors are discovered at compile-time, and errors are printed beautifully without sacrificing Common Lisp's interactive debugging facilities.
DIFFERENTIATION> (coalton (dt (E+ (EConst 1/2) (EConst 0.5))))
error: Type mismatch
--> repl:1:32
|
1 | (coalton (d/dt (E+ (EConst 1/2) (EConst 0.5))))
| ^^^^^^^^^^^^ Expected type '(EXPR FRACTION)' but got '(EXPR F32)'
Coalton is currently used in production to build defense and quantum computing software.
Getting Started
[!WARNING] Coalton has not reached "1.0" yet. This means that, from time to time, you may have a substandard user experience. While we try to be ANSI-conforming, Coalton is currently only tested on recent versions of SBCL, Allegro CL, and Clozure CL.
Coalton will not be in Quicklisp until it reaches its first stable version.
Prepare: Install SBCL (on macOS with Homebrew: brew install sbcl). Install Quicklisp by following instructions here. (The step command involving gpg is not needed.) After installing Quicklisp, you should have a quicklisp folder which will make installing Coalton easier.
Install: Clone this repository into a place your Lisp can see (e.g., ~/quicklisp/local-projects/).
Use: Either run (ql:quickload :coalton), or add #:coalton to your ASD's :depends-on list.
Test: Compile the tests with (ql:quickload :coalton/tests), then run the tests with (asdf:test-system :coalton).
[!NOTE] Running the Coalton test suite on SBCL requires GNU MPFR in order to run
Big-Floattests. If you would like to run tests without installinggnu-mpfr, you can use Coalton's portableBig-Floatimplementation by running(pushnew :coalton-portable-bigfloat *features*)before loading Coalton.
Learn: Start with Intro to Coalton and the standard library reference, and then take a peek at the examples directory. It may also be helpful to check out the introductory blog post.
What's Here?
This repository contains the source code to the Coalton compiler, and the standard library.
It also contains a few example programs, such as:
- Some simple pedagogical programs,
- An implementation of Jones's Typing Haskell in Haskell, and
- An implementation of a simple Quil parser using parser combinators.
Lastly and importantly, we maintain a collection of documentation about Coalton in the docs directory.
Get Involved
Want to ask a question about Coalton, propose a feature, or share a cool program you wrote? Try posting in the GitHub Discussions page!
We welcome contributions of all forms, especially as we stabilize toward a 1.0 release. We would be grateful to receive:
- bug reports (filed as issues),
- bug fixes and typo corrections (filed as pull requests),
- small example programs, and
- user experience troubles.
Owner
- Name: coalton-lang
- Login: coalton-lang
- Kind: organization
- Repositories: 3
- Profile: https://github.com/coalton-lang
The Coalton programming language.
Citation (CITATION.cff)
cff-version: 1.2.0 type: software message: "If you use this software, please cite it as below." title: "coalton" authors: - name: coalton-lang contributors version: 0.0.1 license: MIT repository-code: "https://github.com/coalton-lang/coalton" url: "https://coalton-lang.github.io/" abstract: "Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp." keywords: - functional - fp - "functional programming" - "Common Lisp" - Lisp - Haskell - hindley-milner
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 243
- Total pull requests: 484
- Average time to close issues: 2 months
- Average time to close pull requests: 14 days
- Total issue authors: 25
- Total pull request authors: 22
- Average comments per issue: 0.89
- Average comments per pull request: 0.92
- Merged pull requests: 357
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 121
- Pull requests: 295
- Average time to close issues: 27 days
- Average time to close pull requests: 10 days
- Issue authors: 18
- Pull request authors: 16
- Average comments per issue: 0.68
- Average comments per pull request: 0.67
- Merged pull requests: 218
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stylewarning (94)
- Izaakwltn (41)
- eliaslfox (39)
- YarinHeffes (20)
- jbouwman (9)
- Jason94 (6)
- gabrielshanahan (4)
- macrologist (4)
- colescott (4)
- shirok (3)
- amorphedstar (3)
- karlosz (3)
- digikar99 (2)
- garlic0x1 (2)
- Mira-public (1)
Pull Request Authors
- jbouwman (141)
- YarinHeffes (121)
- stylewarning (71)
- Izaakwltn (70)
- garlic0x1 (46)
- eliaslfox (28)
- shirok (19)
- colescott (14)
- amorphedstar (12)
- Jason94 (10)
- fukamachi (10)
- macrologist (8)
- digikar99 (6)
- gahr (2)
- xskoak (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v3 composite
- peter-evans/create-pull-request v4 composite
- actions/checkout v3 composite