Intro to the Inflex language for programmers

Audience: people who have programmed before.

Here’s a brief introduction to Inflex syntax. We’ll be writing a much
more detailed set of documentation soon, including interactive
examples in the page. But right now, hopefully the below is enough to
get you started.

Table of Contents


*, /, +, - are supported. Try 2 * 3 + 5.0 in the app.

You can use * 1.00000 to get e.g. 5 decimal places of precision.

Ordering and comparison

<, <=, >= for ordering. Try 4 = 5 or 42 * 23 < 53 * 24 in the app.

= and /= for comparison.

Currently these work on numbers and text, but not lists or records (yet).


You can put records together as:

{foo: 1, "bar": 123}


Try calling one cell person with {name: "Charlie"} in it. Then in
another cell, you can write


You can refer to choices with hashtag syntax, like:



#ok(123)/#none - this is used by CSV import for missing fields.

It’s fine to make a list like [#red, #black, #red, #blue].

See if section.


Put your text in speech marks:


But the Inflex interface will display a text editor, so you can just
edit it like that after hitting enter.


Simply write,

x: x * x

And this means "a function of input x with output x * x". Done!

See below for a good example.

Function calls

Familiar like in spreadsheets:


A nicer way to call functions is using dot syntax:


Any built in function or cell with a function in it can be called in this way.

Available functions

There is a limited list so far:

Name Example
map map(x: x * 2, [1,2,3])
filter filter(x: x > 2, [1,2,3])
sum sum([1,2,3,4])
average average([1,2,3,4])
vega vega({...}) (see vega)
null null([])
length length([1,2,3])
distinct distinct([2,3,3,4,3,2])
minimum minimum([1,2,3])
maximum maximum([1,2,3])
sort sort([4,3,2,4,2,1])
find find(x:x>5,[2,5,8,2,1])
all all(x:x /= 0,[1,2,3,4])
any any(x:x=0,[1,2,3,0,4])
from_ok from_ok(0,#ok(1))


Cases currently only work on variants (#foo).

if #true { #true: "ok", _: "boo!" }

if 3 > 2 { #true: "Yep", _: "Maths is broken!" }
if #true { #true: "true", #false: "false" }

Wildcards (x below):

if #true { #true: "true", x: "false" }

Arguments to variants:

if sum([1,2,3,4]) { #ok(n): n, x: 0 }


Tables are just lists of records. In the UI, you see a table.

Underneath, this is just:


So you can use map, filter, sum, etc. on them.