All Projects → stylewarning → deprecated-coalton-prototype

stylewarning / deprecated-coalton-prototype

Licence: MIT license
Coalton is (supposed to be) a dialect of ML embedded in Common Lisp.

Programming Languages

common lisp
692 projects
NewLisp
63 projects

Projects that are alternatives of or similar to deprecated-coalton-prototype

Scoper
Fuzzy and semantic search for captioned YouTube videos.
Stars: ✭ 225 (+7.66%)
Mutual labels:  ml
mindsdb server
MindsDB server allows you to consume and expose MindsDB workflows, through http.
Stars: ✭ 3 (-98.56%)
Mutual labels:  ml
GIMLeT
GIMLeT – Gestural Interaction Machine Learning Toolkit
Stars: ✭ 33 (-84.21%)
Mutual labels:  ml
Darkon
Toolkit to Hack Your Deep Learning Models
Stars: ✭ 231 (+10.53%)
Mutual labels:  ml
Tensorflow
An Open Source Machine Learning Framework for Everyone
Stars: ✭ 161,335 (+77093.78%)
Mutual labels:  ml
php-chess
A chess library for PHP.
Stars: ✭ 42 (-79.9%)
Mutual labels:  ml
Nyaggle
Code for Kaggle and Offline Competitions
Stars: ✭ 209 (+0%)
Mutual labels:  ml
sharpmask
TensorFlow implementation of DeepMask and SharpMask
Stars: ✭ 31 (-85.17%)
Mutual labels:  ml
COVID-Net
Launched in March 2020 in response to the coronavirus disease 2019 (COVID-19) pandemic, COVID-Net is a global open source, open access initiative dedicated to accelerating advancement in machine learning to aid front-line healthcare workers and clinical institutions around the world fighting the continuing pandemic. Towards this goal, our global…
Stars: ✭ 41 (-80.38%)
Mutual labels:  ml
metaflowbot
Slack bot for monitoring your Metaflow flows!
Stars: ✭ 22 (-89.47%)
Mutual labels:  ml
Data Science Free
Free Resources For Data Science created by Shubham Kumar
Stars: ✭ 232 (+11%)
Mutual labels:  ml
Flambe
An ML framework to accelerate research and its path to production.
Stars: ✭ 236 (+12.92%)
Mutual labels:  ml
mindsdb native
Machine Learning in one line of code
Stars: ✭ 34 (-83.73%)
Mutual labels:  ml
Books
整理一些书籍 ,包含 C&C++ 、git 、Java、Keras 、Linux 、NLP 、Python 、Scala 、TensorFlow 、大数据 、推荐系统、数据库、数据挖掘 、机器学习 、深度学习 、算法等。
Stars: ✭ 222 (+6.22%)
Mutual labels:  ml
managed ml systems and iot
Managed Machine Learning Systems and Internet of Things Live Lesson
Stars: ✭ 35 (-83.25%)
Mutual labels:  ml
Amulet
An ML-like functional programming language
Stars: ✭ 219 (+4.78%)
Mutual labels:  ml
hi-ml
HI-ML toolbox for deep learning for medical imaging and Azure integration
Stars: ✭ 150 (-28.23%)
Mutual labels:  ml
osdg-tool
OSDG is an open-source tool that maps and connects activities to the UN Sustainable Development Goals (SDGs) by identifying SDG-relevant content in any text. The tool is available online at www.osdg.ai. API access available for research purposes.
Stars: ✭ 22 (-89.47%)
Mutual labels:  ml
djl
An Engine-Agnostic Deep Learning Framework in Java
Stars: ✭ 3,080 (+1373.68%)
Mutual labels:  ml
Projects-Archive
This hacktober fest, the only stop you’ll need to make for ML, Web Dev and App Dev - see you there!
Stars: ✭ 21 (-89.95%)
Mutual labels:  ml

Deprecated! Moved!

This version of Coalton was a prototype and is here for archival purposes only. It is not maintained. The project is now officially located at this link.


Coalton

Check out the library to see the latest that Coalton can express!

Coalton is a dialect of ML embedded in Common Lisp. It emphasizes practicality and interoperability with Lisp, and is intended to be a DSL that allows one to gradually make their programs safer.

Coalton currently allows one to do the following in Common Lisp:

  • Express statically typed programs similar in spirit to Standard ML, OCaml, and Haskell.
  • Perform compile-time type inference and type checking à la Hindley-Milner type inference.
    • Optionally, global values can be manually declared if desired.
  • Interoperate an ML-like with Common Lisp, in both directions. All data values are native and easy data structures.
  • Define parameterized algebraic data types, including mutually recursive types.
  • Define macros using the standard defmacro facility that is understood by Coalton. (In Coalton, if is a macro that expands into a match on the Boolean type!)

