Language Samples

Visi is a simple language that defines functions and relationships among sources (inputs) and sinks (outputs).

A source is defined by placing a question mark before an identifer: ?name

A sink is defined by putting quotes around a name and assigning its value: "Age" = 47

Functions are defined: add41 v = v + 41

Functions are applied "Answer" = add41 1

Types are infered: and = p1 && p2 are all infered to be Boolean

Hello World:

"Greeting" = "Hello, World!" // Sink a constant String

Boolean Operations:

"And" = p1 && p2
?p1
?p2

Numeric Operations:

"Age" = 2024 - birthYear
?birthYear // birthYear infered as Number

Complex Relationships:

total = subtotal + tax
tax = taxable * taxRate
subtotal = taxable + nonTaxable
"Total" = total // sink the total
"Tax" = tax // sink the tax
?taxRate // source the tax rate
?taxable
?nonTaxable

For more information, please see the Visi Language Document.

© David Pollak 2024