Features & The type system

1.1 Syntax

PocketML`s syntax is largely based on Standard-ML and Haskell. Some quirks include:

GUI

A large part of PocketML is its editor. Use the Editor tab in the top toolbar to edit files. Close files by long pressing the file tab. Results show up in either the Graphics tab for graphics or the Text Out tab for text output. The info box above the keyboard shows the type of the symbol the cursor is on when clicked (no live type checking yet, because the typechecker is too slow). Manage project files and directories in the Files tab. For advanced file management use a File manager app that can access the InternalStorage/Android/data/org.myapp.test/files/ directory. The Docs tab provides a Hoogle-like interface for searching types, names or libraries.

1.2 Type system

PocketML has a set of builtin types: Vec (numpy arrays), Number, String, Bool, Tuples, Lists, Dict and Maybe. Num is an alias for Number and will replace it eventually.

The operators *, /, +, - support addition of strings, numbers, and Vecs, as long as both sides of the operator have the same type. The ° operator acts the same as *, but allows two different types to be multiplied (i.e. vector-scalar multiplication, string multiplication, etc.).

OperatorType
+,-,*,/a -> a -> a
°a -> b -> a
composition operators:
<<(y -> z) -> (x -> y) -> (x -> z)
>>(x -> y) -> (y -> z) -> (x -> z)
$(x -> y) -> x -> y
logical operators / equality:
&&, ||Bool -> Bool -> Bool
<=, >=, <, >Number -> Number -> Bool

1.3 Builtins

Most of the essentials are contained in the standard library lib.std, but some basic functions are passed through from python directly:

FunctionType
and,orBool -> Bool -> Bool
add,sub,mul,powNumber -> Number -> Number
sqrt, inc, decNumber -> Number
True, FalseBool
equala -> a -> Bool
ltNumber -> Number -> Bool
printa -> ()
print2a -> b -> ()