BLUE APPLES

---

PROGRAMS

A compiled and (almost) purely functional programming language with lazy evaluation, no mutable data types and a minimalist entirely indentation-sensitive syntax.

Syntax

In Flow, the arguments of every command/function are listed vertically to the right of it, all at the same indentation level of the first one.
The only exception to this rule is the "txt" command (see the "textwall command" section below).

alpha beta epsilon
           zeta
           eta
      gamma theta
            iota
            kappa
      delta lambda
            mu
            nu

Example: program executing the function "alpha" on the arguments "beta" (which in turn operates on "epsilon", "zeta" and "eta"), "gamma" (which in turn operates on "theta", "iota" and "kappa") and "delta" (which in turn operates on "lambda", "mu" and "nu"").
Please be aware that none of the words used in this example are actual Flow keywords, they're only used as placeholders to illustrate how Flow syntax works.

Types work in progress...
Commands

Here are comprehensive lists of all commands in Flow, divided by their module.

Default commands work in progress...
"output"
output a

(a must be a string)
prints a;

"intput"
intput a

(a must be a string)
waits until an user enters a, then adds the entered string (including a) as the last value of store;

"input"
input a

(a must be a string)
waits until an user enters a, then adds the entered string (not including a) as the last value of store;

"do"
do a
   b
   c
   ...

(a, b, c, etc... must be actions)
a, then b, then c, etc...;

"if"
if a
   b
   c
   d
   e
   f
   ...

(a, c, e, etc... must be statements; b, d, f, etc... can be anything)
if a is true, b; else, if c is true, d; else, if e is true, f; etc...;

"case"
case a
     b
     c
     d
     e
     f
     ...

(a, b, c, etc... must be statements; d, e, f, etc... can be anything)
if a is true, d; else, if b is true, e; else, if c is true, f; etc...;

"try"
try a
    b
    c
    ...

(a, b, c, etc... must be actions)
a; if a would result in an error, b instead; if b too would result in an error, c instead; etc...

"let"
let a
    b
    c
    d
    e
    f
    ...
    g

(a, c, e, etc... must be user-defined words; e, d, f, etc... can be anything; g must be a command)
executes g, where a is defined as b, c is defined as d, e is defined as f, etc...

"el"
el a
   b

(a and b must be sets)
list of the elements of a in b positions

"par"
par a
    b

(a and b must be sets)
parameter b of a

"chn"
chn a

(a must be either a number or a numerical string)
numerical string representation of a, if a is a number; vice-versa otherwise

"not"
not a

(a must be a statement)
yes if a is no; no otherwise

"both"
both a
     b
     c
     ...

(a, b, c, etc... must be statements)
yes if a, b, c, etc... are all yes; no otherwise

"eith"
eith a
     b
     c
     ...

(a, b, c, etc... must be statements)
yes if at least one among a, b, c, etc... is yes; no otherwise

"ex"
ex a

(a can be anything)
yes if a exists; no otherwise

"in"
in a
   b

(a must be a set; b can be anything)
yes if b is an element of a; no otherwise

"inc"
inc a
    b

(a and b must be sets)
yes if every element of b is also an element of a; no otherwise

"eq"
eq a
   b
   c
   ...

(a, b, c, etc... can be anything)
yes if a, b, c, etc... are all the same value; no otherwise

"inf"
inf a
    b
    c
    ...

(a, b, c, etc... must be numbers)
yes if a, b, c, etc... are placed in increasing order; no otherwise

"sup"
sup a
    b
    c
    ...

(a, b, c, etc... must be numbers)
yes if a, b, c, etc... are placed in decreasing order; no otherwise

"each"
each a
     b
     c

(a must be a set; b is a new user-chosen word; c must be a statement)
yes if c(b) is true for all elements in a (where b is any element in a)

"opp"
opp a

(a must be a number)
-a

"inv"
inv a

(a must be a number)
1/a

"sum"
sum a
    b
    c
    ...

(a, b, c, etc... must be numbers)
a+b+c+etc...

"pro"
pro a
    b
    c
    ...

(a, b, c, etc... must be numbers)
a*b*c*etc...

"dif"
dif a
    b
    c
    d
    ...

(a, b, c, d, etc... must be numbers)
a-b-c-d-etc...

"fra"
fra a
    b
    c
    d
    ...

(a, b, c, d, etc... must be numbers)
a/b/c/d/etc...

"min"
min a

(a must be a set of numbers)
lowest element of a

"max"
max a

(a must be a set of numbers)
highest element of a

"num"
num a

(a must be a set)
number of elements in a

"cap"
cap a

(a must be a character)
capital version of a

"decap"
decap a

(a must be a character)
non-capital version of a

"set"
set a
    b
    c
    ...

(a, b, c, etc... can be anything)
set of the elements a, b, c, etc...

"cyset"
cyset a
      b
      c
      ...

(a, b, c, etc... can be anything)
set of infinite repetitions of a, b, c, etc...

"des"
set a
    b
    c
    d
    ...

(a must be a set; b, c, d, etc... can be anything)
set a without the elements b, c, d, etc...

"allboth"
allboth a
        b
        c
        ...

(a, b, c, etc... must be sets)
set of all elements who are simultaneously elements of a, b, c, etc...

"alleith"
alleith a
        b
        c
        ...

(a, b, c, etc... must be sets)
set of all elements who are elements of at least one among a, b, c, etc...

"span"
span a

(a must be a numbers)
set of all integers going from 1 to a

span a
     b

(a and b must be numbers)
set of all integers going from a to b

span a
     b
     c

(a, b and c must be numbers)
set of all numbers going from a to c, at intervals of b

"such"
such a
     b
     c

(a must be a set; b is a new user-chosen word; c must be a statement)
set of all elements in a such that c(b) is true (where b is any element in a)

"for"
for a
    b
    c

(a must be sets; b is a new user-chosen word; c can be anything)
set of all c(b) (where b is any element in a)

"con"
con a
    b
    c
    ...

(a, b, c, etc... must be sets)
set comprised of all the elements in a, b, c, etc...

"sort"
sort a

(a must be a set)
set comprised of all the elements in a, sorted by alphabetical and/or numerical order

"rev"
rev a

(a must be a set)
set comprised of all the elements in a, in inverted order

"evar"
evar a
     b
     c
     d
     e
     f
     g
     ...

(a, b, c, d, e, f, g, etc... must be sets)
set a with the sequences of elements described by b, d, f, etc... replaced with those described by c, e, g, etc...

"nvar"
nvar a
     b
     c
     d
     e
     f
     g
     ...

(a, b, c, d, e, f, g, etc... must be sets)
set a with the elements in positions described by b, d, f, etc... replaced with those in positions described by c, e, g, etc...

"that"
that a

(a must be a string)
content of the file whose absolute path is described by a

"this"
this a

(a must be a string)
content of the file whose path relative to Flow's base directory is described by a

"fun"
fun a
    b

(a must be a set; b can be anything)
function that operates b on the elements of a

"rec"
rec a

(a must be a function)
function that applies a recursively to its argument and to all elements in it

Unpackaging command
unp a

(a must be a set)
all the elements of a (as if they weren't elements of a set)

Unwinding command
unw a

(a must be a string)
code block described by a

Textwall command
txt abc...

(abc... must be a text block)
string that, when printed, reports abc... exactly as it's written

Comments
| abc...

(abc... must be a text line)
ignored

"Math" module commands work in progress...
do unp for natural
           n
           if each des span n
                       1
                       n
                   i
                   not in natural
                          fra n
                              i
              output chn n

do unp for natural
           n
           if eq 2
                 num such span n
                          i
                          in natural
                             fra n
                                 i
              output chn n

Examples: different ways of writing a program that lists prime numbers

First published: 04/02/2020.

Last edit: 04/02/2020.