kusanagi
v0.8.11
Published
CoffeeScript style syntax for Motoko language
Downloads
270
Readme
Kusanagi
The initial work on this project was funded by the Origyn Foundation.
CoffeeScript style syntax for the Motoko language. Try Kusanagi
import State "State"
module
public class Grid(state : State.State)
let grid = state
let n = grid.size()
public func size() : Nat
n
func nextCell(i : Nat, j : Nat) : State.Cell
let l : Nat = living i, j
if get i, j
l == 2 or l == 3
else
l == 3
func next(dst : Grid)
for i in grid.keys()
let cool = true
for j in grid[i].keys()
let yo = "wat"
dst.set i, j, nextCell i, j
Get Started
npm install -g kusanagi
kusanagi < src.ku > out.moFeatures
- Indentation based blocks
- Let shorthand
x = 5->let x = 5 - Alternative with syntax
becomeslet x = { ...a ...b }let x = { a and b } - Chained comparisons
Becomesx < y <= zx < y and y <= z matchmatch x, #nat(val), 0 --- switch(x) { case(#nat(val)) { val }; case(_){ 0 } };taketake x, 0 --- switch(x) { case(null) { 0 }; case(?val) { val } };- Null soaks
student.classes?.get(classID) --- do?{student.classes!.get(classID)};