Coalton does not intend to re-define how Lisp is written entirely, but rather it serves to augment Lisp with an additional, available programming dialect.

Coalton is a work-in-progress and has some limitations:

  • [bug] Unit tests aren't at all written. USE AT YOUR OWN RISK!
  • [bug] Redefinitions don't play well in a lot of ways:
    • Types aren't globally re-checked or warned about.
    • The internal type DB is frequently clobbered with new data.
  • [bug] Declared types are used for inference, but are simply believed without question. As such, a bug in a declaration will cause runtime bugs.
  • [bug] Nested patterns, guards, and a more elaborate pattern grammar is not implemented.
  • Generalized algebraic data types, type classes, and high-order types are neither implemented nor supported.
  • ML structures, signatures, or functors are neither implemented nor supported.

Coalton-Lisp Bridge

Coalton within Lisp

Coalton value definitions come in two forms.

;; Coalton
(define f v)
;; Lisp
f   ; an object (possibly a function) in the variable namespace
    ; can be lexically shadowed

;; Coalton
(define (f x ...) v)
;; Lisp
f    ; a function object in the variable namespace
     ; can be lexically shadowed
#'f  ; a function object in the function namespace

Lisp within Coalton

Use the coalton:lisp macro to embed Lisp code inside of a Coalton program. Of course, Coalton will not be able to verify your Lisp code is correct. For example, the following function uses Common Lisp's ~R format directive to write integers as strings.

;; Coalton
(coalton-toplevel
  (declare integer-name (fn Integer -> String))
  (define (integer-name n)
    (lisp String
      (cl:format cl:nil "~R" n))))

Examples

You may want to check out the library for example code. It represents the latest of what Coalton can do, and it also has a lot of definitions that the following depends on. (It is loaded by default as a part of Coalton.)

First we will load the system and get into COALTON-USER. Note that this package currently does not :USE the COMMON-LISP package, so you must qualify CL symbols manually.

CL-USER> (ql:quickload :coalton)
...
CL-USER> (in-package :coalton-user)
#<COMMON-LISP:PACKAGE "COALTON-USER">
COALTON-USER>

We already have a Maybe algebraic data type (ADT) defined in the library. We can immediately construct these values in Common Lisp. We use the convention in Lisp code to capitalize the first letter of constructors and type names. (Otherwise the capitalization has no significance.)

COALTON-USER> (cl:list (Just 5) Nothing Nothing)
(#.(JUST 5) #.NOTHING #.NOTHING)
COALTON-USER> cl::(eq (second *) (third *))
COMMON-LISP:T

We can define a type-safe function gg. Definitions must occur within coalton-toplevel forms.

COALTON-USER> (coalton-toplevel
                (define (gg x) (if x (left 1) (right x))))
GG

And we can use gg from Lisp.

COALTON-USER> (cl:funcall gg True)
#.(LEFT 1)

More conveniently, however, we can use the Coalton-to-Lisp bridge using the coalton macro.

COALTON-USER> (coalton (gg True))
#.(LEFT 1)

It's more convenient because it doesn't use funcall, and catches compile-time type errors!

COALTON-USER> (coalton (gg 1))

Type error: The types INTEGER and BOOLEAN don't match.
   [Condition of type COMMON-LISP:SIMPLE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1008E40413}>)

We can inspect what Coalton inferred the type of gg to be using type-of. Note that, unlike in Common Lisp, coalton:type-of takes a symbol naming a global value.

COALTON-USER> (type-of 'gg)
(FN BOOLEAN -> (EITHER INTEGER BOOLEAN))

The Coalton library defines Liszt, whose name will surely change. It's a homogeneous list type, and as usual, we can construct values in Lisp.

COALTON-USER> (coalton-toplevel
               (define l (Kons (Just 1) (Kons Nothing (Kons (Just 2) Knil)))))
#.(KONS #.(JUST 1) #.(KONS #.NOTHING #.(KONS #.(JUST 2) #.KNIL)))

The type inferencer will deduce the type correctly.

COALTON-USER> (type-of 'l)
(LISZT (MAYBE INTEGER))

And it will also catch errors.

COALTON-USER> (coalton (Kons 1 2))

Type error: The types INTEGER and (LISZT INTEGER) don't match.
    [Condition of type SIMPLE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1008E28413}>)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].