Giter Site home page Giter Site logo

matlike's Introduction

Matlike: A language for calculating matrices

Introduction

Matlike is an experimental language for calculating matrices. Matlike have characteristics as follows:

  • First-class matrices

Matrices is first-class citizen in Matlike. For example, a matrix is described as follows:

val m = [
 1 2 3
 4 5 6
] // val m: Matrix<Int, 2, 3>

It is same as below.

val m = [
  1, 2, 3
  4, 5, 6
]

Note that any comma or any square bracket is not needed unlike other languages.

  • Powerful matrix type inference as an extension of Hindley-Milner type inference

If you write as follows:

def mult(x, y) = x _*_ y

You'll get below.

def mult<A, B, C, D>(x: Matrix<A, B, C>, y: Matrix<A, C, D>): Matrix<A, B, D> = x _*_ y

You don't need to write extra type annotations mostly if you use not-overloaded operators.

Matlike is not for production purpose. It is experimentation of type inference about matrix types.

Build from sources

Since Matlike is not released yet, you'll need to build matlike.jar from sources.

Requirement:

  • Java 8 or later
  • sbt 1.3.0 or later
$ sbt assembly
...

$ find . -name "*.jar"
./target/scala-2.13/matlike.jar

$ java -jar target/scala-2.13/matlike.jar
> 1
value = 1
> 23
value = 23
> [1 2 3; 4 5 6]
value =
[
  1 2 3
  4 5 6
]

> [1 2; 3 4; 5 6] + 3
value =
[
  4 5
  6 7
  8 9
]

$ java -jar target/scala-2.13/matlike.jar -e "[1 2 3; 4 5 6]"

[
  1 2 3
  4 5 6
]

matlike's People

Contributors

scala-steward avatar kmizu avatar

Stargazers

Itsuru Nomaki avatar Nick Imanzi avatar Naoki Aoyama avatar ShankarShastri avatar メタ構文変数 avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

scala-steward

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.